Add isLiked bool on the front
This commit is contained in:
@@ -35,6 +35,7 @@ export const SongValidator = yup
|
|||||||
yup.array(yup.object({ userId: yup.number().required() })).default(undefined)
|
yup.array(yup.object({ userId: yup.number().required() })).default(undefined)
|
||||||
)
|
)
|
||||||
.optional(),
|
.optional(),
|
||||||
|
isLiked: yup.bool().optional(),
|
||||||
})
|
})
|
||||||
.concat(ModelValidator)
|
.concat(ModelValidator)
|
||||||
.transform((song: Song) => ({
|
.transform((song: Song) => ({
|
||||||
@@ -53,6 +54,7 @@ export const SongValidator = yup
|
|||||||
yup.date().cast(b.playDate)!.getTime()
|
yup.date().cast(b.playDate)!.getTime()
|
||||||
)
|
)
|
||||||
.at(0)?.info.score ?? null,
|
.at(0)?.info.score ?? null,
|
||||||
|
isLiked: song.likedByUsers?.some(() => true),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
export type Song = yup.InferType<typeof SongValidator>;
|
export type Song = yup.InferType<typeof SongValidator>;
|
||||||
|
|||||||
Reference in New Issue
Block a user