Event Manager API


Technical description

This app was created using Node + express, TypeORM, and MySQL database as main technologies. Autentication using JSON Web Token with passport to create a token and validate it in every request. Request body validation with Joi.

App description

This app has the intuite to manage events and connect users to events in companies or universities.

Usage

Endpoint - /user

POST /user

Request body

{
  "email": "email@gmail.com.br",
  "password": "@Name123"
}

Response body

{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}

POST /auth

Request body

{
  "email": "email@gmail.com.br",
  "password": "@Name123"
}

Response body

{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}

Endpoint - /event

POST /events

Request body

{
  "name": "A Great Event Name",
  "description": "This is a great event...",
  "place": "Event Place, 123 - City/UF - Country",
  "image": "image url",
  "price": 123,
  "date": "2020/12/01",
  "category": "BUSINESS" or "UNIVERSITY"
}

Response body

{
  "id": 1,
  "name": "A Great Event Name",
  "description": "This is a great event...",
  "place": "Event Place, 123 - City/UF - Country",
  "image": "image url",
  "price": 123,
  "date": "2020/12/01",
  "category": "BUSINESS" or "UNIVERSITY"
}

GET /events

Response body

[
 {
  "id": 1,
  "name": "A Great Event Name",
  "description": "This is a great event...",
  "place": "Event Place, 123 - City/UF - Country",
  "image": "image url",
  "price": 123,
  "date": "2020/12/01",
  "category": "BUSINESS" or "UNIVERSITY"
  }, 
  {...}
]

GET /events/id

Response body

 {
  "id": 1,
  "name": "A Great Event Name",
  "description": "This is a great event...",
  "place": "Event Place, 123 - City/UF - Country",
  "image": "image url",
  "price": 123,
  "date": "2020/12/01",
  "category": "BUSINESS" or "UNIVERSITY"
 }

PUT /events/id

Request body

 {
  "name": "A Great Event Name Changed",
  "description": "This is a great event...",
  "place": "Event Place, 123 - City/UF - Country",
  "image": "image url",
  "price": 321,
  "date": "2020/12/01",
  "category": "BUSINESS" or "UNIVERSITY"
 }

Response body

 {
  "id": 1,
  "name": "A Great Event Name Changed",
  "description": "This is a great event...",
  "place": "Event Place, 123 - City/UF - Country",
  "image": "image url",
  "price": 321,
  "date": "2020/12/01",
  "category": "BUSINESS" or "UNIVERSITY"
 }

DELETE /events/id

Response body

{
    "raw": [],
    "affected": 1
}

Endpoint - /tickets

POST /tickets

Request body

{
   "eventId": 1
}

Response body

[
 {
  "id": 1,
  "name": "A Great Event Name",
  "description": "This is a great event...",
  "place": "Event Place, 123 - City/UF - Country",
  "image": "image url",
  "price": 123,
  "date": "2020/12/01",
  "category": "BUSINESS" or "UNIVERSITY"
  }, 
  {...}
]

GET /tickets

Response body

[
 {
  "id": 1,
  "name": "A Great Event Name",
  "description": "This is a great event...",
  "place": "Event Place, 123 - City/UF - Country",
  "image": "image url",
  "price": 123,
  "date": "2020/12/01",
  "category": "BUSINESS" or "UNIVERSITY"
  }, 
  {...}
]

DELETE /tickets/1

Response body

[
 {
   "id": 2,
   "name": "A Great Event Name Changed",
   "description": "This is a great event...",
   "place": "Event Place, 123 - City/UF - Country",
   "date": "2020-12-01",
   "category": "UNIVERSITY",
   "image": "image url",
   "price": 321
 },
 {...}
]