Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor #17

Open
2 tasks
MeNsaaH opened this issue Sep 30, 2020 · 0 comments
Open
2 tasks

Refactor #17

MeNsaaH opened this issue Sep 30, 2020 · 0 comments

Comments

@MeNsaaH
Copy link
Member

MeNsaaH commented Sep 30, 2020

@router.post("/movie/ratings/average/", response_model=schemas.AverageRating)
def get_average_ratings(movie: schemas.MovieRating, db: Session = Depends(get_db)):
    """
    Get average movie ratings and number of people who have rated
    """
    return crud.get_movie_average_ratings(db=db, movie=movie)


@router.post("/movie/rating/", response_model=schemas.Rating)
def get_ip_rating(spec_rating: schemas.SpecificRating, db: Session = Depends(get_db)):
    """
    Get Rating of a movie by an ip_address
    """
    return crud.get_rating(db=db, spec_rating=spec_rating)


@router.post("/movie/downloads/", response_model=int)
def get_downloads(movie: schemas.MovieRating, db: Session = Depends(get_db)):
    """
    Gets number of downloads of a movie
    """
    return crud.get_number_of_downloads(db=db, movie=movie)


@router.post("/movie/referrals/", response_model=int)
def get_referrals(movie: schemas.MovieRating, db: Session = Depends(get_db)):
    """
    Gets total number of referrals of a movie
    """
    return crud.get_no_of_referrals(db=db, movie=movie)

All needs to be done when fetching movie data without makeing further requests

@MeNsaaH MeNsaaH changed the title Rewrite Refactor Oct 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant