fix: soo many lint errors

This commit is contained in:
Max Richter
2025-11-03 00:03:27 +01:00
parent c13420c3ab
commit 696082250d
41 changed files with 373 additions and 500 deletions

View File

@@ -68,6 +68,7 @@ export const ReviewContentSchema = makeContentSchema("Review", {
export const RecipeContentSchema = makeContentSchema("Recipe", {
description: z.string().optional(),
name: z.string().optional(),
reviewRating: ReviewRatingSchema.optional(),
recipeIngredient: z.array(z.string()).optional(),
recipeInstructions: z.array(z.string()).optional(),
totalTime: z.string().optional(),
@@ -124,3 +125,16 @@ export type RecipeResource = z.infer<typeof RecipeSchema> & {
export type GenericResource = z.infer<typeof GenericResourceSchema> & {
image?: typeof imageTable.$inferSelect;
};
export function getNameOfResource(res: GenericResource): string {
if (res.content?._type === "Article" && res.content.headline) {
return res.content.headline;
}
if (res.content?._type === "Review" && res.content.itemReviewed?.name) {
return res.content.itemReviewed.name;
}
if (res.content?._type === "Recipe" && res.content.name) {
return res.content.name;
}
return "Unnamed Resource";
}