18 lines
473 B
TypeScript
18 lines
473 B
TypeScript
import { AccessDeniedError } from "@lib/errors.ts";
|
|
import { getSimilarMovies } from "@lib/recommendation.ts";
|
|
import { json } from "@lib/helpers.ts";
|
|
import { define } from "../../../../utils.ts";
|
|
|
|
export const handler = define.handlers({
|
|
async GET(ctx) {
|
|
const session = ctx.state.session;
|
|
if (!session) {
|
|
throw new AccessDeniedError();
|
|
}
|
|
|
|
const recommendations = await getSimilarMovies(ctx.params.id);
|
|
|
|
return json(recommendations);
|
|
},
|
|
});
|