Skip to content

Commit

Permalink
feat(#2): add recommendation and change api endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
fedepacher committed Jun 11, 2023
1 parent 602ed20 commit d2a2d60
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions api.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
from fastapi import FastAPI
from movies import Movies
from recommendation_system import Recommendation


movies_obj = Movies()
recomendation_obj = Recommendation()
app = FastAPI()

@app.get('/movie/month/{month}')
@app.get('/cantidad_filmaciones_mes/{month}')
def get_count_movies_month(month: str):
"""Get the amount of movies released in the requested month.
Expand All @@ -18,7 +20,7 @@ def get_count_movies_month(month: str):
return movies_obj.get_count_movies_month(month=month)


@app.get('/movie/day/{day}')
@app.get('/cantidad_filmaciones_dia/{day}')
def get_count_movies_day(day: str):
"""Get the amount of movies released in the requested day.
Expand All @@ -31,7 +33,7 @@ def get_count_movies_day(day: str):
return movies_obj.get_count_movies_day(day=day)


@app.get('/movie/score/{title}')
@app.get('/score_titulo/{title}')
def get_score_title(title: str):
"""Get the released year and the score of the requested title.
Expand All @@ -44,7 +46,7 @@ def get_score_title(title: str):
return movies_obj.get_score_title(title=title)


@app.get('/movie/vote/{title}')
@app.get('/votos_titulo/{title}')
def get_votes_title(title: str):
"""Get the released year, vote count and vote average of the requested title.
Expand All @@ -57,7 +59,7 @@ def get_votes_title(title: str):
return movies_obj.get_votes_title(title=title)


@app.get('/movie/actor/{actor}')
@app.get('/get_actor/{actor}')
def get_actor(actor: str):
"""Get the actor movies, themaximun return ans the average return.
Expand All @@ -70,7 +72,7 @@ def get_actor(actor: str):
return movies_obj.get_actor(actor=actor)


@app.get('/movie/director/{director}')
@app.get('/get_director/{director}')
def get_director(director: str):
"""Get all the movies, released year, return, revenue and budget of the requested director.
Expand All @@ -81,3 +83,16 @@ def get_director(director: str):
dict: Message with the information requested.
"""
return movies_obj.get_director(director=director)


@app.get('/recomendacion/{title}')
def get_recomendation(title: str):
"""Get the recomendation accordint to requested title.
Args:
title (str, optional): Movie to be searched. Defaults to ''.
Returns:
dict: Message with the information requested.
"""
return recomendation_obj.recommendation(title=title)

0 comments on commit d2a2d60

Please sign in to comment.