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
- Thiago A. Scherer - SM
- Larissa Sato - TL
- Amon Fanticelli - PO
- Ricardo Martins - Dev
- Leandro Junges - Dev
- JoĂŁo Victor - Dev
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.
The User object is defined as:
Field | Type | Description |
---|---|---|
id | string | User's unique identifier |
name | string | User name * |
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 |
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 |
- POST /users
- Host: https://cine-express-projeto-m4.herokuapp.com
- Authorization: None
- Content-type: application/json
{
"name": "Thiago",
"email": "thiago@mail.com",
"isAdm": true,
"contact": "xx 9xxxx xxxx",
"birthDate": "2000/01/01",
"isEmployee": false,
"password": "1234"
}
{
{
"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"
}
}
{
"message": "(any object key) is a required field"
}
{
"message": "This email already exists"
}
- SIGN /login
- Host: https://cine-express-projeto-m4.herokuapp.com
- Authorization: None
- Content-type: application/json
- User must be created
{
"email": "thiago@mail.com",
"password": "1234"
}
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc0FkbSI6dHJ1ZSwiaXNFbXBsb3llZSI6dHJ1ZSwiaWF0IjoxNjY3OTY0MDY2LCJleHAiOjE2NjgwNTA0NjYsInN1YiI6ImE4M2MxMjVjLWNjZjctNDA4NC04NTg1LWFhZDYyMWZiMjY5MSJ9.LHflvucPDWutAUSUa-O9NY516Y1s5bNVnVtdKPsu89k"
}
{
"message": "Invalid user or password"
}
- GET /users
- Host: https://cine-express-projeto-m4.herokuapp.com
- Authorization: Bearer Token
- Content-type: application/json
- Empty body
- User must be an Adm
{
"authorization": "Bearer Token"
}
{
[
{
"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"
}
...
]
}
{
"message": "Missing authorization token"
}
{
"message": "User is not an admin"
}
- GET /users/:id
- Host: https://cine-express-projeto-m4.herokuapp.com
- Authorization: Bearer Token
- Content-type: application/json
- Empty body
- User must be an Adm or employee
{
"authorization": "Bearer Token"
}
{
[
{
"id": "f1719800-2e5a-4270-88de-64380f73dd3d",
"name": "Thiago",
"email": "thiago@mail.com",
"isAdm": true,
"isActive": true,
"createdAt": "",
"updatedAt": ""
}
...
]
}
{
"message": "Missing authorization token"
}
{
"message": "User is not an admin"
}
or
{
"message": "User is not employee
}
- PATCH /users/:id
- Host: https://cine-express-projeto-m4.herokuapp.com
- Authorization: Bearer Token
- Content-type: application/json
- User must be an Adm and employee
{
"authorization": "Bearer Token"
}
{
{
"name": "Thiago",
"birthDate": "2000/01/01",
"contact" : "99988866677",
"email": "thiago@mail.com",
}
}
{
"message": "Missing authorization token"
}
{
"message": "User is not an admin"
}
or
{
"message": "User is not employee
}
- DELETE /users/:id
- Host: https://cine-express-projeto-m4.herokuapp.com
- Authorization: Bearer Token
- Content-type: application/json
- User must be an Adm and employee
{
"authorization": "Bearer Token"
}
No body returned for response
{
"message": "Missing authorization token"
}
{
"message": "User is not an admin"
}
or
{
"message": "User is not employee"
}
{
"message": "User already deleted"
}
{
"message": "User not found"
}
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 |
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 |
- POST /paymentInfo
- Host: https://cine-express-projeto-m4.herokuapp.com/paymentInfo
- Authorization: Bearer Token
- Content-type: application/json
{
"name": "Joana",
"number": "1326598745632156",
"dueDate": "2023-06",
"code": "963",
"userId": "e64c6322-2a32-41be-8be9-37da17161ee2"
}
{
"id": "d0980b56-56d8-47bb-b15a-7a5bd4f26074",
"name": "Joana",
"number": "1326598745632156",
"dueDate": "2023-06"
}
{
"message": "Missing authorization token"
}
{
"message": "Invalid card number"
}
{
"message": "Date is required"
}
{
"message": "Invalid code number"
}
- PATCH /paymentInfo/:id
- Host: https://cine-express-projeto-m4.herokuapp.com/paymentInfo/id
- Authorization: Bearer Token
- Content-type: application/json
- User must be logged at your account
{
"authorization": "Bearer Token"
}
{
"name": "Joana Maria",
"number": "1326598745632165",
"dueDate": "2023-06",
"code": "369",
"userId": "e64c6322-2a32-41be-8be9-37da17161ee2"
}
{
"id": "d0980b56-56d8-47bb-b15a-7a5bd4f26074",
"name": "Joana Maria",
"number": "1326598745632165",
"dueDate": "2023-06",
"code": "369"
}
{
"message": "Missing authorization token"
}
{
"message": "User not found"
}
- GET /paymentInfo
- Host: https://cine-express-projeto-m4.herokuapp.com/paymentInfo
- Authorization: Bearer Token
- Content-type: application/json
- Empty Body
- User must be logged
{
"authorization": "Bearer Token"
}
{
"id": "d0980b56-56d8-47bb-b15a-7a5bd4f26074",
"name": "Joana",
"number": "1326598745632156",
"dueDate": "2023-06"
}
{
"message": "Missing authorization token"
}
- GET /paymentInfo/:id
- Host: https://cine-express-projeto-m4.herokuapp.com/paymentInfo/id
- Authorization: Bearer Token
- Content-type: application/json
- Empty body
- User must be logged
{
"authorization": "Bearer Token"
}
{
"id": "d0980b56-56d8-47bb-b15a-7a5bd4f26074",
"name": "Joana",
"number": "1326598745632156",
"dueDate": "2023-06"
}
{
"message": "Missing authorization token"
}
- DELETE /paymentInfo/id
- Host: https://cine-express-projeto-m4.herokuapp.com/paymeentInfo/id
- Authorization: Bearer Token
- Content-type: application/json
- Empty body
- User must be logged
{
"authorization": "Bearer Token"
}
No body returned for response
{
"message": "Missing authorization token"
}
The Cinema object is defined as:
Field | Type | Description |
---|---|---|
id | string | Unique Cinema Id |
name | string | Session Hour |
Method | Routes | Description |
---|---|---|
POST | /cinema | Create user |
PATCH | /cinema/:id | Update session |
- POST /cinema
- Host: https://cine-express-projeto-m4.herokuapp.com
- Authorization: Bearer Token
- Content-type: application/json
{
"name": "Cine Express"
}
{
"name": "Cine Express",
"id": 1
}
{
"message": "Missing authorization token"
}
{
"message": "Missing required field"
}
- GET /cinema
- Host: https://cine-express-projeto-m4.herokuapp.com/movies/
- Authorization: Bearer Token
- Content-type: application/json
- Empty Body
{
"authorization": "Bearer Token"
}
{
"cinemas": [
{
"id": 1,
"name": "Cine Express"
},
{
"id": 2,
"name": "Cine Jason Button"
},
{
"id": 3,
"name": "Cine Jason Button"
},
{
"id": 4,
"name": "Cine Prive"
}
]
}
{
"message": "Missing authorization token"
}
- PATCH /cinema/:id
- Host: https://cine-express-projeto-m4.herokuapp.com
- Authorization: Bearer Token
- Content-type: application/json
- Body must contain any of the keys
- User must be an Employee
{
"name": "Cine-Express"
}
{
"authorization": "Bearer Token"
}
{
"id": 2,
"name": "Cine-Express"
}
{
"message": "Missing authorization token"
}
{
"message": "Missing required field"
}
{
"message": "Cinema not found"
}
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 |
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 |
- POST /movies
- Host: https://cine-express-projeto-m4.herokuapp.com/movies
- Authorization: Bearer Token
- Content-type: application/json
{
"name": "Jason 5",
"gender": "Horror",
"avaliation": "4.3",
"duration": "2:00",
"onDisplay": true,
"cinema": "1"
}
{
"name": "Jason 5",
"gender": "Horror",
"avaliation": "4.3",
"duration": "2:00",
"onDisplay": true,
"cinema": {
"id": 1,
"name": "Cine Gusta"
},
"id": 4
}
{
"message": "Missing authorization token"
}
{
"message": "Movie already exists"
}
- GET /movies
- Host: https://cine-express-projeto-m4.herokuapp.com/movies/
- Authorization: Bearer Token
- Content-type: application/json
- Empty Body
{
"authorization": "Bearer Token"
}
[
{
"id": 1,
"name": "Jason 3",
"gender": "Horror",
"avaliation": "4.3",
"duration": "2:00",
"onDisplay": true,
"cinema": {
"id": 1,
"name": "Cine Gusta"
}
}
...
]
{
"message": "Missing authorization token"
}
- GET /users
- Host: https://cine-express-projeto-m4.herokuapp.com/movies/movieId
- Authorization: Bearer Token
- Content-type: application/json
- Empty Body
- User must be an Adm
{
"authorization": "Bearer Token"
}
{
"id": 1,
"name": "Jason 3",
"gender": "Horror",
"avaliation": "4.3",
"duration": "2:00",
"onDisplay": true,
"cinema": {
"id": 1,
"name": "Cine Gusta"
}
}
{
"message": "Missing authorization token"
}
- PATCH /movies/movieId
- Host: https://cine-express-projeto-m4.herokuapp.com/movies/movieId
- Authorization: Bearer Token
- Content-type: application/json
- User must be an Employee
{
"authorization": "Bearer Token"
}
{
"name": "Jason 39",
"gender": "Horror",
"avaliation": "4.3",
"duration": "2:00",
"onDisplay": true,
"cinema": "1"
}
{
"message": {
"id": 4,
"name": "Jason 39",
"gender": "Horror",
"avaliation": "4.3",
"duration": "2:00",
"onDisplay": true,
"cinema": {
"id": 1,
"name": "Cine Gusta"
}
}
}
{
"message": "Missing authorization token"
}
{
"message": "User is not an adm"
}
- DELETE /movies/movieId
- Host: https://cine-express-projeto-m4.herokuapp.com/movies/movieId
- Authorization: Bearer Token
- Content-type: application/json
- Empty body
- User must be an Adm
{
"authorization": "Bearer Token"
}
No body returned for response
{
"message": "Missing authorization token"
}
{
"message": "User is not an admin"
}
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. |
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. |
- POST /rooms
- Host: https://cine-express-projeto-m4.herokuapp.com
- Authorization: Bearer Token
- Content-type: application/json
{
"capacity": 100,
"cinema": "1"
}
{
"capacity": 100,
"cinema": {
"id": 1,
"name": "CineGusta"
},
"id": 1
}
{
"message": "Invalid token"
}
{
"message": "Minimum of 30 chairs"
}
{
"message": "Maximum of 100 chairs"
}
{
"message": "Only 10 rooms can be created"
}
- GET /rooms
- Host: https://cine-express-projeto-m4.herokuapp.com
- Authorization: Bearer Token
- Content-type: application/json
- Empty body
{
"authorization": "Bearer Token"
}
[
{
"id": 1,
"capacity": 100,
"sessions": []
}
...
]
{
"message": "invalid token"
}
- GET /rooms/:id
- Host: https://cine-express-projeto-m4.herokuapp.com
- Authorization: Bearer Token
- Content-type: application/json
- Empty body
- User must be an Adm
{
"authorization": "Bearer Token"
}
{
"id": 1,
"capacity:": 100,
"sessions": []
}
{
"message": "invalid token"
}
{
"message": "Invalid Id or room not exists"
}
- PATCH /rooms/:id
- Host: https://cine-express-projeto-m4.herokuapp.com
- Authorization: Bearer Token
- Content-type: application/json
- User must be an Employee and admin
{
"authorization": "Bearer Token"
}
{
"capacity": 50
}
{
"Updated room"
}
{
"message": "invalid token"
}
{
"message": "User is not employee"
}
{
"message": "User is not Admin"
}
{
"message": "Room was not found"
}
{
"message": "Room cannot have a capacity less than 30"
}
{
"message": "Room cannot have a capacity above than 100"
}
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 |
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 |
- POST /sessions
- Host: https://cine-express-projeto-m4.herokuapp.com
- Authorization: None
- Content-type: application/json
{
"day": "2022/11/12",
"hour": "13:00",
"room_id": "1",
"movie_id": "1"
}
{
"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
}
}
{
"message": "Missing authorization token"
}
{
"message": "Missing required field"
}
{
"message": "This room dont exist"
}
{
"message": "This movie dont exist"
}
- GET /sessions
- Host: https://cine-express-projeto-m4.herokuapp.com
- Authorization: Bearer Token
- Content-type: application/json
- Empty Body
{
"authorization": "Bearer Token"
}
{
"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
}
}
]
}
{
"message": "Missing authorization token"
}
- GET /sessions/movie/:movieId
- Host: https://cine-express-projeto-m4.herokuapp.com
- Authorization: Bearer Token
- Content-type: application/json
- Empty body
{
"authorization": "Bearer Token"
}
{
"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"
}
}
}
{
"message": "Missing authorization token"
}
{
"message": "This movie dont exist"
}
- PATCH /sessions/:id
- Host: https://cine-express-projeto-m4.herokuapp.com
- Authorization: Bearer Token
- Content-type: application/json
- Body must contain any of the keys
- User must be an Employee
{
"day"?: "2022/11/17",
"hour"?: "21:00",
"roomId"?: "7",
"movieId"?: "2"
}
{
"authorization": "Bearer Token"
}
{
"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"
}
}
}
{
"message": "Missing authorization token"
}
{
"message": "This session dont exist"
}
- DELETE /sessions/:id
- Host: https://cine-express-projeto-m4.herokuapp.com
- Authorization: Bearer Token
- Content-type: application/json
- Empty Body
- User must be an Admin
{
"authorization": "Bearer Token"
}
No body returned for response
{
"message": "Missing authorization token"
}
{
"message": "Session not found"
}
{
"message": "User is not Admin"
}
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 |
Method | Routes | Description |
---|---|---|
POST | /tickets | Create user |
GET | /tickets | List all tickets |
GET | /tickets/:id | List ticket by id |
- POST /tickets
- Host: https://cine-express-projeto-m4.herokuapp.com
- Authorization: Bearer Token
- Content-type: application/json
{
"chair": "5",
"session": 2,
"user": "1597a7b4-24e5-4856-a52c-70576459de11"
}
{
"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
}
{
"message": "Missing authorization token"
}
{
"message": "Missing required field"
}
{
"message": "Chair already in use"
}
- PATCH /tickets/
- Host: https://cine-express-projeto-m4.herokuapp.com
- Authorization: Bearer Token
- Content-type: application/json
- Empty Body
- User must be an Employee
{
"authorization": "Bearer Token"
}
[
{
"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
}
}
},
...
]
{
"message": "Missing authorization token"
}
{
"message": "User is not employee"
}
- PATCH /tickets/:id
- Host: https://cine-express-projeto-m4.herokuapp.com
- Authorization: Bearer Token
- Content-type: application/json
- Empty Body
{
"authorization": "Bearer Token"
}
{
"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
}
}
},
{
"message": "Missing authorization token"
}
{
"message": "Ticket not found"
}