For this assignment, you'll be creating a database of movie films (with reviews), movie studios, actors, reviews and reviewers.
You cannot pass this lab without a commit history that indicates a vertical approach.
- Create a
ripe-banana
repository - Reuse boilerplate files to get baseline functionality ASAP
- Work vertically. That means build the tests, route and model for one entity/resource at a time. Horizontal would be building all the mongoose models first. Don't do that, go vertical!
- Start with the entities/resources that don't depend on other resources:
Studio
,Actor
, andReviewer
- As you tackle e2e API tests, you will need to drop all used collections in
beforeEach
. If you need a related model, that is already tested in another file, you don't need to retest things you have already tested (like basic POST and GET).
[x] Studio [x]Film [x]Actor [x] Reviewer
- Review
<...>
is a placeholder for actual data.S
= string,D
= date,N
= number,I
= ObjectId- Properties marked with
R
are required._id
(and__v
) properties omitted for clarity.
{
name: <name-of-studio RS>,
address: {
city: <city S>
state: <state S>
country: <country S>
}
}
{
title: <title of film RS>,
studio: <studio _id RI>,
released: <4-digit year RN>,
cast: [{
role: <name of character S>,
actor: <actor _id RI>
}]
}
{
name: <name RS>,
dob: <date-of-birth D>,
pob: <place-of-birth S>
}
{
name: <string RS>,
company: <company or website name RS>
}
{
rating: <rating number 1-5 RN>,
reviewer: <review _id RI>
review: <review-text, max-length 140 chars RS>,
film: <film-id RI>
}
Pick the set of routes that fit with your vertical slice.
While the schemas should look like the data definitions above, these are descriptions of the data that should be returned from the various GET
methods. You will need to use lean
, populate
, select
and combining data to shape the appropriate response.
[{ _id, name }]
{ _id, name, address, films: [{ _id, title }] }
[{
_id, title, released,
studio: { _id, name }
}]
{
title,
released,
studio: { _id, name },
cast: [{
_id,
role,
actor: { _id, name }
}],
reviews: [{
id,
rating,
review,
reviewer: { _id, name }
]
}
[{ _id, name }]
{
name,
dob,
pob,
films: [{
id,
title,
released
}]
}
[{
_id,
name,
company
}]
{
_id,
name,
company,
reviews: [{
_id,
rating,
review,
film: { _id, title }
}]
}
limit to 100 highest rated
[{
_id,
rating,
review,
film: { _id, title }
}]
Studio, Films, and Actors, Reviewers and Reviews can be added.
Only Reviewers can be updated.
Reviews and Reviewers However:
- Reviewers cannot be deleted if there are reviews
- E2E API tests for supported routes
Deploy to heroku
- Models: 5pts
- Relationships: 5pts
- Routes: 5pts
- Project Organization and Testing: 5pts