Skip to content

This is the final project of the Back-End with JS module of Kenzie Academy Brasil. This is an API for a cinema platform. This project was developed by a group of 6 people. The documentation for this API is in README.

Notifications You must be signed in to change notification settings

TAraujoS/API-Cinema

Repository files navigation

API Documentation

Content Table



1. Overview

CineExpress is an API for cinema, created as a final project of Module 4 at Kenzie Academy Brasil.

These were the main technologies used in this project:

Base URL: https://cine-express-projeto-m4.herokuapp.com

Team


2. Entity Relationship Diagram

Back to the top

Diagram


3. Endpoints

Back to the top

Index


4. Authentication

Back to the top

Some routes need authentication. The authentication used is the Bearer Token type.

The token is generated automatically at user login.

Thus, to access routes with authentication, it is necessary to have a user and be logged in with the user.

In addition, some routes require the user to be an administrator, or owner of the account, or employee

Please read each route's documentation to understand which authentications are required.



1. USERS

Back to Endpoints


The User object is defined as:

Field Type Description
id string User's unique identifier
name string User name *
email string User email *
isAdm boolean Defines whether a user is an administrator or not
isActive boolean Defines whether a user is active or not
createdAt string Date when the user was created
updatedAt string Date when the user was updated
password string User password *
isEmployee boollean Define wheater a user is an employee or not


Endpoints


Method Routes Description
POST /users Create user
POST /login Login user
GET /users List all users
GET /users/:id Lists a user using its ID as a parameter
PATCH /user/:id Update user
DELETE /delete/:id Soft delete user


1.1 User Creation

Back to Endpoints


POST /users


Request:


Request body:

{
  "name": "Thiago",
  "email": "thiago@mail.com",
  "isAdm": true,
  "contact": "xx 9xxxx xxxx",
  "birthDate": "2000/01/01",
  "isEmployee": false,
  "password": "1234"
}

Expected Response:


Status 201 - CREATED

{

  {
    "id": "f1719800-2e5a-4270-88de-64380f73dd3d",
    "name": "Thiago",
    "bithDate": "2000/01/01",
    "isAdm": true,
    "isEmployee": false,
    "contact" : "99988866677",
    "email": "thiago@mail.com",
    "isActive": true,
    "createdAt": "2022-10-29T00:41:28.717Z",
    "updatedAt": "2022-10-29T00:41:28.717Z"
  }
}

Error Responses:


Status 400 - BAD REQUEST - Missing required field

{
  "message": "(any object key) is a required field"
}

Status 409 - CONFLICTS - Email already exists

{
  "message": "This email already exists"
}

1.2 Login

Back to Endpoints


SIGN /login


Request


Request body:

{
  "email": "thiago@mail.com",
  "password": "1234"
}

Expected Response:


Status 200 - OK

{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc0FkbSI6dHJ1ZSwiaXNFbXBsb3llZSI6dHJ1ZSwiaWF0IjoxNjY3OTY0MDY2LCJleHAiOjE2NjgwNTA0NjYsInN1YiI6ImE4M2MxMjVjLWNjZjctNDA4NC04NTg1LWFhZDYyMWZiMjY5MSJ9.LHflvucPDWutAUSUa-O9NY516Y1s5bNVnVtdKPsu89k"
}

Error Response:


Status 403 - FORBIDDEN - "Invalid user or password"

{
  "message": "Invalid user or password"
}

1.3 List Users

Back to Endpoints


GET /users


Request:


Request headers:

{
  "authorization": "Bearer Token"
}

Expected Response:


Status 200 - OK

{

   [
    {
      "id": "f1719800-2e5a-4270-88de-64380f73dd3d",
      "name": "Thiago",
      "bithDate": "2000/01/01",
      "isAdm": true,
      "isEmployee": false,
      "contact" : "99988866677",
      "email": "thiago@mail.com",
      "isActive": true,
      "createdAt": "2022-10-29T00:41:28.717Z",
      "updatedAt": "2022-10-29T00:41:28.717Z"
    }
    ...
  ]
}

Error Responses:


Status 401 - UNAUTHORIZED - "Missing authorization token"

{
  "message": "Missing authorization token"
}

Status 403 - UNAUTHORIZED - "User is not an admin"

{
  "message": "User is not an admin"
}

1.4 List User by Id

Back to Endpoints


GET /users/:id


Request:


Request headers:

{
  "authorization": "Bearer Token"
}

Expected Response:


Status 200 - OK

{

   [
    {
      "id": "f1719800-2e5a-4270-88de-64380f73dd3d",
      "name": "Thiago",
      "email": "thiago@mail.com",
      "isAdm": true,
      "isActive": true,
      "createdAt": "",
      "updatedAt": ""
    }
    ...
  ]
}

Error Responses:


Status 401 - UNAUTHORIZED - "Missing authorization token"

{
  "message": "Missing authorization token"
}

Status 403 - FORBIDDEN - "User is not an admin and employee"

{
  "message": "User is not an admin"
}
or
{
  "message": "User is not employee
}

1.5 Update User by Id

Back to Endpoints


PATCH /users/:id


Request:


Request headers:

{
  "authorization": "Bearer Token"
}

Expected Response:


Status 200 - OK

{

  {
    "name": "Thiago",
    "birthDate": "2000/01/01",
    "contact" : "99988866677",
    "email": "thiago@mail.com",
  }
}

Error Responses:


Status 401 - UNAUTHORIZED - "Missing authorization token"

{
  "message": "Missing authorization token"
}

Status 403 - FORBIDDEN - "User is not an admin and employee"

{
  "message": "User is not an admin"
}
or
{
  "message": "User is not employee
}

1.6 Delete User by Id

Back to Endpoints


DELETE /users/:id


Request:


Request headers:

{
  "authorization": "Bearer Token"
}

Expected Response:


Status 204 - No Content

No body returned for response

Error Responses:


Status 401 - UNAUTHORIZED - "Missing authorization token"

{
  "message": "Missing authorization token"
}

Status 403 - FORBIDDEN - "User is not an admin and employee"

{
  "message": "User is not an admin"
}
or
{
  "message": "User is not employee"
}

Status 400 - Bad Request - "User already deleted"

{
  "message": "User already deleted"
}

Status 404 - Not Found - "User not found id invalid"

{
  "message": "User not found"
}

2. Payments

Back to Endpoints


The Payments object is defined as:

Field Type Description
id string Payment unique identifier
name string User name
number string Card number
dueDate string Expiration date of this credit card
code string Security code of credit card
userId string Define wich user is reference to this payment

Endpoints


Method Routes Description
POST /paymentInfo To create a new payment data
PATCH /paymentInfo/:id To update the data payment using id user as a parameter
GET /paymentInfo To list all payment data this user logged
GET /paymentInfo/:id To list data payment using the id user as a parameter
DELETE /paymentInfo/:id To delete a data payment using id user as a parameter


2.1 Data Payment Creation

Back to Endpoints


POST /paymentInfo


Request:


Request body:

{
  "name": "Joana",
  "number": "1326598745632156",
  "dueDate": "2023-06",
  "code": "963",
  "userId": "e64c6322-2a32-41be-8be9-37da17161ee2"
}

Expected Response:


Status 201 - CREATED

{
  "id": "d0980b56-56d8-47bb-b15a-7a5bd4f26074",
  "name": "Joana",
  "number": "1326598745632156",
  "dueDate": "2023-06"
}

Error Responses:


Status 401 - UNAUTHORIZED - "Missing authorization token"

{
  "message": "Missing authorization token"
}

Status 400 - BAD REQUEST - "Invalid card number"

{
  "message": "Invalid card number"
}

Status 400 - BAD REQUEST - "Date is required"

{
  "message": "Date is required"
}

Status 400 - NOT FOUND - "Invalid code number"

{
  "message": "Invalid code number"
}

2.2 Update Payment Data

Back to Endpoints


PATCH /paymentInfo/:id


Request:


Request headers:

{
  "authorization": "Bearer Token"
}

Request body:

{
  "name": "Joana Maria",
  "number": "1326598745632165",
  "dueDate": "2023-06",
  "code": "369",
  "userId": "e64c6322-2a32-41be-8be9-37da17161ee2"
}

Expected Response:


Status 200 - OK

{
  "id": "d0980b56-56d8-47bb-b15a-7a5bd4f26074",
  "name": "Joana Maria",
  "number": "1326598745632165",
  "dueDate": "2023-06",
  "code": "369"
}

Error Responses:


Status 401 - UNAUTHORIZED - "Missing authorization token"

{
  "message": "Missing authorization token"
}

Status 404 - NOT FOUND - "User not found"

{
  "message": "User not found"
}

2.3 List General Payment Data

Back to Endpoints


GET /paymentInfo


Request:


Request headers:

{
  "authorization": "Bearer Token"
}

Expected Response:


Status 200 - OK

{
  "id": "d0980b56-56d8-47bb-b15a-7a5bd4f26074",
  "name": "Joana",
  "number": "1326598745632156",
  "dueDate": "2023-06"
}

Error Responses:


Status 401 - UNAUTHORIZED - "Missing authorization token"

{
  "message": "Missing authorization token"
}

2.4 List Payment Data by Id

Back to Endpoints


GET /paymentInfo/:id


Request:


Request headers:

{
  "authorization": "Bearer Token"
}

Expected Response:


Status 200 - OK

{
  "id": "d0980b56-56d8-47bb-b15a-7a5bd4f26074",
  "name": "Joana",
  "number": "1326598745632156",
  "dueDate": "2023-06"
}

Error Responses:


Status 401 - UNAUTHORIZED - "Missing authorization token"

{
  "message": "Missing authorization token"
}

2.5 Delete Payment Data

Back to Endpoints


DELETE /paymentInfo/:id


Request:


Request headers:

{
  "authorization": "Bearer Token"
}

Expected Response:


Status 204 - No Content

No body returned for response

Error Responses:


Status 401 - UNAUTHORIZED - "Missing authorization token"

{
  "message": "Missing authorization token"
}

3. CINEMA

Back to Endpoints


The Cinema object is defined as:

Field Type Description
id string Unique Cinema Id
name string Session Hour

Endpoints


Method Routes Description
POST /cinema Create user
PATCH /cinema/:id Update session


3.1 Cinema Creation

Back to Endpoints


POST /cinema


Request:


Request body:

{
  "name": "Cine Express"
}

Expected Response:


Status 201 - CREATED

{
  "name": "Cine Express",
  "id": 1
}

Error Responses:


Status 401 - UNAUTHORIZED - "Missing authorization token"

{
  "message": "Missing authorization token"
}

Status 400 - BAD REQUEST - Missing required field

{
  "message": "Missing required field"
}

3.2 List Cinema

Back to Endpoints


GET - /cinema


Request:


Request headers:

{
  "authorization": "Bearer Token"
}

Expected Response:


Status 200 - OK

{
  "cinemas": [
    {
      "id": 1,
      "name": "Cine Express"
    },
    {
      "id": 2,
      "name": "Cine Jason Button"
    },
    {
      "id": 3,
      "name": "Cine Jason Button"
    },
    {
      "id": 4,
      "name": "Cine Prive"
    }
  ]
}

Error Responses:


Status 401 - UNAUTHORIZED - "Missing authorization token"

{
  "message": "Missing authorization token"
}

3.3 Update Cinema

Back to Endpoints


PATCH /cinema/:id


Request:

Request body:

{
  "name": "Cine-Express"
}

Request headers:

{
  "authorization": "Bearer Token"
}

Expected Response:


Status 201 - OK

{
  "id": 2,
  "name": "Cine-Express"
}

Error Responses:


Status 401 - UNAUTHORIZED - "Missing authorization token"

{
  "message": "Missing authorization token"
}

Status 400 - BAD REQUEST - Missing required field

{
  "message": "Missing required field"
}

Status 404 - NOT FOUND - "Cinema not found"

{
  "message": "Cinema not found"
}

4. MOVIES

Back to Endpoints


The Movie object is defined as:

Field Type Description
id string Movie unique identifier
name string Movie name
gender string Movie gender
avaliation string Defines movie avaliation
duration string Defines the duration of the movie
onDisplay boolean Define if movie is on display
cinema string Define cinema id where movie is being displayed

Endpoints


Method Routes Description
POST /movies To create a new
GET /movies To list all movies
GET /movies/:movie_id To list a movie using its ID as a parameter
PATCH /movies/:movie_id To update a movie using its ID as a parameter
DELETE /movies/:movie_id To delete a movie using its ID as a parameter


4.1 Movie Creation

Back to Endpoints


POST /movies


Request:


Request body:

{
  "name": "Jason 5",
  "gender": "Horror",
  "avaliation": "4.3",
  "duration": "2:00",
  "onDisplay": true,
  "cinema": "1"
}

Expected Response:


Status 201 - CREATED

{
  "name": "Jason 5",
  "gender": "Horror",
  "avaliation": "4.3",
  "duration": "2:00",
  "onDisplay": true,
  "cinema": {
    "id": 1,
    "name": "Cine Gusta"
  },
  "id": 4
}

Error Responses:


Status 401 - UNAUTHORIZED - "Missing authorization token"

{
  "message": "Missing authorization token"
}

Status 400 - BAD REQUEST - Movie already exists

{
  "message": "Movie already exists"
}

4.2 List Movies

Back to Endpoints


GET /movies


Request:


Request headers:

{
  "authorization": "Bearer Token"
}

Expected Response:


Status 200 - OK

[
	{
		"id": 1,
		"name": "Jason 3",
		"gender": "Horror",
		"avaliation": "4.3",
		"duration": "2:00",
		"onDisplay": true,
		"cinema": {
			"id": 1,
			"name": "Cine Gusta"
		}
	}
  ...
]

Error Responses:


Status 401 - UNAUTHORIZED - "Missing authorization token"

{
  "message": "Missing authorization token"
}

4.3 List Movie by Id

Back to Endpoints


GET /movies/movieId


Request:


Request headers:

{
  "authorization": "Bearer Token"
}

Expected Response:


Status 200 - OK

{
  "id": 1,
  "name": "Jason 3",
  "gender": "Horror",
  "avaliation": "4.3",
  "duration": "2:00",
  "onDisplay": true,
  "cinema": {
    "id": 1,
    "name": "Cine Gusta"
  }
}

Error Responses:


Status 401 - UNAUTHORIZED - "Missing authorization token"

{
  "message": "Missing authorization token"
}

4.4 Update Movie

Back to Endpoints


PATCH /movies/movieId


Request:


Request headers:

{
  "authorization": "Bearer Token"
}

Request body:

{
  "name": "Jason 39",
  "gender": "Horror",
  "avaliation": "4.3",
  "duration": "2:00",
  "onDisplay": true,
  "cinema": "1"
}

Expected Response:


Status 200 - OK

{
  "message": {
    "id": 4,
    "name": "Jason 39",
    "gender": "Horror",
    "avaliation": "4.3",
    "duration": "2:00",
    "onDisplay": true,
    "cinema": {
      "id": 1,
      "name": "Cine Gusta"
    }
  }
}

Error Responses:


Status 401 - UNAUTHORIZED - "Missing authorization token"

{
  "message": "Missing authorization token"
}

Status 403 - FORBIDDEN - "User is not an admin"

{
  "message": "User is not an adm"
}

4.5 Delete Movie

Back to Endpoints


DELETE /movies/movieId


Request:


Request headers:

{
  "authorization": "Bearer Token"
}

Expected Response:


Status 204 - No Content

No body returned for response

Error Responses:


Status 401 - UNAUTHORIZED - "Missing authorization token"

{
  "message": "Missing authorization token"
}

Status 403 - FORBIDDEN - "User is not an admin"

{
  "message": "User is not an admin"
}

5. ROOMS

Back to Endpoints


The Room object is defined as:

Field Type Description
id string Room unique identifier.
capacity number seating capacity in a room.
CinemaId string Identification of the cinema that the room
belongs to.

Endpoints


Method Routes Description
POST /rooms Create room.
GET /rooms List all rooms.
GET /rooms/:id List a room using its ID as a parameter.
PATCH /rooms/:id Update a room using its ID as a parameter.


5.1 Room Creation

Back to Endpoints


POST /rooms


Request:


Request body:

{
  "capacity": 100,
  "cinema": "1"
}

Expected Response:


Status 201 - CREATED

{
  "capacity": 100,
  "cinema": {
    "id": 1,
    "name": "CineGusta"
  },
  "id": 1
}

Error Responses:


Status 401 - UNAUTHORIZED - "Missing authorization token"

{
  "message": "Invalid token"
}

Status 400 - BAD REQUEST - Minimum of seats

{
  "message": "Minimum of 30 chairs"
}

Status 400 - BAD REQUEST - Maximum of seats

{
  "message": "Maximum of 100 chairs"
}

Status 400 - BAD REQUEST - Maximum number of rooms created

{
  "message": "Only 10 rooms can be created"
}

5.2 List Rooms

Back to Endpoints


GET /rooms


Request:


Request headers:

{
  "authorization": "Bearer Token"
}

Expected Response:


Status 200 - OK

[
   {
	"id": 1,
	"capacity": 100,
	"sessions": []
   }
...
]

Error Responses:


Status 401 - UNAUTHORIZED - "Missing authorization token"

{
  "message": "invalid token"
}

5.3 List Room by Id

Back to Endpoints


GET /rooms/:id


Request:


Request headers:

{
  "authorization": "Bearer Token"
}

Expected Response:


Status 200 - OK

{
  "id": 1,
  "capacity:": 100,
  "sessions": []
}

Error Responses:


Status 401 - UNAUTHORIZED - "Missing authorization token"

{
  "message": "invalid token"
}

Status 404 - NOT FOUND - Invalid Id or room not exists

{
  "message": "Invalid Id or room not exists"
}

5.4 Update Room

Back to Endpoints


PATCH /rooms/:id


Request:


Request headers:

{
  "authorization": "Bearer Token"
}

Request body:

{
  "capacity": 50
}

Expected Response:


Status 200 - OK

{
  "Updated room"
}

Error Responses:


Status 401 - UNAUTHORIZED - "Missing authorization token"

{
  "message": "invalid token"
}

Status 403 - FORBIDDEN - "User is not employee"

{
  "message": "User is not employee"
}

Status 403 - FORBIDDEN - "User is not Admin"

{
  "message": "User is not Admin"
}

Status 404 - NOT FOUND - Room was not found

{
  "message": "Room was not found"
}

Status 400 - BAD REQUEST - Minimum limit

{
  "message": "Room cannot have a capacity less than 30"
}

Status 400 - BAD REQUEST - Maximum limit

{
  "message": "Room cannot have a capacity above than 100"
}

6. SESSIONS

Back to Endpoints


The Session object is defined as:

Field Type Description
id string Unique Session Id
day string Session date
hour string Session Hour
roomId string Id of a room already created
movieId string Id of a movie already created

Endpoints


Method Routes Description
POST /sessions Create user
GET /sessions List all users
GET /sessions/:movieId Lists a user using its ID as a parameter
PATCH /sessions/:sessionId Update session
DELETE /sessions/:sessionId Delete session


6.1 Session Creation

Back to Endpoints


POST /sessions


Request:


Request body:

{
  "day": "2022/11/12",
  "hour": "13:00",
  "room_id": "1",
  "movie_id": "1"
}

Expected Response:


Status 201 - CREATED

{
  "session": {
    "day": "2022-11-15",
    "hour": "19:00:00",
    "room": {
      "id": 1,
      "capacity": 100
    },
    "movie": {
      "id": 1,
      "name": "A FamĂ­lia Adams",
      "gender": "Comédia",
      "avaliation": "4.9",
      "duration": "1:55",
      "onDisplay": true,
      "cinema": {
        "id": 1,
        "name": "Cine Express"
      }
    },
    "id": 4
  }
}

Error Responses:


Status 401 - UNAUTHORIZED - "Missing authorization token"

{
  "message": "Missing authorization token"
}

Status 400 - BAD REQUEST - Missing required field

{
  "message": "Missing required field"
}

Status 400 - BAD REQUEST - This room dont exist

{
  "message": "This room dont exist"
}

Status 400 - BAD REQUEST - This movie dont exist

{
  "message": "This movie dont exist"
}

6.2 List Sessions

Back to Endpoints


GET /sessions


Request:


Request headers:

{
  "authorization": "Bearer Token"
}

Expected Response:


Status 200 - OK

{
  "sessions": [
    {
      "id": 1,
      "day": "2022-11-16",
      "hour": "19:00:00",
      "room": {
        "id": 7,
        "capacity": 50
      },
      "movie": {
        "id": 2,
        "name": "A Família Buscapé",
        "gender": "Comédia",
        "avaliation": "5.0",
        "duration": "1:58",
        "onDisplay": true,
        "cinema": null
      }
    },
    {
      "id": 2,
      "day": "2022-11-15",
      "hour": "15:00:00",
      "room": {
        "id": 7,
        "capacity": 50
      },
      "movie": {
        "id": 1,
        "name": "A FamĂ­lia Adams",
        "gender": "Comédia",
        "avaliation": "4.9",
        "duration": "1:55",
        "onDisplay": true,
        "cinema": null
      }
    }
  ]
}

Error Responses:


Status 401 - UNAUTHORIZED - "Missing authorization token"

{
  "message": "Missing authorization token"
}

6.3 List Sessions per Movie

Back to Endpoints


GET /sessions/movie/:movieId


Request:


Request headers:

{
  "authorization": "Bearer Token"
}

Expected Response:


Status 200 - OK

{
  "movie": {
    "id": 2,
    "name": "A Família Buscapé",
    "gender": "Comédia",
    "avaliation": "5.0",
    "duration": "1:58",
    "onDisplay": true,
    "sessions": [
      {
        "id": 1,
        "day": "2022-11-16",
        "hour": "19:00:00",
        "room": {
          "id": 7,
          "capacity": 50
        }
      },
      {
        "id": 3,
        "day": "2022-11-17",
        "hour": "21:00:00",
        "room": {
          "id": 7,
          "capacity": 50
        }
      }
    ],
    "cinema": {
      "id": 1,
      "name": "Cine Express"
    }
  }
}

Error Responses:


Status 401 - UNAUTHORIZED - "Missing authorization token"

{
  "message": "Missing authorization token"
}

Status 404 - NOT FOUND - "Movie not found"

{
  "message": "This movie dont exist"
}

6.4 Update Sessions

Back to Endpoints


PATCH /sessions/:id


Request:


Request body:

{
  "day"?: "2022/11/17",
  "hour"?: "21:00",
  "roomId"?: "7",
  "movieId"?: "2"
}

Request headers:

{
  "authorization": "Bearer Token"
}

Expected Response:


Status 201 - OK

{
  "id": 1,
  "day": "2022-11-15",
  "hour": "15:00:00",
  "room": {
    "id": 1,
    "capacity": 100
  },
  "movie": {
    "id": 1,
    "name": "Jason 2",
    "gender": "Horror",
    "avaliation": "4.3",
    "duration": "2:00",
    "onDisplay": true,
    "cinema": {
      "id": 1,
      "name": "Cine Express"
    }
  }
}

Error Responses:


Status 401 - UNAUTHORIZED - "Missing authorization token"

{
  "message": "Missing authorization token"
}

Status 404 - NOT FOUND - "Session not found"

{
  "message": "This session dont exist"
}

6.5 Delete Sessions

Back to Endpoints


DELETE /sessions/:id


Request:


Request headers:

{
  "authorization": "Bearer Token"
}

Expected Response:


Status 204 - NO CONTENT

No body returned for response

Error Responses:


Status 401 - UNAUTHORIZED - "Missing authorization token"

{
  "message": "Missing authorization token"
}

Status 404 - NOT FOUND - "Session not found"

{
  "message": "Session not found"
}

Status 403 - FORBIDDEN - "User is not Admin"

{
  "message": "User is not Admin"
}

7. TICKETS

Back to Endpoints


The Ticket object is defined as:

Field Type Description
id string Unique ticket Id
chair string Ticket chair
sessionId number Sessions's unique identifier
userId string User's unique identifier

Endpoints


Method Routes Description
POST /tickets Create user
GET /tickets List all tickets
GET /tickets/:id List ticket by id


7.1 Ticket Creation

Back to Endpoints


POST /tickets


Request:


Request body:

{
  "chair": "5",
  "session": 2,
  "user": "1597a7b4-24e5-4856-a52c-70576459de11"
}

Expected Response:


Status 201 - CREATED

{
  "id": "d1eaa744-85d5-4eef-8f38-53a92320e786",
  "chair": "5",
  "session": {
    "id": 2,
    "day": "2022-11-10",
    "hour": "15:00:00",
    "room": {
      "id": 14,
      "capacity": 70
    }
  },
  "price": 15
}

Error Responses:


Status 401 - UNAUTHORIZED - "Missing authorization token"

{
  "message": "Missing authorization token"
}

Status 400 - BAD REQUEST - Missing required field

{
  "message": "Missing required field"
}

Status 400 - BAD REQUEST - Chair already in use

{
  "message": "Chair already in use"
}

7.2 List all Tickets

Back to Endpoints


GET /tickets


Request:


Request headers:

{
  "authorization": "Bearer Token"
}

Expected Response:


Status 200 - OK

[
	{
		"id": "dc750695-f69a-4f79-9a9b-14a705c7a5c1",
		"price": 15,
		"chair": 11,
		"session": {
			"id": 2,
			"day": "2022-11-10",
			"hour": "15:00:00",
			"room": {
				"id": 14,
				"capacity": 70
			}
		}
	},
    ...
]

Error Responses:


Status 401 - UNAUTHORIZED - "Missing authorization token"

{
  "message": "Missing authorization token"
}

Status 401 - UNAUTHORIZED - User is not Employee

{
  "message": "User is not employee"
}

7.3 List Ticket by ID

Back to Endpoints


GET /tickets/:id


Request:


Request headers:

{
  "authorization": "Bearer Token"
}

Expected Response:


Status 200 - OK

{
	"id": "dc750695-f69a-4f79-9a9b-14a705c7a5c1",
	"price": 15,
	"chair": 11,
	"session": {
		"id": 2,
		"day": "2022-11-10",
		"hour": "15:00:00",
		"room": {
			"id": 14,
			"capacity": 70
		}
	}
},

Error Responses:


Status 401 - UNAUTHORIZED - "Missing authorization token"

{
  "message": "Missing authorization token"
}

Status 404 - NOT FOUND - "Ticket not found"

{
  "message": "Ticket not found"
}

About

This is the final project of the Back-End with JS module of Kenzie Academy Brasil. This is an API for a cinema platform. This project was developed by a group of 6 people. The documentation for this API is in README.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages