Added preparation, cooking, and total times to recipe views.

This commit is contained in:
Jesse Brault 2024-08-12 20:09:26 -05:00
parent b8787cd8f9
commit af0b91a6f2
3 changed files with 25 additions and 1 deletions

View File

@ -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,

View File

@ -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,

View File

@ -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