refactor(dto): group request and response models
Docker Image / Build and Push Docker Image (push) Successful in 2m50s
Docker Image / Build and Push Docker Image (push) Successful in 2m50s
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Google 登录请求 DTO
|
||||
*/
|
||||
import {
|
||||
GoogleLoginRequestSchema,
|
||||
type GoogleLoginRequestInput,
|
||||
type GoogleLoginRequestData,
|
||||
} from "@/data/schemas/auth/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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user