Files
cozsweet-frontend-nextjs/src/data/dto/auth/request/google_login_request.ts
T
admin 759481b621 refactor(schemas): group network schemas by direction
Move request and response schemas into matching subdirectories, extract the shared chat lock type, and update barrels and imports without changing wire formats.
2026-07-14 15:12:19 +08:00

34 lines
891 B
TypeScript

/**
* Google 登录请求 DTO
*/
import {
GoogleLoginRequestSchema,
type GoogleLoginRequestInput,
type GoogleLoginRequestData,
} from "@/data/schemas/auth/request/google_login_request";
export class GoogleLoginRequest {
declare readonly idToken: string;
declare readonly platform: string;
declare readonly guestId: string;
declare readonly isTestAccount: boolean;
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);
}
}