For this assignment, you'l be creating a database of movie films (with reviews), movie studios, actors, reviews and reviewers.
- 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 - Work in groups of 2 (one group of 3) on this lab
- Those of you in groups of 3 need to be careful about three people around one computer. Unless you work together at a fast pace, split up the work (but split it vertically!). You need to set a good pace to get through the work in the allotted time.
- Studio
- Film
- Actor
- Reviewer
- Review
<...>is a placeholder for actual data.S= string,D= date,N= number,I= ObjectId- Properties marked with
Rare required.
{
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>,
createdAt: <created timestamp D>,*
updatedAt: <updated timestamp D>*
}
// *Use mongoose timestamp feature
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 most recent
[{
_id, rating, review,
film: { _id, title }
}]
Studio, Films, and Actors, Reviewers and Reviews can be added.
Actors and Reviewers updated.
Studio, Films, and Actors can be deleted. However, studios cannot be deleted if there are films and actors cannot be deleted who are in films.
- Unit tests for models
- E2E API tests
- Models: 5pts
- Relationships: 5pts
- Routes: 5pts
- Project Organization and Testing: 5pts
