refactor(dto): group request and response models
Docker Image / Build and Push Docker Image (push) Successful in 2m50s

This commit is contained in:
2026-07-07 16:43:08 +08:00
parent b5bf81de59
commit 9cb9534459
38 changed files with 51 additions and 71 deletions
@@ -0,0 +1,31 @@
/**
* 刷新 Token 响应 DTO
*/
import {
RefreshTokenResponseSchema,
type RefreshTokenResponseInput,
type RefreshTokenResponseData,
} from "@/data/schemas/auth/refresh_token_response";
export class RefreshTokenResponse {
declare readonly token: string;
declare readonly refreshToken: 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);
}
}