refactor(data): establish API contract guardrails
CI / Quality and Bundle Budgets (push) Has been cancelled
CI / Quality and Bundle Budgets (push) Has been cancelled
This commit is contained in:
@@ -3,28 +3,15 @@
|
||||
*/
|
||||
import {
|
||||
FacebookIdentityResponseSchema,
|
||||
type FacebookIdentityResponseInput,
|
||||
type FacebookIdentityResponseData,
|
||||
} from "@/data/schemas/auth/response/facebook_identity_response";
|
||||
import {
|
||||
createSchemaDto,
|
||||
type SchemaDto,
|
||||
} from "@/data/dto/schema_dto";
|
||||
|
||||
export class FacebookIdentityResponse {
|
||||
private constructor(input: FacebookIdentityResponseInput) {
|
||||
const data = FacebookIdentityResponseSchema.parse(input);
|
||||
Object.assign(this, data);
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
static from(input: FacebookIdentityResponseInput): FacebookIdentityResponse {
|
||||
return new FacebookIdentityResponse(input);
|
||||
}
|
||||
|
||||
static fromJson(json: unknown): FacebookIdentityResponse {
|
||||
return FacebookIdentityResponse.from(
|
||||
json as FacebookIdentityResponseInput,
|
||||
);
|
||||
}
|
||||
|
||||
toJson(): FacebookIdentityResponseData {
|
||||
return FacebookIdentityResponseSchema.parse(this);
|
||||
}
|
||||
}
|
||||
export type FacebookIdentityResponse = SchemaDto<
|
||||
typeof FacebookIdentityResponseSchema
|
||||
>;
|
||||
export const FacebookIdentityResponse = createSchemaDto(
|
||||
FacebookIdentityResponseSchema,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user