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;
|
||||
|
@@ -15,6 +15,7 @@ export type Series = {
|
||||
date: Date;
|
||||
image: string;
|
||||
author: string;
|
||||
tmdbId?: number;
|
||||
rating: number;
|
||||
average?: string;
|
||||
thumbnail?: string;
|
||||
@@ -22,12 +23,17 @@ export type Series = {
|
||||
};
|
||||
};
|
||||
|
||||
function renderSeries(movie: Series) {
|
||||
const meta = movie.meta;
|
||||
function renderSeries(series: Series) {
|
||||
const meta = series.meta;
|
||||
if ("date" in meta) {
|
||||
meta.date = formatDate(meta.date);
|
||||
}
|
||||
|
||||
delete meta.thumbnail;
|
||||
delete meta.average;
|
||||
|
||||
const movieImage = ``;
|
||||
|
||||
return fixRenderedMarkdown(`${
|
||||
meta
|
||||
? `---
|
||||
@@ -36,10 +42,14 @@ ${stringify(meta)}
|
||||
: `---
|
||||
---`
|
||||
}
|
||||
# ${movie.name}
|
||||
${movie.meta.image ? `` : ""}
|
||||
${movie.tags.map((t) => `#${t}`).join(" ")}
|
||||
${movie.description}
|
||||
# ${series.name}
|
||||
${
|
||||
// So we do not add a new image to the description everytime we render
|
||||
(series.meta.image && !series.description.includes(movieImage))
|
||||
? movieImage
|
||||
: ""}
|
||||
${series.tags.map((t) => `#${t}`).join(" ")}
|
||||
${series.description}
|
||||
`);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user