refactor(data): move dto and schemas out of services directory
This commit is contained in:
@@ -21,7 +21,7 @@ import { RefreshTokenResponse } from "@/data/dto/auth/refresh_token_response";
|
||||
import { RegisterRequest } from "@/data/dto/auth/register_request";
|
||||
import { SendCodeRequest } from "@/data/dto/auth/send_code_request";
|
||||
import { User } from "@/data/dto/user/user";
|
||||
import type { UserData } from "@/data/services/schemas/user/user";
|
||||
import type { UserData } from "@/data/schemas/user/user";
|
||||
|
||||
export class AuthApi {
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* @file Automatically generated by barrelsby.
|
||||
*/
|
||||
|
||||
export * from "./api_path";
|
||||
export * from "./api_result";
|
||||
export * from "./auth_api";
|
||||
export * from "./chat_api";
|
||||
export * from "./http_client";
|
||||
export * from "./metrics_api";
|
||||
export * from "./response_helper";
|
||||
export * from "./user_api";
|
||||
export * from "./config/api_config";
|
||||
export * from "./interceptor/auth_refresh_interceptor";
|
||||
export * from "./interceptor/logging_interceptor";
|
||||
export * from "./interceptor/token_interceptor";
|
||||
@@ -12,7 +12,7 @@ import { CreditsHistoryData } from "@/data/dto/user/credits_history_data";
|
||||
import { UpdateProfileRequest } from "@/data/dto/user/update_profile_request";
|
||||
import { User } from "@/data/dto/user/user";
|
||||
import { UserStatsResponse } from "@/data/dto/user/user_stats_response";
|
||||
import type { UserData } from "@/data/services/schemas/user/user";
|
||||
import type { UserData } from "@/data/schemas/user/user";
|
||||
|
||||
export class UserApi {
|
||||
/**
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
/**
|
||||
* Apple 登录请求 DTO
|
||||
*/
|
||||
import {
|
||||
AppleLoginRequestSchema,
|
||||
type AppleLoginRequestInput,
|
||||
type AppleLoginRequestData,
|
||||
} from "@/data/services/schemas/auth/apple_login_request";
|
||||
|
||||
export class AppleLoginRequest {
|
||||
declare readonly identityToken: string;
|
||||
declare readonly platform: string;
|
||||
|
||||
private constructor(input: AppleLoginRequestInput) {
|
||||
const data = AppleLoginRequestSchema.parse(input);
|
||||
Object.assign(this, data);
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
static from(input: AppleLoginRequestInput): AppleLoginRequest {
|
||||
return new AppleLoginRequest(input);
|
||||
}
|
||||
|
||||
static fromJson(json: unknown): AppleLoginRequest {
|
||||
return AppleLoginRequest.from(json as AppleLoginRequestInput);
|
||||
}
|
||||
|
||||
toJson(): AppleLoginRequestData {
|
||||
return AppleLoginRequestSchema.parse(this);
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/**
|
||||
* Facebook 登录请求 DTO
|
||||
*/
|
||||
import {
|
||||
FacebookLoginRequestSchema,
|
||||
type FacebookLoginRequestInput,
|
||||
type FacebookLoginRequestData,
|
||||
} from "@/data/services/schemas/auth/facebook_login_request";
|
||||
|
||||
export class FacebookLoginRequest {
|
||||
declare readonly accessToken: string;
|
||||
declare readonly platform: string;
|
||||
declare readonly guestId: string;
|
||||
|
||||
private constructor(input: FacebookLoginRequestInput) {
|
||||
const data = FacebookLoginRequestSchema.parse(input);
|
||||
Object.assign(this, data);
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
static from(input: FacebookLoginRequestInput): FacebookLoginRequest {
|
||||
return new FacebookLoginRequest(input);
|
||||
}
|
||||
|
||||
static fromJson(json: unknown): FacebookLoginRequest {
|
||||
return FacebookLoginRequest.from(json as FacebookLoginRequestInput);
|
||||
}
|
||||
|
||||
toJson(): FacebookLoginRequestData {
|
||||
return FacebookLoginRequestSchema.parse(this);
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
/**
|
||||
* Facebook 用户数据 DTO
|
||||
*
|
||||
* 原始 Dart: FacebookUserData (lib/data/services/auth/auth_platform.dart)
|
||||
*/
|
||||
import {
|
||||
FacebookUserDataSchema,
|
||||
type FacebookUserDataInput,
|
||||
type FacebookUserDataData,
|
||||
} from "@/data/services/schemas/auth/facebook_user_data";
|
||||
|
||||
export class FacebookUserData {
|
||||
declare readonly id: string | null;
|
||||
declare readonly name: string | null;
|
||||
declare readonly email: string | null;
|
||||
declare readonly pictureUrl: string | null;
|
||||
|
||||
private constructor(input: FacebookUserDataInput) {
|
||||
const data = FacebookUserDataSchema.parse(input);
|
||||
Object.assign(this, data);
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
static from(input: FacebookUserDataInput): FacebookUserData {
|
||||
return new FacebookUserData(input);
|
||||
}
|
||||
|
||||
static fromJson(json: unknown): FacebookUserData {
|
||||
return FacebookUserData.from(json as FacebookUserDataInput);
|
||||
}
|
||||
|
||||
toJson(): FacebookUserDataData {
|
||||
return FacebookUserDataSchema.parse(this);
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/**
|
||||
* Facebook ID 登录请求 DTO
|
||||
*/
|
||||
import {
|
||||
FbIdLoginRequestSchema,
|
||||
type FbIdLoginRequestInput,
|
||||
type FbIdLoginRequestData,
|
||||
} from "@/data/services/schemas/auth/fb_id_login_request";
|
||||
|
||||
export class FbIdLoginRequest {
|
||||
declare readonly fbId: string;
|
||||
declare readonly avatarUrl: string;
|
||||
|
||||
private constructor(input: FbIdLoginRequestInput) {
|
||||
const data = FbIdLoginRequestSchema.parse(input);
|
||||
Object.assign(this, data);
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
static from(input: FbIdLoginRequestInput): FbIdLoginRequest {
|
||||
return new FbIdLoginRequest(input);
|
||||
}
|
||||
|
||||
static fromJson(json: unknown): FbIdLoginRequest {
|
||||
return FbIdLoginRequest.from(json as FbIdLoginRequestInput);
|
||||
}
|
||||
|
||||
toJson(): FbIdLoginRequestData {
|
||||
return FbIdLoginRequestSchema.parse(this);
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/**
|
||||
* Google 登录请求 DTO
|
||||
*/
|
||||
import {
|
||||
GoogleLoginRequestSchema,
|
||||
type GoogleLoginRequestInput,
|
||||
type GoogleLoginRequestData,
|
||||
} from "@/data/services/schemas/auth/google_login_request";
|
||||
|
||||
export class GoogleLoginRequest {
|
||||
declare readonly idToken: string;
|
||||
declare readonly platform: string;
|
||||
declare readonly guestId: string;
|
||||
|
||||
private constructor(input: GoogleLoginRequestInput) {
|
||||
const data = GoogleLoginRequestSchema.parse(input);
|
||||
Object.assign(this, data);
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
static from(input: GoogleLoginRequestInput): GoogleLoginRequest {
|
||||
return new GoogleLoginRequest(input);
|
||||
}
|
||||
|
||||
static fromJson(json: unknown): GoogleLoginRequest {
|
||||
return GoogleLoginRequest.from(json as GoogleLoginRequestInput);
|
||||
}
|
||||
|
||||
toJson(): GoogleLoginRequestData {
|
||||
return GoogleLoginRequestSchema.parse(this);
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/**
|
||||
* 游客登录请求 DTO
|
||||
*/
|
||||
import {
|
||||
GuestLoginRequestSchema,
|
||||
type GuestLoginRequestInput,
|
||||
type GuestLoginRequestData,
|
||||
} from "@/data/services/schemas/auth/guest_login_request";
|
||||
|
||||
export class GuestLoginRequest {
|
||||
declare readonly deviceId: string;
|
||||
|
||||
private constructor(input: GuestLoginRequestInput) {
|
||||
const data = GuestLoginRequestSchema.parse(input);
|
||||
Object.assign(this, data);
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
static from(input: GuestLoginRequestInput): GuestLoginRequest {
|
||||
return new GuestLoginRequest(input);
|
||||
}
|
||||
|
||||
static fromJson(json: unknown): GuestLoginRequest {
|
||||
return GuestLoginRequest.from(json as GuestLoginRequestInput);
|
||||
}
|
||||
|
||||
toJson(): GuestLoginRequestData {
|
||||
return GuestLoginRequestSchema.parse(this);
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/**
|
||||
* 游客登录响应 DTO
|
||||
*/
|
||||
import {
|
||||
GuestLoginResponseSchema,
|
||||
type GuestLoginResponseInput,
|
||||
type GuestLoginResponseData,
|
||||
} from "@/data/services/schemas/auth/guest_login_response";
|
||||
import { User } from "@/data/dto/user/user";
|
||||
|
||||
export class GuestLoginResponse {
|
||||
declare readonly token: string;
|
||||
declare readonly deviceId: string;
|
||||
declare readonly userId: string;
|
||||
declare readonly isDeviceUser: boolean;
|
||||
declare readonly expiresIn: number;
|
||||
declare readonly user: User;
|
||||
|
||||
private constructor(input: GuestLoginResponseInput) {
|
||||
const parsed = GuestLoginResponseSchema.parse(input);
|
||||
Object.assign(this, {
|
||||
...parsed,
|
||||
user: parsed.user ? User.fromJson(parsed.user) : User.empty(),
|
||||
});
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
static from(input: GuestLoginResponseInput): GuestLoginResponse {
|
||||
return new GuestLoginResponse(input);
|
||||
}
|
||||
|
||||
static fromJson(json: unknown): GuestLoginResponse {
|
||||
return GuestLoginResponse.from(json as GuestLoginResponseInput);
|
||||
}
|
||||
|
||||
toJson(): GuestLoginResponseData {
|
||||
const data = GuestLoginResponseSchema.parse(this);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/**
|
||||
* 登录请求 DTO
|
||||
*/
|
||||
import {
|
||||
LoginRequestSchema,
|
||||
type LoginRequestInput,
|
||||
type LoginRequestData,
|
||||
} from "@/data/services/schemas/auth/login_request";
|
||||
|
||||
export class LoginRequest {
|
||||
declare readonly email: string;
|
||||
declare readonly username: string;
|
||||
declare readonly password: string;
|
||||
declare readonly platform: string;
|
||||
declare readonly guestId: string;
|
||||
|
||||
private constructor(input: LoginRequestInput) {
|
||||
const data = LoginRequestSchema.parse(input);
|
||||
Object.assign(this, data);
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
static from(input: LoginRequestInput): LoginRequest {
|
||||
return new LoginRequest(input);
|
||||
}
|
||||
|
||||
static fromJson(json: unknown): LoginRequest {
|
||||
return LoginRequest.from(json as LoginRequestInput);
|
||||
}
|
||||
|
||||
toJson(): LoginRequestData {
|
||||
return LoginRequestSchema.parse(this);
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/**
|
||||
* 登录响应 DTO
|
||||
*/
|
||||
import {
|
||||
LoginResponseSchema,
|
||||
type LoginResponseInput,
|
||||
type LoginResponseData,
|
||||
} from "@/data/services/schemas/auth/login_response";
|
||||
import { User } from "@/data/dto/user/user";
|
||||
|
||||
export class LoginResponse {
|
||||
declare readonly user: User;
|
||||
declare readonly token: string;
|
||||
declare readonly refreshToken: string;
|
||||
|
||||
private constructor(input: LoginResponseInput) {
|
||||
const data = LoginResponseSchema.parse(input);
|
||||
Object.assign(this, {
|
||||
...data,
|
||||
user: User.fromJson(data.user),
|
||||
});
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
static from(input: LoginResponseInput): LoginResponse {
|
||||
return new LoginResponse(input);
|
||||
}
|
||||
|
||||
static fromJson(json: unknown): LoginResponse {
|
||||
return LoginResponse.from(json as LoginResponseInput);
|
||||
}
|
||||
|
||||
toJson(): LoginResponseData {
|
||||
return LoginResponseSchema.parse(this);
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/**
|
||||
* 退出登录响应 DTO
|
||||
*/
|
||||
import {
|
||||
LogoutResponseSchema,
|
||||
type LogoutResponseInput,
|
||||
type LogoutResponseData,
|
||||
} from "@/data/services/schemas/auth/logout_response";
|
||||
|
||||
export class LogoutResponse {
|
||||
declare readonly success: boolean;
|
||||
|
||||
private constructor(input: LogoutResponseInput) {
|
||||
const data = LogoutResponseSchema.parse(input);
|
||||
Object.assign(this, data);
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
static from(input: LogoutResponseInput): LogoutResponse {
|
||||
return new LogoutResponse(input);
|
||||
}
|
||||
|
||||
static fromJson(json: unknown): LogoutResponse {
|
||||
return LogoutResponse.from(json as LogoutResponseInput);
|
||||
}
|
||||
|
||||
toJson(): LogoutResponseData {
|
||||
return LogoutResponseSchema.parse(this);
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/**
|
||||
* 刷新 Token 请求 DTO
|
||||
*/
|
||||
import {
|
||||
RefreshTokenRequestSchema,
|
||||
type RefreshTokenRequestInput,
|
||||
type RefreshTokenRequestData,
|
||||
} from "@/data/services/schemas/auth/refresh_token_request";
|
||||
|
||||
export class RefreshTokenRequest {
|
||||
declare readonly refreshToken: string;
|
||||
|
||||
private constructor(input: RefreshTokenRequestInput) {
|
||||
const data = RefreshTokenRequestSchema.parse(input);
|
||||
Object.assign(this, data);
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
static from(input: RefreshTokenRequestInput): RefreshTokenRequest {
|
||||
return new RefreshTokenRequest(input);
|
||||
}
|
||||
|
||||
static fromJson(json: unknown): RefreshTokenRequest {
|
||||
return RefreshTokenRequest.from(json as RefreshTokenRequestInput);
|
||||
}
|
||||
|
||||
toJson(): RefreshTokenRequestData {
|
||||
return RefreshTokenRequestSchema.parse(this);
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/**
|
||||
* 刷新 Token 响应 DTO
|
||||
*/
|
||||
import {
|
||||
RefreshTokenResponseSchema,
|
||||
type RefreshTokenResponseInput,
|
||||
type RefreshTokenResponseData,
|
||||
} from "@/data/services/schemas/auth/refresh_token_response";
|
||||
|
||||
export class RefreshTokenResponse {
|
||||
declare readonly token: string;
|
||||
declare readonly refreshToken: string;
|
||||
declare readonly userId: string;
|
||||
|
||||
private constructor(input: RefreshTokenResponseInput) {
|
||||
const data = RefreshTokenResponseSchema.parse(input);
|
||||
Object.assign(this, data);
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
static from(input: RefreshTokenResponseInput): RefreshTokenResponse {
|
||||
return new RefreshTokenResponse(input);
|
||||
}
|
||||
|
||||
static fromJson(json: unknown): RefreshTokenResponse {
|
||||
return RefreshTokenResponse.from(json as RefreshTokenResponseInput);
|
||||
}
|
||||
|
||||
toJson(): RefreshTokenResponseData {
|
||||
return RefreshTokenResponseSchema.parse(this);
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/**
|
||||
* 注册请求 DTO
|
||||
*/
|
||||
import {
|
||||
RegisterRequestSchema,
|
||||
type RegisterRequestInput,
|
||||
type RegisterRequestData,
|
||||
} from "@/data/services/schemas/auth/register_request";
|
||||
|
||||
export class RegisterRequest {
|
||||
declare readonly username: string;
|
||||
declare readonly email: string;
|
||||
declare readonly password: string;
|
||||
declare readonly platform: string;
|
||||
declare readonly guestId: string;
|
||||
|
||||
private constructor(input: RegisterRequestInput) {
|
||||
const data = RegisterRequestSchema.parse(input);
|
||||
Object.assign(this, data);
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
static from(input: RegisterRequestInput): RegisterRequest {
|
||||
return new RegisterRequest(input);
|
||||
}
|
||||
|
||||
static fromJson(json: unknown): RegisterRequest {
|
||||
return RegisterRequest.from(json as RegisterRequestInput);
|
||||
}
|
||||
|
||||
toJson(): RegisterRequestData {
|
||||
return RegisterRequestSchema.parse(this);
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/**
|
||||
* 发送验证码请求 DTO
|
||||
*/
|
||||
import {
|
||||
SendCodeRequestSchema,
|
||||
type SendCodeRequestInput,
|
||||
type SendCodeRequestData,
|
||||
} from "@/data/services/schemas/auth/send_code_request";
|
||||
|
||||
export class SendCodeRequest {
|
||||
declare readonly email: string;
|
||||
|
||||
private constructor(input: SendCodeRequestInput) {
|
||||
const data = SendCodeRequestSchema.parse(input);
|
||||
Object.assign(this, data);
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
static from(input: SendCodeRequestInput): SendCodeRequest {
|
||||
return new SendCodeRequest(input);
|
||||
}
|
||||
|
||||
static fromJson(json: unknown): SendCodeRequest {
|
||||
return SendCodeRequest.from(json as SendCodeRequestInput);
|
||||
}
|
||||
|
||||
toJson(): SendCodeRequestData {
|
||||
return SendCodeRequestSchema.parse(this);
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
/**
|
||||
* 聊天历史响应 DTO
|
||||
*/
|
||||
import {
|
||||
ChatHistoryResponseSchema,
|
||||
type ChatHistoryResponseInput,
|
||||
type ChatHistoryResponseData,
|
||||
} from "@/data/services/schemas/chat/chat_history_response";
|
||||
import { ChatMessage } from "./chat_message";
|
||||
|
||||
export class ChatHistoryResponse {
|
||||
declare readonly messages: ChatMessage[];
|
||||
declare readonly total: number;
|
||||
declare readonly limit: number;
|
||||
declare readonly offset: number;
|
||||
|
||||
private constructor(input: ChatHistoryResponseInput) {
|
||||
const data = ChatHistoryResponseSchema.parse(input);
|
||||
Object.assign(this, {
|
||||
...data,
|
||||
messages: data.messages.map((m) => ChatMessage.from(m)),
|
||||
});
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
static from(input: ChatHistoryResponseInput): ChatHistoryResponse {
|
||||
return new ChatHistoryResponse(input);
|
||||
}
|
||||
|
||||
static fromJson(json: unknown): ChatHistoryResponse {
|
||||
return ChatHistoryResponse.from(json as ChatHistoryResponseInput);
|
||||
}
|
||||
|
||||
toJson(): ChatHistoryResponseData {
|
||||
return ChatHistoryResponseSchema.parse(this);
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/**
|
||||
* 聊天历史中的单条消息 DTO
|
||||
*/
|
||||
import {
|
||||
ChatMessageSchema,
|
||||
type ChatMessageInput,
|
||||
type ChatMessageData,
|
||||
} from "@/data/services/schemas/chat/chat_message";
|
||||
|
||||
export class ChatMessage {
|
||||
declare readonly role: string;
|
||||
declare readonly content: string;
|
||||
declare readonly id: string;
|
||||
declare readonly createdAt: string;
|
||||
|
||||
private constructor(input: ChatMessageInput) {
|
||||
const data = ChatMessageSchema.parse(input);
|
||||
Object.assign(this, data);
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
static from(input: ChatMessageInput): ChatMessage {
|
||||
return new ChatMessage(input);
|
||||
}
|
||||
|
||||
static fromJson(json: unknown): ChatMessage {
|
||||
return ChatMessage.from(json as ChatMessageInput);
|
||||
}
|
||||
|
||||
toJson(): ChatMessageData {
|
||||
return ChatMessageSchema.parse(this);
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/**
|
||||
* 发送消息响应 DTO
|
||||
*/
|
||||
import {
|
||||
ChatSendResponseSchema,
|
||||
type ChatSendResponseInput,
|
||||
type ChatSendResponseData,
|
||||
} from "@/data/services/schemas/chat/chat_send_response";
|
||||
|
||||
export class ChatSendResponse {
|
||||
declare readonly mode: string;
|
||||
declare readonly reply: string;
|
||||
declare readonly voiceUrl: string;
|
||||
declare readonly audioUrl: string;
|
||||
declare readonly intimidadChange: number;
|
||||
declare readonly newIntimacy: number;
|
||||
declare readonly relationshipStage: string;
|
||||
declare readonly currentMood: string;
|
||||
declare readonly messageId: string;
|
||||
declare readonly isGuest: boolean;
|
||||
declare readonly timestamp: number;
|
||||
|
||||
private constructor(input: ChatSendResponseInput) {
|
||||
const data = ChatSendResponseSchema.parse(input);
|
||||
Object.assign(this, data);
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
static from(input: ChatSendResponseInput): ChatSendResponse {
|
||||
return new ChatSendResponse(input);
|
||||
}
|
||||
|
||||
static fromJson(json: unknown): ChatSendResponse {
|
||||
return ChatSendResponse.from(json as ChatSendResponseInput);
|
||||
}
|
||||
|
||||
toJson(): ChatSendResponseData {
|
||||
return ChatSendResponseSchema.parse(this);
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/**
|
||||
* 消息同步响应 DTO
|
||||
*/
|
||||
import {
|
||||
ChatSyncDataSchema,
|
||||
type ChatSyncDataInput,
|
||||
type ChatSyncDataData,
|
||||
} from "@/data/services/schemas/chat/chat_sync_data";
|
||||
|
||||
export class ChatSyncData {
|
||||
declare readonly syncedCount: number;
|
||||
declare readonly totalHistory: number;
|
||||
|
||||
private constructor(input: ChatSyncDataInput) {
|
||||
const data = ChatSyncDataSchema.parse(input);
|
||||
Object.assign(this, data);
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
static from(input: ChatSyncDataInput): ChatSyncData {
|
||||
return new ChatSyncData(input);
|
||||
}
|
||||
|
||||
static fromJson(json: unknown): ChatSyncData {
|
||||
return ChatSyncData.from(json as ChatSyncDataInput);
|
||||
}
|
||||
|
||||
toJson(): ChatSyncDataData {
|
||||
return ChatSyncDataSchema.parse(this);
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/**
|
||||
* 消息同步请求 DTO
|
||||
*/
|
||||
import {
|
||||
ChatSyncRequestSchema,
|
||||
type ChatSyncRequestInput,
|
||||
type ChatSyncRequestData,
|
||||
} from "@/data/services/schemas/chat/chat_sync_request";
|
||||
import { SyncMessage } from "./sync_message";
|
||||
|
||||
export class ChatSyncRequest {
|
||||
declare readonly messages: SyncMessage[];
|
||||
|
||||
private constructor(input: ChatSyncRequestInput) {
|
||||
const data = ChatSyncRequestSchema.parse(input);
|
||||
Object.assign(this, {
|
||||
...data,
|
||||
messages: data.messages.map((m) => SyncMessage.from(m)),
|
||||
});
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
static from(input: ChatSyncRequestInput): ChatSyncRequest {
|
||||
return new ChatSyncRequest(input);
|
||||
}
|
||||
|
||||
static fromJson(json: unknown): ChatSyncRequest {
|
||||
return ChatSyncRequest.from(json as ChatSyncRequestInput);
|
||||
}
|
||||
|
||||
toJson(): ChatSyncRequestData {
|
||||
return ChatSyncRequestSchema.parse(this);
|
||||
}
|
||||
}
|
||||
@@ -1,98 +0,0 @@
|
||||
/**
|
||||
* 游客每日聊天配额数据 DTO
|
||||
*/
|
||||
import {
|
||||
GuestChatQuotaSchema,
|
||||
type GuestChatQuotaInput,
|
||||
type GuestChatQuotaData,
|
||||
} from "@/data/services/schemas/chat/guest_chat_quota";
|
||||
|
||||
export class GuestChatQuota {
|
||||
// 静态常量
|
||||
static readonly maxQuotaPerDay = 40;
|
||||
static readonly maxQuotaPerDayTest = 4;
|
||||
static readonly quotaWarningThreshold = 20;
|
||||
static readonly quotaWarningThresholdTest = 2;
|
||||
static readonly defaultTotalQuota = 50;
|
||||
static readonly defaultTotalQuotaDev = 5;
|
||||
static readonly quotaExhausted = 0;
|
||||
|
||||
declare readonly remaining: number;
|
||||
declare readonly date: string;
|
||||
|
||||
private constructor(input: GuestChatQuotaInput) {
|
||||
const data = GuestChatQuotaSchema.parse(input);
|
||||
Object.assign(this, data);
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
static from(input: GuestChatQuotaInput): GuestChatQuota {
|
||||
return new GuestChatQuota(input);
|
||||
}
|
||||
|
||||
static fromJson(json: unknown): GuestChatQuota {
|
||||
return GuestChatQuota.from(json as GuestChatQuotaInput);
|
||||
}
|
||||
|
||||
/**
|
||||
* 配额耗尽状态值
|
||||
*/
|
||||
static get exhausted(): number {
|
||||
return GuestChatQuota.quotaExhausted;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否处于开发环境
|
||||
*/
|
||||
static get isDevelopment(): boolean {
|
||||
return process.env.NODE_ENV !== "production";
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前环境的配额警告阈值
|
||||
*/
|
||||
static get warningThreshold(): number {
|
||||
return GuestChatQuota.isDevelopment
|
||||
? GuestChatQuota.quotaWarningThresholdTest
|
||||
: GuestChatQuota.quotaWarningThreshold;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前环境的每日最大配额
|
||||
*/
|
||||
static get threshold(): number {
|
||||
return GuestChatQuota.isDevelopment
|
||||
? GuestChatQuota.maxQuotaPerDayTest
|
||||
: GuestChatQuota.maxQuotaPerDay;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前环境的总配额默认值
|
||||
*/
|
||||
static get totalQuotaDefault(): number {
|
||||
return GuestChatQuota.isDevelopment
|
||||
? GuestChatQuota.defaultTotalQuotaDev
|
||||
: GuestChatQuota.defaultTotalQuota;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建初始配额实例
|
||||
*/
|
||||
static initial(todayString: string): GuestChatQuota {
|
||||
return new GuestChatQuota({
|
||||
remaining: GuestChatQuota.threshold,
|
||||
date: todayString,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否需要重置(跨天)
|
||||
*/
|
||||
needsReset(todayString: string): boolean {
|
||||
return this.date !== todayString;
|
||||
}
|
||||
|
||||
toJson(): GuestChatQuotaData {
|
||||
return GuestChatQuotaSchema.parse(this);
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
/**
|
||||
* 图片上传响应 DTO
|
||||
*/
|
||||
import {
|
||||
ImageUploadResponseSchema,
|
||||
type ImageUploadResponseInput,
|
||||
type ImageUploadResponseData,
|
||||
} from "@/data/services/schemas/chat/image_upload_response";
|
||||
|
||||
export class ImageUploadResponse {
|
||||
declare readonly success: boolean;
|
||||
declare readonly imageId: string;
|
||||
declare readonly thumbUrl: string;
|
||||
declare readonly mediumUrl: string;
|
||||
declare readonly originalUrl: string;
|
||||
declare readonly width: number;
|
||||
declare readonly height: number;
|
||||
declare readonly bytes: number;
|
||||
|
||||
private constructor(input: ImageUploadResponseInput) {
|
||||
const data = ImageUploadResponseSchema.parse(input);
|
||||
Object.assign(this, data);
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
static from(input: ImageUploadResponseInput): ImageUploadResponse {
|
||||
return new ImageUploadResponse(input);
|
||||
}
|
||||
|
||||
static fromJson(json: unknown): ImageUploadResponse {
|
||||
return ImageUploadResponse.from(json as ImageUploadResponseInput);
|
||||
}
|
||||
|
||||
toJson(): ImageUploadResponseData {
|
||||
return ImageUploadResponseSchema.parse(this);
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
/**
|
||||
* 发送消息请求 DTO
|
||||
*/
|
||||
import {
|
||||
SendMessageRequestSchema,
|
||||
type SendMessageRequestInput,
|
||||
type SendMessageRequestData,
|
||||
} from "@/data/services/schemas/chat/send_message_request";
|
||||
|
||||
export class SendMessageRequest {
|
||||
declare readonly message: string;
|
||||
declare readonly image: string;
|
||||
declare readonly imageId: string;
|
||||
declare readonly imageThumbUrl: string;
|
||||
declare readonly imageMediumUrl: string;
|
||||
declare readonly imageOriginalUrl: string;
|
||||
declare readonly imageWidth: number;
|
||||
declare readonly imageHeight: number;
|
||||
declare readonly useWebSocket: boolean;
|
||||
|
||||
private constructor(input: SendMessageRequestInput) {
|
||||
const data = SendMessageRequestSchema.parse(input);
|
||||
Object.assign(this, data);
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
static from(input: SendMessageRequestInput): SendMessageRequest {
|
||||
return new SendMessageRequest(input);
|
||||
}
|
||||
|
||||
static fromJson(json: unknown): SendMessageRequest {
|
||||
return SendMessageRequest.from(json as SendMessageRequestInput);
|
||||
}
|
||||
|
||||
toJson(): SendMessageRequestData {
|
||||
return SendMessageRequestSchema.parse(this);
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/**
|
||||
* STT(语音转文字)响应 DTO
|
||||
*/
|
||||
import {
|
||||
SttDataSchema,
|
||||
type SttDataInput,
|
||||
type SttDataData,
|
||||
} from "@/data/services/schemas/chat/stt_data";
|
||||
|
||||
export class SttData {
|
||||
declare readonly text: string;
|
||||
|
||||
private constructor(input: SttDataInput) {
|
||||
const data = SttDataSchema.parse(input);
|
||||
Object.assign(this, data);
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
static from(input: SttDataInput): SttData {
|
||||
return new SttData(input);
|
||||
}
|
||||
|
||||
static fromJson(json: unknown): SttData {
|
||||
return SttData.from(json as SttDataInput);
|
||||
}
|
||||
|
||||
toJson(): SttDataData {
|
||||
return SttDataSchema.parse(this);
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/**
|
||||
* 待同步的单条消息 DTO
|
||||
*/
|
||||
import {
|
||||
SyncMessageSchema,
|
||||
type SyncMessageInput,
|
||||
type SyncMessageData,
|
||||
} from "@/data/services/schemas/chat/sync_message";
|
||||
|
||||
export class SyncMessage {
|
||||
declare readonly role: string;
|
||||
declare readonly content: string;
|
||||
declare readonly timestamp: string;
|
||||
|
||||
private constructor(input: SyncMessageInput) {
|
||||
const data = SyncMessageSchema.parse(input);
|
||||
Object.assign(this, data);
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
static from(input: SyncMessageInput): SyncMessage {
|
||||
return new SyncMessage(input);
|
||||
}
|
||||
|
||||
static fromJson(json: unknown): SyncMessage {
|
||||
return SyncMessage.from(json as SyncMessageInput);
|
||||
}
|
||||
|
||||
toJson(): SyncMessageData {
|
||||
return SyncMessageSchema.parse(this);
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/**
|
||||
* 应用事件上报请求 DTO
|
||||
*/
|
||||
import {
|
||||
AppEventSchema,
|
||||
type AppEventInput,
|
||||
type AppEventData,
|
||||
} from "@/data/services/schemas/metrics/app_event";
|
||||
|
||||
export class AppEvent {
|
||||
declare readonly userId: string;
|
||||
declare readonly browser: string;
|
||||
declare readonly userAgent: string;
|
||||
|
||||
private constructor(input: AppEventInput) {
|
||||
const data = AppEventSchema.parse(input);
|
||||
Object.assign(this, data);
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
static from(input: AppEventInput): AppEvent {
|
||||
return new AppEvent(input);
|
||||
}
|
||||
|
||||
static fromJson(json: unknown): AppEvent {
|
||||
return AppEvent.from(json as AppEventInput);
|
||||
}
|
||||
|
||||
toJson(): AppEventData {
|
||||
return AppEventSchema.parse(this);
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/**
|
||||
* PWA 事件上报请求 DTO
|
||||
*/
|
||||
import {
|
||||
PwaEventSchema,
|
||||
type PwaEventInput,
|
||||
type PwaEventData,
|
||||
} from "@/data/services/schemas/metrics/pwa_event";
|
||||
|
||||
export class PwaEvent {
|
||||
declare readonly deviceId: string;
|
||||
declare readonly deviceType: string;
|
||||
declare readonly timestamp: number;
|
||||
declare readonly pwaInstalled: boolean;
|
||||
declare readonly pwaSupported: boolean;
|
||||
|
||||
private constructor(input: PwaEventInput) {
|
||||
const data = PwaEventSchema.parse(input);
|
||||
Object.assign(this, data);
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
static from(input: PwaEventInput): PwaEvent {
|
||||
return new PwaEvent(input);
|
||||
}
|
||||
|
||||
static fromJson(json: unknown): PwaEvent {
|
||||
return PwaEvent.from(json as PwaEventInput);
|
||||
}
|
||||
|
||||
toJson(): PwaEventData {
|
||||
return PwaEventSchema.parse(this);
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/**
|
||||
* 头像数据 DTO
|
||||
*/
|
||||
import {
|
||||
AvatarDataSchema,
|
||||
type AvatarDataInput,
|
||||
type AvatarDataData,
|
||||
} from "@/data/services/schemas/user/avatar_data";
|
||||
|
||||
export class AvatarData {
|
||||
declare readonly avatarUrl: string;
|
||||
declare readonly userId: string;
|
||||
|
||||
private constructor(input: AvatarDataInput) {
|
||||
const data = AvatarDataSchema.parse(input);
|
||||
Object.assign(this, data);
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
static from(input: AvatarDataInput): AvatarData {
|
||||
return new AvatarData(input);
|
||||
}
|
||||
|
||||
static fromJson(json: unknown): AvatarData {
|
||||
return AvatarData.from(json as AvatarDataInput);
|
||||
}
|
||||
|
||||
toJson(): AvatarDataData {
|
||||
return AvatarDataSchema.parse(this);
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/**
|
||||
* 积分数据 DTO
|
||||
*/
|
||||
import {
|
||||
CreditsDataSchema,
|
||||
type CreditsDataInput,
|
||||
type CreditsDataData,
|
||||
} from "@/data/services/schemas/user/credits_data";
|
||||
|
||||
export class CreditsData {
|
||||
declare readonly userId: string;
|
||||
declare readonly dolBalance: number;
|
||||
|
||||
private constructor(input: CreditsDataInput) {
|
||||
const data = CreditsDataSchema.parse(input);
|
||||
Object.assign(this, data);
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
static from(input: CreditsDataInput): CreditsData {
|
||||
return new CreditsData(input);
|
||||
}
|
||||
|
||||
static fromJson(json: unknown): CreditsData {
|
||||
return CreditsData.from(json as CreditsDataInput);
|
||||
}
|
||||
|
||||
toJson(): CreditsDataData {
|
||||
return CreditsDataSchema.parse(this);
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/**
|
||||
* 积分历史记录 DTO
|
||||
*/
|
||||
import {
|
||||
CreditsHistoryDataSchema,
|
||||
type CreditsHistoryDataInput,
|
||||
type CreditsHistoryDataData,
|
||||
} from "@/data/services/schemas/user/credits_history_data";
|
||||
|
||||
export class CreditsHistoryData {
|
||||
declare readonly records: Record<string, unknown>[];
|
||||
declare readonly total: number;
|
||||
declare readonly limit: number;
|
||||
declare readonly offset: number;
|
||||
|
||||
private constructor(input: CreditsHistoryDataInput) {
|
||||
const data = CreditsHistoryDataSchema.parse(input);
|
||||
Object.assign(this, data);
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
static from(input: CreditsHistoryDataInput): CreditsHistoryData {
|
||||
return new CreditsHistoryData(input);
|
||||
}
|
||||
|
||||
static fromJson(json: unknown): CreditsHistoryData {
|
||||
return CreditsHistoryData.from(json as CreditsHistoryDataInput);
|
||||
}
|
||||
|
||||
toJson(): CreditsHistoryDataData {
|
||||
return CreditsHistoryDataSchema.parse(this);
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/**
|
||||
* 个性特征 DTO
|
||||
*/
|
||||
import {
|
||||
PersonalityTraitsSchema,
|
||||
type PersonalityTraitsInput,
|
||||
type PersonalityTraitsData,
|
||||
} from "@/data/services/schemas/user/personality_traits";
|
||||
|
||||
export class PersonalityTraits {
|
||||
declare readonly cheerful: number;
|
||||
declare readonly caring: number;
|
||||
declare readonly playful: number;
|
||||
declare readonly serious: number;
|
||||
declare readonly romantic: number;
|
||||
|
||||
private constructor(input: PersonalityTraitsInput) {
|
||||
const data = PersonalityTraitsSchema.parse(input);
|
||||
Object.assign(this, data);
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
static from(input: PersonalityTraitsInput): PersonalityTraits {
|
||||
return new PersonalityTraits(input);
|
||||
}
|
||||
|
||||
static fromJson(json: unknown): PersonalityTraits {
|
||||
return PersonalityTraits.from(json as PersonalityTraitsInput);
|
||||
}
|
||||
|
||||
toJson(): PersonalityTraitsData {
|
||||
return PersonalityTraitsSchema.parse(this);
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/**
|
||||
* 最近记忆 DTO
|
||||
*/
|
||||
import {
|
||||
RecentMemorySchema,
|
||||
type RecentMemoryInput,
|
||||
type RecentMemoryData,
|
||||
} from "@/data/services/schemas/user/recent_memory";
|
||||
|
||||
export class RecentMemory {
|
||||
declare readonly type: string;
|
||||
declare readonly content: string;
|
||||
declare readonly importance: number;
|
||||
declare readonly createdAt: string;
|
||||
|
||||
private constructor(input: RecentMemoryInput) {
|
||||
const data = RecentMemorySchema.parse(input);
|
||||
Object.assign(this, data);
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
static from(input: RecentMemoryInput): RecentMemory {
|
||||
return new RecentMemory(input);
|
||||
}
|
||||
|
||||
static fromJson(json: unknown): RecentMemory {
|
||||
return RecentMemory.from(json as RecentMemoryInput);
|
||||
}
|
||||
|
||||
toJson(): RecentMemoryData {
|
||||
return RecentMemorySchema.parse(this);
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/**
|
||||
* 更新个人资料请求 DTO
|
||||
*/
|
||||
import {
|
||||
UpdateProfileRequestSchema,
|
||||
type UpdateProfileRequestInput,
|
||||
type UpdateProfileRequestData,
|
||||
} from "@/data/services/schemas/user/update_profile_request";
|
||||
|
||||
export class UpdateProfileRequest {
|
||||
declare readonly username: string;
|
||||
declare readonly nickname: string;
|
||||
declare readonly preferredLanguage: string;
|
||||
declare readonly currentMood: string;
|
||||
|
||||
private constructor(input: UpdateProfileRequestInput) {
|
||||
const data = UpdateProfileRequestSchema.parse(input);
|
||||
Object.assign(this, data);
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
static from(input: UpdateProfileRequestInput): UpdateProfileRequest {
|
||||
return new UpdateProfileRequest(input);
|
||||
}
|
||||
|
||||
static fromJson(json: unknown): UpdateProfileRequest {
|
||||
return UpdateProfileRequest.from(json as UpdateProfileRequestInput);
|
||||
}
|
||||
|
||||
toJson(): UpdateProfileRequestData {
|
||||
return UpdateProfileRequestSchema.parse(this);
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
/**
|
||||
* 用户 DTO
|
||||
*/
|
||||
import {
|
||||
UserSchema,
|
||||
type UserInput,
|
||||
type UserData,
|
||||
} from "@/data/services/schemas/user/user";
|
||||
import { PersonalityTraits } from "./personality_traits";
|
||||
|
||||
export class User {
|
||||
declare readonly id: string;
|
||||
declare readonly username: string;
|
||||
declare readonly email: string;
|
||||
declare readonly platform: string;
|
||||
declare readonly intimacy: number;
|
||||
declare readonly dolBalance: number;
|
||||
declare readonly relationshipStage: string;
|
||||
declare readonly currentMood: string;
|
||||
declare readonly personalityTraits: PersonalityTraits;
|
||||
declare readonly preferredLanguage: string;
|
||||
declare readonly createdAt: string;
|
||||
declare readonly lastMessageAt: string;
|
||||
declare readonly avatarUrl: string;
|
||||
declare readonly loginProvider: string;
|
||||
declare readonly isGuest: boolean;
|
||||
|
||||
private constructor(input: UserInput) {
|
||||
const data = UserSchema.parse(input);
|
||||
Object.assign(this, {
|
||||
...data,
|
||||
personalityTraits: PersonalityTraits.from(data.personalityTraits),
|
||||
});
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
static from(input: UserInput): User {
|
||||
return new User(input);
|
||||
}
|
||||
|
||||
static fromJson(json: unknown): User {
|
||||
return User.from(json as UserInput);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建一个具有空 id/username 的 User 实例(用于可选 user 字段的默认占位)
|
||||
*/
|
||||
static empty(): User {
|
||||
return new User({ id: "", username: "" });
|
||||
}
|
||||
|
||||
toJson(): UserData {
|
||||
const { personalityTraits, ...rest } = this;
|
||||
return {
|
||||
...rest,
|
||||
personalityTraits: personalityTraits.toJson(),
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
/**
|
||||
* 用户统计响应 DTO
|
||||
*/
|
||||
import {
|
||||
UserStatsResponseSchema,
|
||||
type UserStatsResponseInput,
|
||||
type UserStatsResponseData,
|
||||
} from "@/data/services/schemas/user/user_stats_response";
|
||||
import { PersonalityTraits } from "./personality_traits";
|
||||
import { RecentMemory } from "./recent_memory";
|
||||
|
||||
export class UserStatsResponse {
|
||||
declare readonly userId: string;
|
||||
declare readonly username: string;
|
||||
declare readonly platform: string;
|
||||
declare readonly intimacy: number;
|
||||
declare readonly relationshipStage: string;
|
||||
declare readonly dolBalance: number;
|
||||
declare readonly totalMessages: number;
|
||||
declare readonly lastMessageAt: string;
|
||||
declare readonly accountCreatedAt: string;
|
||||
declare readonly currentMood: string;
|
||||
declare readonly personalityTraits: PersonalityTraits;
|
||||
declare readonly recentMemories: RecentMemory[];
|
||||
declare readonly promptTokensTotal: number;
|
||||
declare readonly completionTokensTotal: number;
|
||||
declare readonly cacheHitTokensTotal: number;
|
||||
declare readonly tokensTotal: number;
|
||||
|
||||
private constructor(input: UserStatsResponseInput) {
|
||||
const data = UserStatsResponseSchema.parse(input);
|
||||
Object.assign(this, {
|
||||
...data,
|
||||
personalityTraits: PersonalityTraits.from(data.personalityTraits),
|
||||
recentMemories: data.recentMemories.map((m) => RecentMemory.from(m)),
|
||||
});
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
static from(input: UserStatsResponseInput): UserStatsResponse {
|
||||
return new UserStatsResponse(input);
|
||||
}
|
||||
|
||||
static fromJson(json: unknown): UserStatsResponse {
|
||||
return UserStatsResponse.from(json as UserStatsResponseInput);
|
||||
}
|
||||
|
||||
toJson(): UserStatsResponseData {
|
||||
return UserStatsResponseSchema.parse(this);
|
||||
}
|
||||
}
|
||||
+68
-68
@@ -22,71 +22,71 @@ export * from "./auth/initialize_facebook_auth";
|
||||
export * from "./auth/initialize_google_auth";
|
||||
export * from "./auth/mock_auth_platform";
|
||||
export * from "./auth/web_auth_platform";
|
||||
export * from "./dto/auth/apple_login_request";
|
||||
export * from "./dto/auth/facebook_login_request";
|
||||
export * from "./dto/auth/facebook_user_data";
|
||||
export * from "./dto/auth/fb_id_login_request";
|
||||
export * from "./dto/auth/google_login_request";
|
||||
export * from "./dto/auth/guest_login_request";
|
||||
export * from "./dto/auth/guest_login_response";
|
||||
export * from "./dto/auth/login_request";
|
||||
export * from "./dto/auth/login_response";
|
||||
export * from "./dto/auth/logout_response";
|
||||
export * from "./dto/auth/refresh_token_request";
|
||||
export * from "./dto/auth/refresh_token_response";
|
||||
export * from "./dto/auth/register_request";
|
||||
export * from "./dto/auth/send_code_request";
|
||||
export * from "./dto/chat/chat_history_response";
|
||||
export * from "./dto/chat/chat_message";
|
||||
export * from "./dto/chat/chat_send_response";
|
||||
export * from "./dto/chat/chat_sync_data";
|
||||
export * from "./dto/chat/chat_sync_request";
|
||||
export * from "./dto/chat/guest_chat_quota";
|
||||
export * from "./dto/chat/image_upload_response";
|
||||
export * from "./dto/chat/send_message_request";
|
||||
export * from "./dto/chat/stt_data";
|
||||
export * from "./dto/chat/sync_message";
|
||||
export * from "./dto/metrics/app_event";
|
||||
export * from "./dto/metrics/pwa_event";
|
||||
export * from "./dto/user/avatar_data";
|
||||
export * from "./dto/user/credits_data";
|
||||
export * from "./dto/user/credits_history_data";
|
||||
export * from "./dto/user/personality_traits";
|
||||
export * from "./dto/user/recent_memory";
|
||||
export * from "./dto/user/update_profile_request";
|
||||
export * from "./dto/user/user";
|
||||
export * from "./dto/user/user_stats_response";
|
||||
export * from "./schemas/auth/apple_login_request";
|
||||
export * from "./schemas/auth/facebook_login_request";
|
||||
export * from "./schemas/auth/facebook_user_data";
|
||||
export * from "./schemas/auth/fb_id_login_request";
|
||||
export * from "./schemas/auth/google_login_request";
|
||||
export * from "./schemas/auth/guest_login_request";
|
||||
export * from "./schemas/auth/guest_login_response";
|
||||
export * from "./schemas/auth/login_request";
|
||||
export * from "./schemas/auth/login_response";
|
||||
export * from "./schemas/auth/logout_response";
|
||||
export * from "./schemas/auth/refresh_token_request";
|
||||
export * from "./schemas/auth/refresh_token_response";
|
||||
export * from "./schemas/auth/register_request";
|
||||
export * from "./schemas/auth/send_code_request";
|
||||
export * from "./schemas/chat/chat_history_response";
|
||||
export * from "./schemas/chat/chat_message";
|
||||
export * from "./schemas/chat/chat_send_response";
|
||||
export * from "./schemas/chat/chat_sync_data";
|
||||
export * from "./schemas/chat/chat_sync_request";
|
||||
export * from "./schemas/chat/guest_chat_quota";
|
||||
export * from "./schemas/chat/image_upload_response";
|
||||
export * from "./schemas/chat/send_message_request";
|
||||
export * from "./schemas/chat/stt_data";
|
||||
export * from "./schemas/chat/sync_message";
|
||||
export * from "./schemas/metrics/app_event";
|
||||
export * from "./schemas/metrics/pwa_event";
|
||||
export * from "./schemas/user/avatar_data";
|
||||
export * from "./schemas/user/credits_data";
|
||||
export * from "./schemas/user/credits_history_data";
|
||||
export * from "./schemas/user/personality_traits";
|
||||
export * from "./schemas/user/recent_memory";
|
||||
export * from "./schemas/user/update_profile_request";
|
||||
export * from "./schemas/user/user";
|
||||
export * from "./schemas/user/user_stats_response";
|
||||
export * from "../dto/auth/apple_login_request";
|
||||
export * from "../dto/auth/facebook_login_request";
|
||||
export * from "../dto/auth/facebook_user_data";
|
||||
export * from "../dto/auth/fb_id_login_request";
|
||||
export * from "../dto/auth/google_login_request";
|
||||
export * from "../dto/auth/guest_login_request";
|
||||
export * from "../dto/auth/guest_login_response";
|
||||
export * from "../dto/auth/login_request";
|
||||
export * from "../dto/auth/login_response";
|
||||
export * from "../dto/auth/logout_response";
|
||||
export * from "../dto/auth/refresh_token_request";
|
||||
export * from "../dto/auth/refresh_token_response";
|
||||
export * from "../dto/auth/register_request";
|
||||
export * from "../dto/auth/send_code_request";
|
||||
export * from "../dto/chat/chat_history_response";
|
||||
export * from "../dto/chat/chat_message";
|
||||
export * from "../dto/chat/chat_send_response";
|
||||
export * from "../dto/chat/chat_sync_data";
|
||||
export * from "../dto/chat/chat_sync_request";
|
||||
export * from "../dto/chat/guest_chat_quota";
|
||||
export * from "../dto/chat/image_upload_response";
|
||||
export * from "../dto/chat/send_message_request";
|
||||
export * from "../dto/chat/stt_data";
|
||||
export * from "../dto/chat/sync_message";
|
||||
export * from "../dto/metrics/app_event";
|
||||
export * from "../dto/metrics/pwa_event";
|
||||
export * from "../dto/user/avatar_data";
|
||||
export * from "../dto/user/credits_data";
|
||||
export * from "../dto/user/credits_history_data";
|
||||
export * from "../dto/user/personality_traits";
|
||||
export * from "../dto/user/recent_memory";
|
||||
export * from "../dto/user/update_profile_request";
|
||||
export * from "../dto/user/user";
|
||||
export * from "../dto/user/user_stats_response";
|
||||
export * from "../schemas/auth/apple_login_request";
|
||||
export * from "../schemas/auth/facebook_login_request";
|
||||
export * from "../schemas/auth/facebook_user_data";
|
||||
export * from "../schemas/auth/fb_id_login_request";
|
||||
export * from "../schemas/auth/google_login_request";
|
||||
export * from "../schemas/auth/guest_login_request";
|
||||
export * from "../schemas/auth/guest_login_response";
|
||||
export * from "../schemas/auth/login_request";
|
||||
export * from "../schemas/auth/login_response";
|
||||
export * from "../schemas/auth/logout_response";
|
||||
export * from "../schemas/auth/refresh_token_request";
|
||||
export * from "../schemas/auth/refresh_token_response";
|
||||
export * from "../schemas/auth/register_request";
|
||||
export * from "../schemas/auth/send_code_request";
|
||||
export * from "../schemas/chat/chat_history_response";
|
||||
export * from "../schemas/chat/chat_message";
|
||||
export * from "../schemas/chat/chat_send_response";
|
||||
export * from "../schemas/chat/chat_sync_data";
|
||||
export * from "../schemas/chat/chat_sync_request";
|
||||
export * from "../schemas/chat/guest_chat_quota";
|
||||
export * from "../schemas/chat/image_upload_response";
|
||||
export * from "../schemas/chat/send_message_request";
|
||||
export * from "../schemas/chat/stt_data";
|
||||
export * from "../schemas/chat/sync_message";
|
||||
export * from "../schemas/metrics/app_event";
|
||||
export * from "../schemas/metrics/pwa_event";
|
||||
export * from "../schemas/user/avatar_data";
|
||||
export * from "../schemas/user/credits_data";
|
||||
export * from "../schemas/user/credits_history_data";
|
||||
export * from "../schemas/user/personality_traits";
|
||||
export * from "../schemas/user/recent_memory";
|
||||
export * from "../schemas/user/update_profile_request";
|
||||
export * from "../schemas/user/user";
|
||||
export * from "../schemas/user/user_stats_response";
|
||||
|
||||
@@ -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,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,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,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,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,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