refactor(schemas): group network schemas by direction

Move request and response schemas into matching subdirectories, extract the shared chat lock type, and update barrels and imports without changing wire formats.
This commit is contained in:
2026-07-14 15:12:19 +08:00
parent 8eaea17156
commit 759481b621
75 changed files with 222 additions and 124 deletions
@@ -0,0 +1,32 @@
/**
* 发送消息响应
*
*/
import { z } from "zod";
import {
booleanOrFalse,
booleanOrTrue,
numberOrLazy,
numberOrZero,
stringOrEmpty,
} from "../../nullable-defaults";
import { ChatImageSchema, ChatLockDetailSchema } from "../chat_payloads";
export const ChatSendResponseSchema = z.object({
reply: stringOrEmpty,
audioUrl: stringOrEmpty,
messageId: stringOrEmpty,
isGuest: booleanOrFalse,
// 函数式 default —— 每次 parse 时重新调 Date.now()(后端不返回 timestamp 时用当下时间)
timestamp: numberOrLazy(() => Date.now()),
image: ChatImageSchema,
lockDetail: ChatLockDetailSchema,
canSendMessage: booleanOrTrue,
creditBalance: numberOrZero,
creditsCharged: numberOrZero,
requiredCredits: numberOrZero,
shortfallCredits: numberOrZero,
});
export type ChatSendResponseInput = z.input<typeof ChatSendResponseSchema>;
export type ChatSendResponseData = z.output<typeof ChatSendResponseSchema>;