feat: completely remove redis
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import { Handlers } from "$fresh/server.ts";
|
||||
import { createStreamResponse } from "@lib/helpers.ts";
|
||||
import { getAllMovies } from "@lib/resource/movies.ts";
|
||||
import { getAllMovies, Movie } from "@lib/resource/movies.ts";
|
||||
import * as tmdb from "@lib/tmdb.ts";
|
||||
import {
|
||||
createRecommendationResource,
|
||||
@ -14,10 +14,11 @@ async function processUpdateRecommendations(
|
||||
const allMovies = await getAllMovies();
|
||||
|
||||
const movies = allMovies.filter((m) => {
|
||||
if (!m?.meta) return false;
|
||||
if (!m.meta.rating) return false;
|
||||
if (!m.meta.tmdbId) return false;
|
||||
return true;
|
||||
});
|
||||
}) as Movie[];
|
||||
|
||||
streamResponse.enqueue("Fetched all movies");
|
||||
|
||||
@ -27,7 +28,7 @@ async function processUpdateRecommendations(
|
||||
await Promise.all(movies.map(async (movie) => {
|
||||
if (!movie.meta.tmdbId) return;
|
||||
if (!movie.meta.rating) return;
|
||||
const recommendation = await getRecommendation(movie.id, movie.type);
|
||||
const recommendation = getRecommendation(movie.id, movie.type);
|
||||
if (recommendation) {
|
||||
done++;
|
||||
return;
|
||||
|
@ -11,6 +11,7 @@ export const handler: Handlers = {
|
||||
}
|
||||
|
||||
const recommendations = await getSimilarMovies(ctx.params.id);
|
||||
console.log({ recommendations });
|
||||
|
||||
return json(recommendations);
|
||||
},
|
||||
|
Reference in New Issue
Block a user