From c9e65dcdde649963aafaad3c0b83165bf86df5dd Mon Sep 17 00:00:00 2001 From: DIYgod Date: Mon, 2 Sep 2024 16:44:13 +0800 Subject: [PATCH] feat: update hono.ts --- src/hono.ts | 220 ++++++++++-------- src/renderer/src/models/types.ts | 7 +- .../settings/helper/withSettingEnable.tsx | 2 - src/renderer/src/queries/entries.ts | 9 +- 4 files changed, 139 insertions(+), 99 deletions(-) diff --git a/src/hono.ts b/src/hono.ts index e23d79c64..5600f139a 100644 --- a/src/hono.ts +++ b/src/hono.ts @@ -1,6 +1,4 @@ import * as hono_hono_base from 'hono/hono-base'; -import * as hono_utils_http_status from 'hono/utils/http-status'; -import * as hono from 'hono'; import { HttpBindings } from '@hono/node-server'; import * as drizzle_orm from 'drizzle-orm'; import { InferInsertModel } from 'drizzle-orm'; @@ -2443,7 +2441,7 @@ declare const _routes: hono_hono_base.HonoBase}`]: { - input: Partial; - output: any; - outputFormat: string; - status: hono_utils_http_status.StatusCode; + "/entries/read-histories/:id": { + $get: { + input: { + param: { + id?: string | undefined; + }; + } & { + query: { + page?: string | string[] | undefined; + size?: string | string[] | undefined; + }; + }; + output: { + code: 0; + data: { + users: { + [x: string]: { + name: string | null; + id: string; + image: string | null; + handle: string | null; + }; + }; + entryReadHistories: { + userIds: string[]; + readCount: number; + } | null; + }; + }; + outputFormat: "json" | "text"; + status: 200; }; }; - [x: `/entries/check-new/${string}`]: { - [x: `$${Lowercase}`]: { - input: Partial; - output: any; - outputFormat: string; - status: hono_utils_http_status.StatusCode; + "/entries/check-new": { + $get: { + input: { + query: { + insertedAfter: string | string[]; + view?: string | string[] | undefined; + feedId?: string | string[] | undefined; + feedIdList?: string | string[] | undefined; + read?: string | string[] | undefined; + }; + }; + output: { + code: 0; + data: { + has_new: boolean; + lastest_at?: string | undefined; + entry_id?: string | undefined; + }; + }; + outputFormat: "json" | "text"; + status: 200; }; }; "/entries": { @@ -3304,13 +3342,13 @@ declare const _routes: hono_hono_base.HonoBase @@ -82,9 +83,7 @@ export type FeedListModel = { }[] } -export type SupportedLanguages = Parameters< - typeof apiClient.ai.translation.$get ->[0]["query"]["language"] +export type SupportedLanguages = z.infer export type RecommendationItem = ExtractBizResponse["data"][string] diff --git a/src/renderer/src/modules/settings/helper/withSettingEnable.tsx b/src/renderer/src/modules/settings/helper/withSettingEnable.tsx index 17b8ef9b1..b10aa863c 100644 --- a/src/renderer/src/modules/settings/helper/withSettingEnable.tsx +++ b/src/renderer/src/modules/settings/helper/withSettingEnable.tsx @@ -17,8 +17,6 @@ export const withSettingEnabled = forwardRef((props, ref) => { const res = useSettings.select(condition) return res ? - // @ts-expect-error createElement(IfComponent, { ...props, ref }) : - // @ts-expect-error createElement(ElseComponent, { ...props, ref }) }) diff --git a/src/renderer/src/queries/entries.ts b/src/renderer/src/queries/entries.ts index 11f682f03..c274e01e6 100644 --- a/src/renderer/src/queries/entries.ts +++ b/src/renderer/src/queries/entries.ts @@ -79,9 +79,14 @@ export const entries = { query.feedId = query.feedIdList[0] delete query.feedIdList } - // @ts-expect-error return apiClient.entries["check-new"].$get({ - query, + query: { + insertedAfter: `${query.insertedAfter}`, + view: `${query.view}`, + feedId: query.feedId, + read: typeof query.read === "boolean" ? JSON.stringify(query.read) : undefined, + feedIdList: query.feedIdList, + }, }) as Promise<{ data: { has_new: boolean, lastest_at?: string } }> },