From af0b91a6f276c2c3477b8de61344bd4733f5ab13 Mon Sep 17 00:00:00 2001 From: Jesse Brault Date: Mon, 12 Aug 2024 20:09:26 -0500 Subject: [PATCH] Added preparation, cooking, and total times to recipe views. --- src/api/getRecipeInfos.ts | 6 ++++++ src/api/types/FullRecipeView.ts | 14 +++++++++++++- src/api/types/RecipeInfoView.ts | 6 ++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/api/getRecipeInfos.ts b/src/api/getRecipeInfos.ts index 7e6a6a5..309922e 100644 --- a/src/api/getRecipeInfos.ts +++ b/src/api/getRecipeInfos.ts @@ -35,6 +35,9 @@ const getRecipeInfos = async ({ id, updated: rawUpdated, title, + preparationTime, + cookingTime, + totalTime, ownerId, owner, isPublic, @@ -45,6 +48,9 @@ const getRecipeInfos = async ({ id, updated: new Date(rawUpdated), title, + preparationTime, + cookingTime, + totalTime, ownerId, owner, isPublic, diff --git a/src/api/types/FullRecipeView.ts b/src/api/types/FullRecipeView.ts index 0c051e9..0e3388a 100644 --- a/src/api/types/FullRecipeView.ts +++ b/src/api/types/FullRecipeView.ts @@ -7,6 +7,9 @@ export interface RawFullRecipeView { modified: string | null slug: string title: string + preparationTime: number + cookingTime: number + totalTime: number text: string owner: UserInfoView starCount: number @@ -21,6 +24,9 @@ interface FullRecipeView { modified: Date | null slug: string title: string + preparationTime: number + cookingTime: number + totalTime: number text: string owner: UserInfoView starCount: number @@ -35,18 +41,24 @@ export const toFullRecipeView = ({ modified: rawModified, slug, title, + preparationTime, + cookingTime, + totalTime, text, owner, starCount, viewerCount, mainImage: rawMainImage, isPublic -}: RawFullRecipeView) => ({ +}: RawFullRecipeView): FullRecipeView => ({ id, created: new Date(rawCreated), modified: rawModified ? new Date(rawModified) : null, slug, title, + preparationTime, + cookingTime, + totalTime, text, owner, starCount, diff --git a/src/api/types/RecipeInfoView.ts b/src/api/types/RecipeInfoView.ts index ed7ea8b..79a6308 100644 --- a/src/api/types/RecipeInfoView.ts +++ b/src/api/types/RecipeInfoView.ts @@ -5,6 +5,9 @@ export interface RawRecipeInfoView { id: number updated: string title: string + preparationTime: number + cookingTime: number + totalTime: number ownerId: number owner: UserInfoView isPublic: boolean @@ -17,6 +20,9 @@ interface RecipeInfoView { id: number updated: Date title: string + preparationTime: number + cookingTime: number + totalTime: number owner: UserInfoView isPublic: boolean starCount: number