An application to control your movie wish list.
- Clone this repository
- Install all dependencies
npm i
- Create a PostgreSQL database with whatever name you want
- Configure the
.env
file using the.env.example
file - Run all migrations
npm run migration:run
- Seed db
npm run prisma:seed
- Run the back-end
npm run dev
OBS: Import the collection through the "thunder-collection cars.json" file to test the routes in the Thunder Client
-
Follow the steps in the last section
-
Configure the
.env.test
file using the.env.example
file OBS: name the test database different from the development database -
Run all migrations
npm run test:migration:run
- Run test: (locally)
npm run test
- Run coverage report
npm run test:coverage
-
GET ("/movie-genres") Get all the movie genres. Response format:
[ { "id": 1, "name": "Drama", "created_at": "2023-01-23T16:34:23.703Z" } ]
-
GET ("/streaming-services") Get all the streaming services. Response format:
[ { "id": 1, "name": "Netflix", "created_at": "2023-01-23T16:32:16.959Z" } ]
-
GET("/movies") Get all the movies. Response format:
[ { "id": 1, "name": "Mad Max: Estrada da Fúria", "streaming_services": { "name": "HBO Max" }, "movie_genres": { "name": "Ação" }, "watched": true, "date_watched": "23/01/2023", "rating": 5, "created_at": "2023-01-23T16:36:22.684Z" } ]
-
POST("/movies") Post a new movie. Body format:
{ "name": "Mad Max: Estrada da Fúria", "streaming_service_id": 2, "genre_id": 6 }
-
PATCH("/movies/:id") Updates watched status and movie rating by movie id. Body format:
{ "rating": 5 }
-
DELETE("/movies/:id") Delete movie by movie id.
-
GET("/movies/genre/:id") Get all movies by genre. Response format:
[ { "id": 1, "name": "Mad Max: Estrada da Fúria", "streaming_services": { "name": "HBO Max" }, "movie_genres": { "name": "Ação" }, "watched": true, "date_watched": "23/01/2023", "rating": 5, "created_at": "2023-01-23T16:36:22.684Z" } ]