Simple REST Api that maintains a Movie catalog.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
Clone this project with this bash command:
git clone https://github.com/DonNy88/nestjs-movie-catolg
For running this NestJS Application you need Node.js, Nest CLI, Yarn Docker and Docker Compose. If you do not have these things yet here below you can find where to get them.
- Docker for Windows Link
- Docker for OS X Link
- Docker compose Link
- Node.js Link
- Nest CLI Link
- Yarn Link
Please, see TODO file.
For run this Spring Boot Application use this command:
docker-compose up
yarn test
Fetch all movies present on the system
{
"status": "OK",
"message": "Success",
"body": [
{
"id": 1,
"title": "Mummy",
"overview": "The best movie",
"duration": 300,
"rating": 4,
"movieDirector": {
"id": 1,
"name": "Donald",
"middleName": "Emeka",
"surname": "Achugo"
}
},
{
"id": 2,
"title": "Mask",
"overview": "The second best movie",
"duration": 230,
"rating": 3,
"movieDirector": {
"id": 1,
"name": "Donald",
"middleName": "Emeka",
"surname": "Achugo"
}
}
]
}
or
{
"status": "OK",
"message": "Success",
"body": []
}
Fetch a movie by movieId
{
"status": "OK",
"message": "Success",
"body": {
"id": 2,
"title": "Mask",
"overview": "The second best movie",
"duration": 230,
"rating": 3,
"movieDirector": {
"id": 1,
"name": "Donald",
"middleName": "Emeka",
"surname": "Achugo"
}
}
}
{
"status": "NOT_FOUND",
"message": "No movie found",
"body": null
}
Add a Movie into the catolg
{
"title": "Mummy", // Title of the movie
"overview": "The best movie of the world", // Description of the movie
"duration": 300, // Duration in minutes of the movie
"rating": 3, // Rating of the movie from 1 to 5
"movieDirectorId": 1, // Movie director id. NB: the movie director has been saved before
}
{
"status": "CREATED",
"message": "Success",
"body": {
"id": 3,
"title": "Mummy",
"overview": "The second best movie",
"duration": 300,
"rating": 3,
"movieDirector": {
"id": 1,
"name": "Donald",
"middleName": "Emeka",
"surname": "Achugo"
}
}
}
{
"status": "NOT_FOUND",
"message": "No Movie Director found",
"body": null
}
Update a Movie
{
"title": "Mummy", // Title of the movie
"overview": "The best movie of the world", // Description of the movie
"duration": 300, // Duration in minutes of the movie
"rating": 3, // Rating of the movie from 1 to 5
"movieDirectorId": 1, // Movie director id. NB: the movie director has been saved before
}
{
"status": "OK",
"message": "Success",
"body": {
"id": 3,
"title": "Mummy",
"overview": "The second best movie",
"duration": 300,
"rating": 3,
"movieDirector": {
"id": 1,
"name": "Donald",
"middleName": "Emeka",
"surname": "Achugo"
}
}
}
{
"status": "BAD REQUEST",
"message": "No arguments provided",
"body": null
}
{
"status": "NOT_FOUND",
"message": "No movie found",
"body": null
}
{
"status": "NOT_FOUND",
"message": "No Movie Director found",
"body": null
}
Remove a Movie by movieId
{
"status": "NOT_FOUND",
"message": "No movie found",
"body": null
}
Fetch movies where the rating is greater than or equals to aboveReting
{
"status": "OK",
"message": "Success",
"body": [
{
"id": 1,
"title": "Mummy",
"overview": "The best movie",
"duration": 300,
"rating": 4,
"movieDirector": {
"id": 1,
"name": "Donald",
"middleName": "Emeka",
"surname": "Achugo"
}
},
{
"id": 2,
"title": "Mask",
"overview": "The second best movie",
"duration": 230,
"rating": 3,
"movieDirector": {
"id": 1,
"name": "Donald",
"middleName": "Emeka",
"surname": "Achugo"
}
}
]
}
{
"status": "BAD_REQUEST",
"message": "Rating must be greater than 0 and less than 6",
"body": null
}
{
"status": "NOT_FOUND",
"message": "No movie found",
"body": null
}
Fetch Movies by movieDirectorId
{
"status": "OK",
"message": "Success",
"body": [
{
"id": 1,
"title": "Mummy",
"overview": "The best movie",
"duration": 300,
"rating": 4,
"movieDirector": {
"id": 1,
"name": "Donald",
"middleName": "Emeka",
"surname": "Achugo"
}
},
{
"id": 2,
"title": "Mask",
"overview": "The second best movie",
"duration": 230,
"rating": 3,
"movieDirector": {
"id": 1,
"name": "Donald",
"middleName": "Emeka",
"surname": "Achugo"
}
}
]
}
{
"status": "NOT_FOUND",
"message": "No Movie Director found",
"body": null
}
{
"status": "NOT_FOUND",
"message": "The Movie Director has directed no movie yet",
"body": null
}
Fetch all movies directors present on the system
{
"status": "OK",
"message": "Success",
"body": [
{
"id": 1,
"name": "Donald",
"middleName": "Emeka",
"surname": "Achugo"
},
{
"id": 2,
"name": "Donald",
"middleName": null,
"surname": "Trump"
}
]
}
or
{
"status": "OK",
"message": "Success",
"body": []
}
Fetch a movie director by movieDirectorId
{
"status": "OK",
"message": "Success",
"body": {
"id": 1,
"name": "Donald",
"middleName": "Emeka",
"surname": "Achugo"
}
}
{
"status": "NOT_FOUND",
"message": "No Movie Director found",
"body": null
}
Add a Movie Direcotor into the catolog
{
"name": "Donald",
"middleName": "Emeka",
"surname": "Achugo"
}
{
"status": "CREATED",
"message": "Success",
"body": {
"id": 3,
"name": "Donald",
"middleName": "Emeka",
"surname": "Achugo"
}
}
Update a Movie Director
{
"id": 3,
"name": "Tommy"
}
or
{
"id": 3,
"name": "Tommy",
"surname": "Smith"
}
{
"status": "OK",
"message": "Success",
"body": {
"id": 3,
"name": "Tommy",
"middleName": "Emeka",
"surname": "Achugo"
}
}
or
{
"status": "OK",
"message": "Success",
"body": {
"id": 3,
"name": "Tommy",
"middleName": "Emeka",
"surname": "Smith"
}
}
{
"status": "BAD REQUEST",
"message": "No arguments provided",
"body": null
}
{
"status": "NOT_FOUND",
"message": "No Movie Director found",
"body": null
}
Remove a Movie Director by movieDirectorId
{
"status": "NOT_FOUND",
"message": "No Movie Director found",
"body": null
}
- @DonNya88 - Initial work