feat: move views field into data response schema for news API

This commit is contained in:
Ardeman 2025-03-24 17:22:57 +08:00
parent 65f7bbe0aa
commit 9ab67c615a

View File

@ -23,10 +23,13 @@ export const newsResponseSchema = z.object({
created_at: z.string(),
updated_at: z.string(),
author: authorSchema,
views: z.number(),
})
const dataResponseSchema = z.object({
data: z.array(newsResponseSchema),
data: z.array(
newsResponseSchema.extend({
views: z.number(),
}),
),
})
export type TNewsResponse = z.infer<typeof newsResponseSchema>