This one is very similar to POST movie
, there are some differences however:
- When saving a review, the client needs to provide the
MovieId
associated with the review. - If the
MovieId
is for a movie that does not exist, we want to return an error. - We want to collect all errors for the movie and the review in the response
This exercise is made up for three parts. Work through them in order:
- Review the
ReviewValidationError
ADT (already implemented) - Review
ValidatedReview
(already implemented) - Review
NewReviewValidator
(already implemented)
- Review
ReviewId
(already implemented) - Implement
SaveReviewService
and get the unit tests to pass
- Review
SaveReviewController
(already implemented) - Review the wiring in
AppRuntime
andAppRoutes
- Run curls to verify the application has been wired correctly
Start the app using ./auto/start-local and use curl
to test it out!
curl -v -H "Accept: application/json" -X POST -d "{\"author\": \"\", \"comment\": \"\"}" http://localhost:9200/movies/100/reviews | jq .
Should return all errors.
curl -v -H "Accept: application/json" -X POST -d "{\"author\": \"The Phantom Reviewer\", \"comment\": \"Boo\"}" http://localhost:9200/movies/100/reviews | jq .
Should return an error for movie id only.
curl -v -H "Accept: application/json" -X POST -d "{\"author\": \"The Phantom Reviewer\", \"comment\": \"Boo\"}" http://localhost:9200/movies/1/reviews | jq .
Should succeed and return a 201 and a review id.
curl -v -H "Accept: application/json" http://localhost:9200/movies/1 | jq .
Should return the movie and the reviews just created