feat: add initial recommendation data

This commit is contained in:
2023-09-08 13:33:29 +02:00
parent 517b1ba23d
commit cc112b7554
19 changed files with 289 additions and 170 deletions

View File

@@ -12,6 +12,8 @@ export type Movie = {
tags: string[];
meta: {
date: Date;
tmdbId?: number;
keywords?: string[];
image: string;
thumbnail?: string;
average?: string;
@@ -26,6 +28,11 @@ export function renderMovie(movie: Movie) {
meta.date = formatDate(meta.date) as unknown as Date;
}
delete meta.thumbnail;
delete meta.average;
const movieImage = `![](${movie.meta.image})`;
return fixRenderedMarkdown(`${
meta
? `---
@@ -35,7 +42,11 @@ ${stringify(meta)}
---`
}
# ${movie.name}
${movie.meta.image ? `![](${movie.meta.image})` : ""}
${
// So we do not add a new image to the description everytime we render
(movie.meta.image && !movie.description.includes(movieImage))
? movieImage
: ""}
${movie.tags.map((t) => `#${t}`).join(" ")}
${movie.description}
`);
@@ -103,6 +114,10 @@ const crud = createCrud<Movie>({
hasThumbnails: true,
});
export const getMovie = crud.read;
export const getMovie = async (id: string) => {
const movie = await crud.read(id);
return movie;
};
export const getAllMovies = crud.readAll;
export const createMovie = crud.create;