canape/backend/ratings/handlers.go
Lucas BEE 97057b43c3 Add IMDB ratings in database
Add method to fetch ratings from imdb every day
Create a new table and a new view to fetch directly the movies and shows
with their imdb ratings
2019-04-17 17:30:27 +02:00

25 lines
532 B
Go

package ratings
import (
"net/http"
"github.com/sirupsen/logrus"
"git.quimbo.fr/odwrtw/canape/backend/web"
)
// RefreshHandler refresh the imdb ratings
func RefreshHandler(env *web.Env, w http.ResponseWriter, r *http.Request) error {
log := env.Log.WithFields(logrus.Fields{
"function": "ratings.RefreshHandler",
})
log.Debugf("refreshing imdb ratings")
err := Refresh(env)
if err != nil {
return env.RenderError(w, err)
}
log.Debugf("done refreshing imdb ratings")
return env.RenderOK(w, "Ratings Refreshed")
}