Skip to content

Latest commit

 

History

History
96 lines (89 loc) · 4.01 KB

README.md

File metadata and controls

96 lines (89 loc) · 4.01 KB

Event-management-system

What is the task

Create a nodejs application which contains 2 models
1.User model with user details like name, email, phone number, role(should be either admin or user).
2. Event model with event name, description, start date , end date, city.

App summary - 

User should be able to sign up and login with email. Use JWT token for authentication. Post that user can create events. Api calls needed

1. Sign up api, Login api (Without auth token)
2. Create event, update event and delete event. (With auth token, only user who created the event can update or delete)
3. Search events based on name and city. It should have sort also. ex - sort_by=“name”, sort_type=“asc/desc” (Without auth token, user can view all events)
4. Fetch all users (only admin should be able to do this)(With auth token)
5. Fetch all users and corresponding events (only admin)(With auth token)
6. Fetch all events by the user (With auth token)

How to run the Project?

  • npm install
  • create .env file and config
  • Run these files /app/models/db-event.js , /app/models/db-user.js for create tables
  • nodemon app.js for run the server.

Events routes

USER Endpoint
user.post('/signup', User.signup) 
user.post('/login',User.login)  
user.get('/users',User.usersByAdmin) 
user.get('/users',User.myEvents)  
Events Endpoint 
event.post('/createEvent', Event.CreateEvent) 
event.post('/editEvent/:eventId', Event.EditEvent) 
event.delete('/deleteEvent/:eventId', Event.DeleteEvent)
event.get('/usersEvents', Event.usersEvents)  
event.get('/events', Event.Search) 

http://localhost:8000/event/signup / signup

  { 
    "name":"exmple",
    "email":"[email protected]",
    "password":"9873752914",
    "phone_num":"9736463632"
  }

http://localhost:8000/event/login / login

  { 
    "name":"exmple",
    "email":"[email protected]",
    "password":"9873752914",
    "phone_num":"9736463632"
  }

http://localhost:8000/event/CreateEvent Create Events

{
    "event_name":"node",
    "description":"happy coding",
    "city":"banglore",
    "start_date":"7/12/2020"
    "end_date" :"7/15/2020"

}

Tables

                                  Register
+----+-------+----------------+----------------------------------------------------------+------------+-----------+
| id | name  | email          | password                                                 | phone_num  | user_role |
+----+-------+----------------+----------------------------------------------------------+------------+-----------+
|  2 | aadil | [email protected]    | sha1$05b2d051$1$2f262132a636b1a3ff588aefcfc08316c0a2b802 | 9971829021 | admin     |
|  8 | sunil | [email protected]    | sha1$eb157c5e$1$5ca5ba30471e286de53f5c33aa00a6d30d432dc3 | 9971829021 | user      |
|  9 | venu  | [email protected] | sha1$9ebecf92$1$21239c17ff13a5d6d133201075cafacecca47f4d | 9736463632 | user      |
+----+-------+----------------+----------------------------------------------------------+------------+-----------+
                                  event
 +----------+---------+-------------+-----------------------+----------+------------+-----------+
| event_id | user_id | event_name  | description           | city     | start_date | end_date  |
+----------+---------+-------------+-----------------------+----------+------------+-----------+
|        2 |       8 | python      | will learn somethings | banglore | 2020-08-15 | 7/15/2020 |
|        5 |       8 | nodejs      | will learn somethings | banglore | 2020-08-15 | 7/15/2020 |
|        6 |       8 | nodejs      | will learn somethings | banglore | 2020-08-15 | 7/15/2020 |
|        7 |       8 | nodejs      | will learn somethings | banglore | 2020-08-15 | 7/15/2020 |
|       14 |       2 | delhi event | dance and party       | delete   | 2020-08-16 | 7/15/2020 |
|       15 |       2 | delhi event | dance and party       | delhi    | 2020-08-16 | 7/15/2020 |
+----------+---------+-------------+-----------------------+----------+------------+-----------+