19 lines
505 B
TypeScript
19 lines
505 B
TypeScript
import { Handlers } from "$fresh/server.ts";
|
|
import { AccessDeniedError } from "@lib/errors.ts";
|
|
import { getSimilarMovies } from "@lib/recommendation.ts";
|
|
import { json } from "@lib/helpers.ts";
|
|
|
|
export const handler: Handlers = {
|
|
async GET(_, ctx) {
|
|
const session = ctx.state.session;
|
|
if (!session) {
|
|
throw new AccessDeniedError();
|
|
}
|
|
|
|
const recommendations = await getSimilarMovies(ctx.params.id);
|
|
console.log({ recommendations });
|
|
|
|
return json(recommendations);
|
|
},
|
|
};
|