refactor(data): consolidate data layer under services namespace
- Move src/data/{api,dto,schemas} directories to src/data/services/*
- Update all relative imports across the codebase to reference new paths
- Use CSS color tokens for splash button gradient in splash-button.module.css
- Add responsive sizes attribute to splash background image
- Add JSDoc documentation to splash-background component referencing original Dart implementation
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
/**
|
||||
* Apple 登录请求
|
||||
* 原始 Dart: AppleLoginRequest (lib/data/models/auth/auth_request.dart)
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
export const AppleLoginRequestSchema = z.object({
|
||||
identityToken: z.string(),
|
||||
platform: z.string(),
|
||||
});
|
||||
|
||||
export type AppleLoginRequestInput = z.input<typeof AppleLoginRequestSchema>;
|
||||
export type AppleLoginRequestData = z.output<typeof AppleLoginRequestSchema>;
|
||||
@@ -1,14 +0,0 @@
|
||||
/**
|
||||
* Facebook 登录请求
|
||||
* 原始 Dart: FacebookLoginRequest (lib/data/models/auth/auth_request.dart)
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
export const FacebookLoginRequestSchema = z.object({
|
||||
accessToken: z.string(),
|
||||
platform: z.string(),
|
||||
guestId: z.string().default(""),
|
||||
});
|
||||
|
||||
export type FacebookLoginRequestInput = z.input<typeof FacebookLoginRequestSchema>;
|
||||
export type FacebookLoginRequestData = z.output<typeof FacebookLoginRequestSchema>;
|
||||
@@ -1,17 +0,0 @@
|
||||
/**
|
||||
* Facebook 用户数据 schema
|
||||
* 原始 Dart: FacebookUserData (lib/data/services/auth/auth_platform.dart)
|
||||
*
|
||||
* 字段对齐 Dart 端 `String?` 可空语义:缺字段时存 `null`。
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
export const FacebookUserDataSchema = z.object({
|
||||
id: z.string().nullable().default(null),
|
||||
name: z.string().nullable().default(null),
|
||||
email: z.string().nullable().default(null),
|
||||
pictureUrl: z.string().nullable().default(null),
|
||||
});
|
||||
|
||||
export type FacebookUserDataInput = z.input<typeof FacebookUserDataSchema>;
|
||||
export type FacebookUserDataData = z.output<typeof FacebookUserDataSchema>;
|
||||
@@ -1,13 +0,0 @@
|
||||
/**
|
||||
* Facebook ID 登录请求
|
||||
* 原始 Dart: FbIdLoginRequest (lib/data/models/auth/auth_request.dart)
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
export const FbIdLoginRequestSchema = z.object({
|
||||
fbId: z.string(),
|
||||
avatarUrl: z.string().default(""),
|
||||
});
|
||||
|
||||
export type FbIdLoginRequestInput = z.input<typeof FbIdLoginRequestSchema>;
|
||||
export type FbIdLoginRequestData = z.output<typeof FbIdLoginRequestSchema>;
|
||||
@@ -1,14 +0,0 @@
|
||||
/**
|
||||
* Google 登录请求
|
||||
* 原始 Dart: GoogleLoginRequest (lib/data/models/auth/auth_request.dart)
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
export const GoogleLoginRequestSchema = z.object({
|
||||
idToken: z.string(),
|
||||
platform: z.string(),
|
||||
guestId: z.string().default(""),
|
||||
});
|
||||
|
||||
export type GoogleLoginRequestInput = z.input<typeof GoogleLoginRequestSchema>;
|
||||
export type GoogleLoginRequestData = z.output<typeof GoogleLoginRequestSchema>;
|
||||
@@ -1,12 +0,0 @@
|
||||
/**
|
||||
* 游客登录请求
|
||||
* 原始 Dart: GuestLoginRequest (lib/data/models/auth/auth_request.dart)
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
export const GuestLoginRequestSchema = z.object({
|
||||
deviceId: z.string(),
|
||||
});
|
||||
|
||||
export type GuestLoginRequestInput = z.input<typeof GuestLoginRequestSchema>;
|
||||
export type GuestLoginRequestData = z.output<typeof GuestLoginRequestSchema>;
|
||||
@@ -1,18 +0,0 @@
|
||||
/**
|
||||
* 游客登录响应
|
||||
* 原始 Dart: GuestLoginResponse (lib/data/models/auth/auth_response.dart)
|
||||
*/
|
||||
import { z } from "zod";
|
||||
import { UserSchema } from "../user/user";
|
||||
|
||||
export const GuestLoginResponseSchema = z.object({
|
||||
token: z.string(),
|
||||
deviceId: z.string(),
|
||||
userId: z.string(),
|
||||
isDeviceUser: z.boolean().default(true),
|
||||
expiresIn: z.number().default(2592000),
|
||||
user: UserSchema.optional(),
|
||||
});
|
||||
|
||||
export type GuestLoginResponseInput = z.input<typeof GuestLoginResponseSchema>;
|
||||
export type GuestLoginResponseData = z.output<typeof GuestLoginResponseSchema>;
|
||||
@@ -1,18 +0,0 @@
|
||||
/**
|
||||
* @file Automatically generated by barrelsby.
|
||||
*/
|
||||
|
||||
export * from "./apple_login_request";
|
||||
export * from "./facebook_login_request";
|
||||
export * from "./facebook_user_data";
|
||||
export * from "./fb_id_login_request";
|
||||
export * from "./google_login_request";
|
||||
export * from "./guest_login_request";
|
||||
export * from "./guest_login_response";
|
||||
export * from "./login_request";
|
||||
export * from "./login_response";
|
||||
export * from "./logout_response";
|
||||
export * from "./refresh_token_request";
|
||||
export * from "./refresh_token_response";
|
||||
export * from "./register_request";
|
||||
export * from "./send_code_request";
|
||||
@@ -1,16 +0,0 @@
|
||||
/**
|
||||
* 登录请求
|
||||
* 原始 Dart: LoginRequest (lib/data/models/auth/auth_request.dart)
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
export const LoginRequestSchema = z.object({
|
||||
email: z.string().default(""),
|
||||
username: z.string().default(""),
|
||||
password: z.string(),
|
||||
platform: z.string(),
|
||||
guestId: z.string().default(""),
|
||||
});
|
||||
|
||||
export type LoginRequestInput = z.input<typeof LoginRequestSchema>;
|
||||
export type LoginRequestData = z.output<typeof LoginRequestSchema>;
|
||||
@@ -1,15 +0,0 @@
|
||||
/**
|
||||
* 登录响应
|
||||
* 原始 Dart: LoginResponse (lib/data/models/auth/auth_response.dart)
|
||||
*/
|
||||
import { z } from "zod";
|
||||
import { UserSchema } from "../user/user";
|
||||
|
||||
export const LoginResponseSchema = z.object({
|
||||
user: UserSchema,
|
||||
token: z.string(),
|
||||
refreshToken: z.string().default(""),
|
||||
});
|
||||
|
||||
export type LoginResponseInput = z.input<typeof LoginResponseSchema>;
|
||||
export type LoginResponseData = z.output<typeof LoginResponseSchema>;
|
||||
@@ -1,12 +0,0 @@
|
||||
/**
|
||||
* 退出登录响应
|
||||
* 原始 Dart: LogoutResponse (lib/data/models/auth/auth_response.dart)
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
export const LogoutResponseSchema = z.object({
|
||||
success: z.boolean().default(true),
|
||||
});
|
||||
|
||||
export type LogoutResponseInput = z.input<typeof LogoutResponseSchema>;
|
||||
export type LogoutResponseData = z.output<typeof LogoutResponseSchema>;
|
||||
@@ -1,12 +0,0 @@
|
||||
/**
|
||||
* 刷新 Token 请求
|
||||
* 原始 Dart: RefreshTokenRequest (lib/data/models/auth/auth_request.dart)
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
export const RefreshTokenRequestSchema = z.object({
|
||||
refreshToken: z.string(),
|
||||
});
|
||||
|
||||
export type RefreshTokenRequestInput = z.input<typeof RefreshTokenRequestSchema>;
|
||||
export type RefreshTokenRequestData = z.output<typeof RefreshTokenRequestSchema>;
|
||||
@@ -1,14 +0,0 @@
|
||||
/**
|
||||
* 刷新 Token 响应
|
||||
* 原始 Dart: RefreshTokenResponse (lib/data/models/auth/auth_response.dart)
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
export const RefreshTokenResponseSchema = z.object({
|
||||
token: z.string(),
|
||||
refreshToken: z.string(),
|
||||
userId: z.string(),
|
||||
});
|
||||
|
||||
export type RefreshTokenResponseInput = z.input<typeof RefreshTokenResponseSchema>;
|
||||
export type RefreshTokenResponseData = z.output<typeof RefreshTokenResponseSchema>;
|
||||
@@ -1,16 +0,0 @@
|
||||
/**
|
||||
* 注册请求
|
||||
* 原始 Dart: RegisterRequest (lib/data/models/auth/auth_request.dart)
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
export const RegisterRequestSchema = z.object({
|
||||
username: z.string(),
|
||||
email: z.string(),
|
||||
password: z.string(),
|
||||
platform: z.string(),
|
||||
guestId: z.string().default(""),
|
||||
});
|
||||
|
||||
export type RegisterRequestInput = z.input<typeof RegisterRequestSchema>;
|
||||
export type RegisterRequestData = z.output<typeof RegisterRequestSchema>;
|
||||
@@ -1,12 +0,0 @@
|
||||
/**
|
||||
* 发送验证码请求
|
||||
* 原始 Dart: SendCodeRequest (lib/data/models/auth/auth_request.dart)
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
export const SendCodeRequestSchema = z.object({
|
||||
email: z.string(),
|
||||
});
|
||||
|
||||
export type SendCodeRequestInput = z.input<typeof SendCodeRequestSchema>;
|
||||
export type SendCodeRequestData = z.output<typeof SendCodeRequestSchema>;
|
||||
@@ -1,16 +0,0 @@
|
||||
/**
|
||||
* 聊天历史响应
|
||||
* 原始 Dart: ChatHistoryResponse (lib/data/models/chat/chat_response.dart)
|
||||
*/
|
||||
import { z } from "zod";
|
||||
import { ChatMessageSchema } from "./chat_message";
|
||||
|
||||
export const ChatHistoryResponseSchema = z.object({
|
||||
messages: z.array(ChatMessageSchema),
|
||||
total: z.number().default(0),
|
||||
limit: z.number(),
|
||||
offset: z.number(),
|
||||
});
|
||||
|
||||
export type ChatHistoryResponseInput = z.input<typeof ChatHistoryResponseSchema>;
|
||||
export type ChatHistoryResponseData = z.output<typeof ChatHistoryResponseSchema>;
|
||||
@@ -1,15 +0,0 @@
|
||||
/**
|
||||
* 聊天历史中的单条消息
|
||||
* 原始 Dart: ChatMessage (lib/data/models/chat/chat_response.dart)
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
export const ChatMessageSchema = z.object({
|
||||
role: z.string(),
|
||||
content: z.string(),
|
||||
id: z.string().default(""),
|
||||
createdAt: z.string().default(""),
|
||||
});
|
||||
|
||||
export type ChatMessageInput = z.input<typeof ChatMessageSchema>;
|
||||
export type ChatMessageData = z.output<typeof ChatMessageSchema>;
|
||||
@@ -1,22 +0,0 @@
|
||||
/**
|
||||
* 发送消息响应
|
||||
* 原始 Dart: ChatSendResponse (lib/data/models/chat/chat_response.dart)
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
export const ChatSendResponseSchema = z.object({
|
||||
mode: z.string().default(""),
|
||||
reply: z.string(),
|
||||
voiceUrl: z.string().default(""),
|
||||
audioUrl: z.string().default(""),
|
||||
intimacyChange: z.number().default(0),
|
||||
newIntimacy: z.number().default(0),
|
||||
relationshipStage: z.string(),
|
||||
currentMood: z.string().default(""),
|
||||
messageId: z.string(),
|
||||
isGuest: z.boolean().default(false),
|
||||
timestamp: z.number().default(0),
|
||||
});
|
||||
|
||||
export type ChatSendResponseInput = z.input<typeof ChatSendResponseSchema>;
|
||||
export type ChatSendResponseData = z.output<typeof ChatSendResponseSchema>;
|
||||
@@ -1,13 +0,0 @@
|
||||
/**
|
||||
* 消息同步响应
|
||||
* 原始 Dart: ChatSyncData (lib/data/models/chat/chat_sync.dart)
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
export const ChatSyncDataSchema = z.object({
|
||||
syncedCount: z.number(),
|
||||
totalHistory: z.number(),
|
||||
});
|
||||
|
||||
export type ChatSyncDataInput = z.input<typeof ChatSyncDataSchema>;
|
||||
export type ChatSyncDataData = z.output<typeof ChatSyncDataSchema>;
|
||||
@@ -1,13 +0,0 @@
|
||||
/**
|
||||
* 消息同步请求
|
||||
* 原始 Dart: ChatSyncRequest (lib/data/models/chat/chat_sync.dart)
|
||||
*/
|
||||
import { z } from "zod";
|
||||
import { SyncMessageSchema } from "./sync_message";
|
||||
|
||||
export const ChatSyncRequestSchema = z.object({
|
||||
messages: z.array(SyncMessageSchema),
|
||||
});
|
||||
|
||||
export type ChatSyncRequestInput = z.input<typeof ChatSyncRequestSchema>;
|
||||
export type ChatSyncRequestData = z.output<typeof ChatSyncRequestSchema>;
|
||||
@@ -1,13 +0,0 @@
|
||||
/**
|
||||
* 游客每日聊天配额数据
|
||||
* 原始 Dart: GuestChatQuota (lib/data/models/chat/guest_chat_quota.dart)
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
export const GuestChatQuotaSchema = z.object({
|
||||
remaining: z.number(),
|
||||
date: z.string(),
|
||||
});
|
||||
|
||||
export type GuestChatQuotaInput = z.input<typeof GuestChatQuotaSchema>;
|
||||
export type GuestChatQuotaData = z.output<typeof GuestChatQuotaSchema>;
|
||||
@@ -1,19 +0,0 @@
|
||||
/**
|
||||
* 图片上传响应
|
||||
* 原始 Dart: ImageUploadResponse (lib/data/models/chat/image_upload_response.dart)
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
export const ImageUploadResponseSchema = z.object({
|
||||
success: z.boolean().default(true),
|
||||
imageId: z.string(),
|
||||
thumbUrl: z.string(),
|
||||
mediumUrl: z.string(),
|
||||
originalUrl: z.string(),
|
||||
width: z.number(),
|
||||
height: z.number(),
|
||||
bytes: z.number(),
|
||||
});
|
||||
|
||||
export type ImageUploadResponseInput = z.input<typeof ImageUploadResponseSchema>;
|
||||
export type ImageUploadResponseData = z.output<typeof ImageUploadResponseSchema>;
|
||||
@@ -1,14 +0,0 @@
|
||||
/**
|
||||
* @file Automatically generated by barrelsby.
|
||||
*/
|
||||
|
||||
export * from "./chat_history_response";
|
||||
export * from "./chat_message";
|
||||
export * from "./chat_send_response";
|
||||
export * from "./chat_sync_data";
|
||||
export * from "./chat_sync_request";
|
||||
export * from "./guest_chat_quota";
|
||||
export * from "./image_upload_response";
|
||||
export * from "./send_message_request";
|
||||
export * from "./stt_data";
|
||||
export * from "./sync_message";
|
||||
@@ -1,20 +0,0 @@
|
||||
/**
|
||||
* 发送消息请求
|
||||
* 原始 Dart: SendMessageRequest (lib/data/models/chat/send_message_request.dart)
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
export const SendMessageRequestSchema = z.object({
|
||||
message: z.string().default(""),
|
||||
image: z.string().default(""),
|
||||
imageId: z.string().default(""),
|
||||
imageThumbUrl: z.string().default(""),
|
||||
imageMediumUrl: z.string().default(""),
|
||||
imageOriginalUrl: z.string().default(""),
|
||||
imageWidth: z.number().default(0),
|
||||
imageHeight: z.number().default(0),
|
||||
useWebSocket: z.boolean().default(false),
|
||||
});
|
||||
|
||||
export type SendMessageRequestInput = z.input<typeof SendMessageRequestSchema>;
|
||||
export type SendMessageRequestData = z.output<typeof SendMessageRequestSchema>;
|
||||
@@ -1,12 +0,0 @@
|
||||
/**
|
||||
* STT(语音转文字)响应
|
||||
* 原始 Dart: SttData (lib/data/models/chat/stt_response.dart)
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
export const SttDataSchema = z.object({
|
||||
text: z.string(),
|
||||
});
|
||||
|
||||
export type SttDataInput = z.input<typeof SttDataSchema>;
|
||||
export type SttDataData = z.output<typeof SttDataSchema>;
|
||||
@@ -1,14 +0,0 @@
|
||||
/**
|
||||
* 待同步的单条消息
|
||||
* 原始 Dart: SyncMessage (lib/data/models/chat/chat_sync.dart)
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
export const SyncMessageSchema = z.object({
|
||||
role: z.string(),
|
||||
content: z.string(),
|
||||
timestamp: z.string(),
|
||||
});
|
||||
|
||||
export type SyncMessageInput = z.input<typeof SyncMessageSchema>;
|
||||
export type SyncMessageData = z.output<typeof SyncMessageSchema>;
|
||||
@@ -1,38 +0,0 @@
|
||||
/**
|
||||
* @file Automatically generated by barrelsby.
|
||||
*/
|
||||
|
||||
export * from "./auth/apple_login_request";
|
||||
export * from "./auth/facebook_login_request";
|
||||
export * from "./auth/facebook_user_data";
|
||||
export * from "./auth/fb_id_login_request";
|
||||
export * from "./auth/google_login_request";
|
||||
export * from "./auth/guest_login_request";
|
||||
export * from "./auth/guest_login_response";
|
||||
export * from "./auth/login_request";
|
||||
export * from "./auth/login_response";
|
||||
export * from "./auth/logout_response";
|
||||
export * from "./auth/refresh_token_request";
|
||||
export * from "./auth/refresh_token_response";
|
||||
export * from "./auth/register_request";
|
||||
export * from "./auth/send_code_request";
|
||||
export * from "./chat/chat_history_response";
|
||||
export * from "./chat/chat_message";
|
||||
export * from "./chat/chat_send_response";
|
||||
export * from "./chat/chat_sync_data";
|
||||
export * from "./chat/chat_sync_request";
|
||||
export * from "./chat/guest_chat_quota";
|
||||
export * from "./chat/image_upload_response";
|
||||
export * from "./chat/send_message_request";
|
||||
export * from "./chat/stt_data";
|
||||
export * from "./chat/sync_message";
|
||||
export * from "./metrics/app_event";
|
||||
export * from "./metrics/pwa_event";
|
||||
export * from "./user/avatar_data";
|
||||
export * from "./user/credits_data";
|
||||
export * from "./user/credits_history_data";
|
||||
export * from "./user/personality_traits";
|
||||
export * from "./user/recent_memory";
|
||||
export * from "./user/update_profile_request";
|
||||
export * from "./user/user";
|
||||
export * from "./user/user_stats_response";
|
||||
@@ -1,14 +0,0 @@
|
||||
/**
|
||||
* 应用事件上报请求
|
||||
* 原始 Dart: AppEvent (lib/data/models/metrics/app_event.dart)
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
export const AppEventSchema = z.object({
|
||||
userId: z.string(),
|
||||
browser: z.string(),
|
||||
userAgent: z.string(),
|
||||
});
|
||||
|
||||
export type AppEventInput = z.input<typeof AppEventSchema>;
|
||||
export type AppEventData = z.output<typeof AppEventSchema>;
|
||||
@@ -1,6 +0,0 @@
|
||||
/**
|
||||
* @file Automatically generated by barrelsby.
|
||||
*/
|
||||
|
||||
export * from "./app_event";
|
||||
export * from "./pwa_event";
|
||||
@@ -1,16 +0,0 @@
|
||||
/**
|
||||
* PWA 事件上报请求
|
||||
* 原始 Dart: PwaEvent (lib/data/models/metrics/pwa_event.dart)
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
export const PwaEventSchema = z.object({
|
||||
deviceId: z.string(),
|
||||
deviceType: z.string(),
|
||||
timestamp: z.number(),
|
||||
pwaInstalled: z.boolean().default(false),
|
||||
pwaSupported: z.boolean().default(false),
|
||||
});
|
||||
|
||||
export type PwaEventInput = z.input<typeof PwaEventSchema>;
|
||||
export type PwaEventData = z.output<typeof PwaEventSchema>;
|
||||
@@ -1,13 +0,0 @@
|
||||
/**
|
||||
* 头像数据模型
|
||||
* 原始 Dart: AvatarData (lib/data/models/user/user.dart)
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
export const AvatarDataSchema = z.object({
|
||||
avatarUrl: z.string().default(""),
|
||||
userId: z.string(),
|
||||
});
|
||||
|
||||
export type AvatarDataInput = z.input<typeof AvatarDataSchema>;
|
||||
export type AvatarDataData = z.output<typeof AvatarDataSchema>;
|
||||
@@ -1,13 +0,0 @@
|
||||
/**
|
||||
* 积分数据模型
|
||||
* 原始 Dart: CreditsData (lib/data/models/user/user.dart)
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
export const CreditsDataSchema = z.object({
|
||||
userId: z.string(),
|
||||
dolBalance: z.number(),
|
||||
});
|
||||
|
||||
export type CreditsDataInput = z.input<typeof CreditsDataSchema>;
|
||||
export type CreditsDataData = z.output<typeof CreditsDataSchema>;
|
||||
@@ -1,15 +0,0 @@
|
||||
/**
|
||||
* 积分历史记录模型
|
||||
* 原始 Dart: CreditsHistoryData (lib/data/models/user/user.dart)
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
export const CreditsHistoryDataSchema = z.object({
|
||||
records: z.array(z.record(z.string(), z.unknown())),
|
||||
total: z.number(),
|
||||
limit: z.number(),
|
||||
offset: z.number(),
|
||||
});
|
||||
|
||||
export type CreditsHistoryDataInput = z.input<typeof CreditsHistoryDataSchema>;
|
||||
export type CreditsHistoryDataData = z.output<typeof CreditsHistoryDataSchema>;
|
||||
@@ -1,12 +0,0 @@
|
||||
/**
|
||||
* @file Automatically generated by barrelsby.
|
||||
*/
|
||||
|
||||
export * from "./avatar_data";
|
||||
export * from "./credits_data";
|
||||
export * from "./credits_history_data";
|
||||
export * from "./personality_traits";
|
||||
export * from "./recent_memory";
|
||||
export * from "./update_profile_request";
|
||||
export * from "./user";
|
||||
export * from "./user_stats_response";
|
||||
@@ -1,24 +0,0 @@
|
||||
/**
|
||||
* 个性特征模型
|
||||
* 原始 Dart: PersonalityTraits (lib/data/models/user/user.dart)
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
export const PERSONALITY_TRAITS_DEFAULTS = {
|
||||
cheerful: 0.5,
|
||||
caring: 0.5,
|
||||
playful: 0.5,
|
||||
serious: 0.5,
|
||||
romantic: 0.5,
|
||||
} as const;
|
||||
|
||||
export const PersonalityTraitsSchema = z.object({
|
||||
cheerful: z.number().default(0.5),
|
||||
caring: z.number().default(0.5),
|
||||
playful: z.number().default(0.5),
|
||||
serious: z.number().default(0.5),
|
||||
romantic: z.number().default(0.5),
|
||||
});
|
||||
|
||||
export type PersonalityTraitsInput = z.input<typeof PersonalityTraitsSchema>;
|
||||
export type PersonalityTraitsData = z.output<typeof PersonalityTraitsSchema>;
|
||||
@@ -1,15 +0,0 @@
|
||||
/**
|
||||
* 最近记忆模型
|
||||
* 原始 Dart: RecentMemory (lib/data/models/user/recent_memory.dart)
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
export const RecentMemorySchema = z.object({
|
||||
type: z.string(),
|
||||
content: z.string(),
|
||||
importance: z.number(),
|
||||
createdAt: z.string().default(""),
|
||||
});
|
||||
|
||||
export type RecentMemoryInput = z.input<typeof RecentMemorySchema>;
|
||||
export type RecentMemoryData = z.output<typeof RecentMemorySchema>;
|
||||
@@ -1,15 +0,0 @@
|
||||
/**
|
||||
* 更新个人资料请求
|
||||
* 原始 Dart: UpdateProfileRequest (lib/data/models/user/user.dart)
|
||||
*/
|
||||
import { z } from "zod";
|
||||
|
||||
export const UpdateProfileRequestSchema = z.object({
|
||||
username: z.string().default(""),
|
||||
nickname: z.string().default(""),
|
||||
preferredLanguage: z.string().default(""),
|
||||
currentMood: z.string().default(""),
|
||||
});
|
||||
|
||||
export type UpdateProfileRequestInput = z.input<typeof UpdateProfileRequestSchema>;
|
||||
export type UpdateProfileRequestData = z.output<typeof UpdateProfileRequestSchema>;
|
||||
@@ -1,27 +0,0 @@
|
||||
/**
|
||||
* 用户模型
|
||||
* 原始 Dart: User (lib/data/models/user/user.dart)
|
||||
*/
|
||||
import { z } from "zod";
|
||||
import { PersonalityTraitsSchema, PERSONALITY_TRAITS_DEFAULTS } from "./personality_traits";
|
||||
|
||||
export const UserSchema = z.object({
|
||||
id: z.string(),
|
||||
username: z.string(),
|
||||
email: z.string().default(""),
|
||||
platform: z.string().default("web"),
|
||||
intimacy: z.number().default(0),
|
||||
dolBalance: z.number().default(0),
|
||||
relationshipStage: z.string().default("密友"),
|
||||
currentMood: z.string().default("happy"),
|
||||
personalityTraits: PersonalityTraitsSchema.default(PERSONALITY_TRAITS_DEFAULTS),
|
||||
preferredLanguage: z.string().default(""),
|
||||
createdAt: z.string().default(""),
|
||||
lastMessageAt: z.string().default(""),
|
||||
avatarUrl: z.string().default(""),
|
||||
loginProvider: z.string().default("email"),
|
||||
isGuest: z.boolean().default(false),
|
||||
});
|
||||
|
||||
export type UserInput = z.input<typeof UserSchema>;
|
||||
export type UserData = z.output<typeof UserSchema>;
|
||||
@@ -1,29 +0,0 @@
|
||||
/**
|
||||
* 用户统计响应
|
||||
* 原始 Dart: UserStatsResponse (lib/data/models/user/user_stats_response.dart)
|
||||
*/
|
||||
import { z } from "zod";
|
||||
import { PersonalityTraitsSchema, PERSONALITY_TRAITS_DEFAULTS } from "./personality_traits";
|
||||
import { RecentMemorySchema } from "./recent_memory";
|
||||
|
||||
export const UserStatsResponseSchema = z.object({
|
||||
userId: z.string(),
|
||||
username: z.string(),
|
||||
platform: z.string(),
|
||||
intimacy: z.number(),
|
||||
relationshipStage: z.string(),
|
||||
dolBalance: z.number(),
|
||||
totalMessages: z.number(),
|
||||
lastMessageAt: z.string().default(""),
|
||||
accountCreatedAt: z.string().default(""),
|
||||
currentMood: z.string().default(""),
|
||||
personalityTraits: PersonalityTraitsSchema.default(PERSONALITY_TRAITS_DEFAULTS),
|
||||
recentMemories: z.array(RecentMemorySchema).default([]),
|
||||
promptTokensTotal: z.number().default(0),
|
||||
completionTokensTotal: z.number().default(0),
|
||||
cacheHitTokensTotal: z.number().default(0),
|
||||
tokensTotal: z.number().default(0),
|
||||
});
|
||||
|
||||
export type UserStatsResponseInput = z.input<typeof UserStatsResponseSchema>;
|
||||
export type UserStatsResponseData = z.output<typeof UserStatsResponseSchema>;
|
||||
Reference in New Issue
Block a user