Giter VIP home page Giter VIP logo

unripe-banana's Introduction

LAB: Data Modelling - Ripe Banana

Description

For this assignment, you'll be creating a database of movie films (with reviews), movie studios, actors, reviews and reviewers.

Working on this Lab

You cannot pass this lab without a commit history that indicates a vertical approach.

Setup

  1. Create a ripe-banana repository
  2. Reuse boilerplate files to get baseline functionality ASAP

Approach

  1. 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!
  2. Start with the entities/resources that don't depend on other resources: Studio, Actor, and Reviewer
  3. 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).

Models (Entities/Resources)

[x] Studio [x]Film [x]Actor [x] Reviewer

  • Review

Directions Key

  • <...> 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.

Studio

{
  name: <name-of-studio RS>,
  address: {
    city: <city S>
    state: <state S>
    country: <country S>
  }
}

Film

{
  title: <title of film RS>,
  studio: <studio _id RI>,
  released: <4-digit year RN>,
  cast: [{
    role: <name of character S>,
    actor: <actor _id RI>
  }]
}

Actor

{
  name: <name RS>,
  dob: <date-of-birth D>,
  pob: <place-of-birth S>
}

Reviewer

{
  name: <string RS>,
  company: <company or website name RS>
}

Review

{
  rating: <rating number 1-5 RN>,
  reviewer: <review _id RI>
  review: <review-text, max-length 140 chars RS>,
  film: <film-id RI>
}

Routes

Pick the set of routes that fit with your vertical slice.

GET

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.

GET /studios
[{ _id, name }]
GET /studios/:id
{ _id, name, address, films: [{ _id, title }] }
GET /films
[{
    _id, title, released,
    studio: { _id, name }
}]
GET /films/:id
{
    title,
    released,
    studio: { _id, name },
    cast: [{
        _id,
        role,
        actor: { _id, name }
    }],
    reviews: [{
        id,
        rating,
        review,
        reviewer: { _id, name }
    ]
}
GET /actors
[{ _id, name }]
GET /actors/:id
{
    name,
    dob,
    pob,
    films: [{
      id,
      title,
      released
    }]
}
GET /reviewer
[{
  _id,
  name,
  company
}]
GET /reviewer/:id
{
    _id,
    name,
    company,
    reviews: [{
        _id,
        rating,
        review,
        film: { _id, title }
    }]
}
GET /reviews

limit to 100 highest rated

[{
    _id,
    rating,
    review,
    film: { _id, title }
}]

POST/PUT

Studio, Films, and Actors, Reviewers and Reviews can be added.

Only Reviewers can be updated.

DELETE

Reviews and Reviewers However:

  1. Reviewers cannot be deleted if there are reviews

Testing

  • E2E API tests for supported routes

Deploy

Deploy to heroku

Rubric:

  • Models: 5pts
  • Relationships: 5pts
  • Routes: 5pts
  • Project Organization and Testing: 5pts

unripe-banana's People

Contributors

seharlan avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.