33 lines
821 B
TypeScript
33 lines
821 B
TypeScript
/**
|
|
* Facebook ID 登录请求 DTO
|
|
*/
|
|
import {
|
|
FbIdLoginRequestSchema,
|
|
type FbIdLoginRequestInput,
|
|
type FbIdLoginRequestData,
|
|
} from "@/data/schemas/auth/fb_id_login_request";
|
|
|
|
export class FbIdLoginRequest {
|
|
declare readonly fbId: string;
|
|
declare readonly avatarUrl: string;
|
|
declare readonly isTestAccount: boolean;
|
|
|
|
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);
|
|
}
|
|
}
|