Functions and Logic per Module - nss-day-cohort-16/d16-gp-movie-history-team-scrappy GitHub Wiki

Controller

  1. CreateListeners
  2. Call search(input);
  3. call showUntracked() on toggle
  4. call showTracked() on toggle
  5. call showWatched() on toggle
  6. call showFavorites() on toggle
  7. listen to stars (nate will let you know how to do that once he renders stars). call Model.UpdateRating(movieId, rating)

Model

  1. Check if someone is logged in (calls loadPage with argument yes or no)
  2. search(input): use getUser() then call Firebase.searchFirebase(input) if applicable and OpenMovies.getMovies(input), save input, and call signIn something, then call compare(), renderMovies(object, search)
  3. compare(result1, result2) returns 1 json file of unique moveies
  4. showUntracked() run compare and return only results that do not have firebase uid, then call renderMovies(object, untracked)
  5. showUnwatched() will call getWatched(false), then call renderMovies(object, unwatched)
  6. showWatched() will call getWatched(true), then call renderMovies(object, watched)
  7. showFavorites(), then call renderMovies(object, favorites)
  8. AddMovie(movieId) will call getFullMovie(imdbID), call Firebase.addMovie(object), call renderCard(object)
  9. DeleteMovie(movieId) will call hideMovie(),
  10. UpdateRating(movieId, rating) will change object then call renderCard(object) with new object
  11. addToWatchList(movieId) push new object to firebase will call renderCard(object),
  12. Call getUser() on page load, then call LoadPage(loggedIn).

View

  1. loadPage(loggedIn) takes yes or no. show sectoin-home OR section-unwatched
  2. renderMovies(object, state) state switches = favorites, watched, unwatched, untracked, search (hide correct toggles, display correct container, push results)
  3. renderCard(object) have logic to know how to display it, tracked or not. check for stars
  4. hideMovie(movieID)

Open Movie Interactions

  1. getMovies(string) is an ?s search with a string
  2. getFullMovie(imdbID)

FireBase Interactions

  1. getWatched(boolean) returns json object with either all watched=true or watched=false
  2. searchFirebase(title)
  3. getFavorites() returns json object with rating = 10
  4. addMovie(object)
  5. removeMovie(object)
  6. updateRating(object)
  7. sign in/sign out/sign up shit
  8. getUser() returns true or false