feat: add initial recommendation data
This commit is contained in:
@@ -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 = ``;
|
||||
|
||||
return fixRenderedMarkdown(`${
|
||||
meta
|
||||
? `---
|
||||
@@ -35,7 +42,11 @@ ${stringify(meta)}
|
||||
---`
|
||||
}
|
||||
# ${movie.name}
|
||||
${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;
|
||||
|
||||
Reference in New Issue
Block a user