From 9ab67c615a76ec22433e9fa079c99520d504defc Mon Sep 17 00:00:00 2001 From: Ardeman Date: Mon, 24 Mar 2025 17:22:57 +0800 Subject: [PATCH] feat: move views field into data response schema for news API --- app/apis/common/get-news.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/apis/common/get-news.ts b/app/apis/common/get-news.ts index 186bd08..a06611e 100644 --- a/app/apis/common/get-news.ts +++ b/app/apis/common/get-news.ts @@ -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