Coder Social home page Coder Social logo

groa-be's Introduction

Code Climate

Maintainability Test Coverage

API Documentation

Backend delpoyed at AWS Elastic Beanstalk

Getting started!

To get the server running locally:

  • Clone this repo
  • npm install to install all required dependencies
  • npm run server to start the local server
  • npm test to start server using testing environment

Express

Express

  • RESTful API

  • Straightforward sever construction

  • Stable and widely used

  • Can be built upon

Endpoints

User Routes

Method Endpoint Access Control Description
POST /api/users/register Creates a new user in Okta Dashboard.
POST /api/users/login Logs in an existing user and handles authenticated user not in the groa database.
POST /api/users/:user_id/uploading Uploads zip file from Letterboxd, unzips, parses and cleans each file and adds them to their respective tables in the database. If a movie with the same name and year exists on the users account it will update variable information in place.
POST /api/users/:user_id/add-movie-rating Adds a rating object to the groa_users_ratings table, If a movie with the same name and year exists on the users account it will update the rating information in place.
GET /api/users/:user_id/get-movies Returns a json file of all the movies in the database.
GET /api/users/:user_id/recommendations POSTs the user_id to the data science recommendation endpoint and then returns the newly added recommendations from the database or a prompt to add more reviews.
GET /api/users/:user_id/recommended Returns the latest recommendation from the database.
GET /api/users/:user_id/recommendation-history Returns an array of all recommendations found in the database.

Data Model

USERS


{
  user_id: INTEGER, INCREMENTS
  okta_id: STRING,
  user_name: STRING, EMAIL IS USERNAME UNIQUE
  password: STRING,
  has_letterboxd: BOOLEAN,
  has_imdb: BOOLEAN,
  last_login: DATE,
  email: STRING
}

USERS WATCHED


{
  user_id: INTEGER, INCREMENTS
  movie_id: STRING
  date: DATE
  source: STRING
}

USERS WATCHLIST


{
  id: INTEGER
  user_id: INTEGER, INCREMENTS
  movie_id: STRING
  date: DATE
  source: STRING
}

USERS WILL NOT WATCHLIST


{
  id: INTEGER
  user_id: INTEGER, INCREMENTS
  movie_id: STRING
  date: DATE
}

MOVIES


{
  movie_id: STRING
  title_type: MOVIE
  primary_title: STRING
  original_title: STRING
  is_adult: BOOLEAN
  start_year: DATE: YYYY
  end_year: DATE: YYYY
  runtime_minutes: INTEGER
  genres: STRING
  poster_url: STRING
  avarage_rating: REAL
  num_votes: INTEGER
  original_language: STRING
  description: STRING
  trailer_url: STRING
}

REVIEWS/RATINGS


RATING

{
  rating_id: INTEGER
  user_id: INTEGER
  movie_id: STRING
  date: DATE
  rating: REAL
  source: STRING
}
REVIEW

{
  review_id: INTEGER
  user_id: INTEGER
  movie_id: STRING
  date: DATE
  review_title: STRING
  review_text: STRING
  tags: STRING
  source: STRING
}

RECOMMENDATIONS


/:ID/RECOMMENDATIONS

    {
      movie_id: STRING,
      score: INTEGER,
      title: STRING,
      year: INTEGER,
      genres: [
        STRING
      ],
      poster_url: STRING
    }

UPLOADING



{
  user_id: INTEGER
  user_name: STRING
  ratings: [
    ...
  ],
  reviews: [
    ...
  ],
  watched: [
    ...
  ],
  watchlist: [
    ...
  ]
}

Actions

add() -> Creates and returns a new user.

findBy(username) -> Returns a single user by user_name.

getUserById(id) -> Returns a single user by ID.

findUsers() -> Return all users and their corresponding ID.

findRatings() -> Returns the user_groa_ratings for the logged in user.

addRating() -> Takes ratings.csv file or rating object from zip upload and adds to user_groa_ratings,

addReview() -> Takes reviews.csv file from zip upload and adds to user_groa_reviews.

addToWatchList() -> Takes watchlist.csv file from zip upload and adds to user_groa_watchlist.

addToWatched() -> Takes watched.csv file from zip upload and adds to user_letterboxd_watched.

getUserData(id) -> Returns all user_groa_ratings, _reviews, and _watchlist, and user_letteroxd_watched items found in the database for a given user_id.

getLatestRecommendations(id) -> Returns the latest recommendations found in the database.

getAllRecommendations(id) -> Returns all recommendatios associated with the users account.

Environment Variables

In order for the app to function correctly, the user must set up their own environment variables.

create a .env file that includes the following:

_ DATABASE_URL - This is the url for thre Groa database needed to connect to our postgresQL on RDS _ TESTING_DB_URL - This is the local test databaase url, it can be changed to whatever you need for your local setup _ RECOMMENDATION_URL - This is the url for the data science ratings recommender, needed for generating recommendations _ JWT_SECRET - The secret used to assign encode tokens for authentication _ TOKEN_EXP - Variable in which the token expires, can be set to anything you like _ HASHING_ROUNDS - adds rounds to the hashing

The respective values for these variables can be found on the Elastic Beanstalk environment in Configuration > Software > Environment properties

Contributing

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Please note we have a code of conduct. Please follow it in all your interactions with the project.

Issue/Bug Request

If you are having an issue with the existing project code, please submit a bug report under the following guidelines:

  • Check first to see if your issue has already been reported.
  • Check to see if the issue has recently been fixed by attempting to reproduce the issue using the latest master branch in the repository.
  • Create a live example of the problem.
  • Submit a detailed bug report including your environment & browser, steps to reproduce the issue, actual and expected outcomes, where you believe the issue is originating from, and any potential solutions you have considered.

Feature Requests

We would love to hear from you about new features which would improve this app and further the aims of our project. Please provide as much detail and information as possible to show us why you think your new feature should be implemented.

Pull Requests

If you have developed a patch, bug fix, or new feature that would improve this app, please submit a pull request. It is best to communicate your ideas with the developers first before investing a great deal of time into a pull request to ensure that it will mesh smoothly with the project.

Remember that this project is licensed under the MIT license, and by submitting a pull request, you agree that your work will be, too.

Pull Request Guidelines

  • Ensure any install or build dependencies are removed before the end of the layer when doing a build.
  • Update the README.md with details of changes to the interface, including new plist variables, exposed ports, useful file locations and container parameters.
  • Ensure that your code conforms to our existing code conventions and test coverage.
  • Include the relevant issue number, if applicable.
  • You may merge the Pull Request in once you have the sign-off of two other developers, or if you do not have permission to do that, you may request the second reviewer to merge it for you.

Attribution

These contribution guidelines have been adapted from this good-Contributing.md-template.

Documentation

See Frontend Documentation for details on the front end of our project. see Data Science for details on the Data Science of our project.

groa-be's People

Contributors

azatecas avatar bensolt avatar bgingrich avatar briannakeune avatar cmruss avatar dependabot[bot] avatar droneal11015 avatar jvillalp avatar moviedatascience avatar msinnema33 avatar robomantis19 avatar steven-matos avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

groa-be's Issues

Typing in the Search Bar breaks the site

Expected Behavior

Search bar should act as a filter to parse movie titles as the user types text.

Current Behavior

Typing in the search bar breaks the page and a white screen appears.

Possible Solution

It almost certainly has to do with the calls to the DB, so re-configuring how the search bar pulls from the DB will probably be a place to start.

Steps to Reproduce

  1. Navigate to https://www.groa.us//explore
  2. Type anything into the search bar
  3. Observe white screen

Context (Environment)

This occurs on ratings as well, but the only page where functionality can be tested is explore due to posters and names not showing up on any other page.

Ratings do not display on Explore page

Expected Behavior

Explore page should display ratings when the User has rated that movie.

Current Behavior

Ratings all appear empty.

Possible Solution

Pulling ratings information from the DB

Steps to Reproduce

  1. Navigate to https://www.groa.us/userid/explore
  2. Scroll down.
  3. Observe all movies have a blank rating.

Context (Environment)

This issue is probably due to the information not being called from the DB.
rating

Links to Service Providers should populate a new window

Expected Behavior

When the user clicks on a service provider link they should be taken to a new window.

Current Behavior

The link takes them to a new screen within the same window.

Possible Solution

I think there's a variable to set the behavior for link click.

Context (Environment)

This way someone can go watch the movie and not lose their place when they want to rate it afterwards.

Not Interested Button does not add movie to user_willnotwatchlist

Expected Behavior

When a user selects "Not interested" the movie is added to the user_willnotwatchlist

Current Behavior

When a user selects "Not interested" the text changes to "Removed from results" but the title is not added to the user_willnotwatchlist table.

Possible Solution

I assume the information is not being sent to the DS endpoint /notwatchlist .

The following information needs to be sent to that endpoint:

{ "movie_id": "string", "user_id": "string" }

Context (Environment)

I looked in the DB and my user has movies in there but none after the 20th.

If I had none I would be inclined to think it was something wrong with the DS API but since some are populating but they stopped after the 20th I think something must have changed in the web code call to the API.

Sign-up/Login is broken

Expected Behavior

User should be able to sign into Groa or create an account.

Current Behavior

Selecting login after entering a username and password does nothing.

Possible Solution

I'm pretty sure this is due to Login and Signup pulling from the DB that Doina closed down on Friday afternoon.

If we can get the routes corrected so that the login information is pulled from the new DB this issue should be resolved.

Steps to Reproduce

  1. Navigate to https://www.groa.us/login
  2. Enter Username and Password
  3. Select Login
  4. Observe no action

Context (Environment)

This occurs on both register and login.

Ratings Don't Use the DS Endpoint

Expected Behavior

Ratings given by the user should be sent to the DS endpoint, which will cache that information and

Current Behavior

Ratings are being entered directly into the DB by the web back end.

Possible Solution

Send a post request when a user rates a movie to /rating

Watchlist page is mislabeled as "Wishlist"

Expected Behavior

"Wishlist" page in the navigation bar should be renamed to "Watchlist" and load the watchlist page.

Current Behavior

Watchlist is named "Wishlist" in the navbar and routes to a non-existant "Wishlist" page.

Possible Solution

Changing the name in the navigation bar as well as the route to "watchlist"

Steps to Reproduce

  1. Navigate to https://www.groa.us
  2. Expand the lefthand hamburger menu
  3. Select "Wishlist"
  4. Observe no page load

Context (Environment)

Going to https://www.groa.us/userID/watchlist does still properly load and function.

Recommendations Page does not return Recommendations

Expected Behavior

User should receive recommendations when navigating to the Recommendations page.

Current Behavior

A white screen is returned instead of the Recommendations page.

Possible Solution

Parsing the returned Json from the DS API instead of querying the DB should result in the BE being able to format and serve Recommendations

Steps to Reproduce

  1. Navigate to https://www.groa.us/userid/recommendations
  2. Observe a white screen.

Context (Environment)

This will require both a rework of how the site calls the API and how the data is served on the front end.

Watchlist Lists Movies Multiple Times

Expected Behavior

Watchlist should be populated with only one instance of each movie.

Current Behavior

Many instances of the same movie are populating on the watchlist page.

Possible Solution

Putting a constraint on the watchlist page to only load a single instance of each (Movie)(Year) combination should be a band-aid fix.

Steps to Reproduce

  1. Navigate to https://www.groa.us/userid/watchlist
  2. Scroll down.
  3. Observe several instances of the same movie appearing

Context (Environment)

Some additional exploration would be a good idea to find out exactly what is causing this so we can potentially fix similar problems elsewhere.

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.