refactor(data): move dto and schemas out of services directory

This commit is contained in:
2026-06-09 17:11:11 +08:00
parent 372b93fe45
commit 50940961ec
88 changed files with 279 additions and 356 deletions
@@ -0,0 +1,33 @@
/**
* 更新个人资料请求 DTO
*/
import {
UpdateProfileRequestSchema,
type UpdateProfileRequestInput,
type UpdateProfileRequestData,
} from "@/data/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);
}
}