42 lines
974 B
TypeScript
42 lines
974 B
TypeScript
/**
|
|
* Interface of the server (auto-generated code)
|
|
*/
|
|
import { z as zod } from "zod";
|
|
|
|
import {ZodUser, ZodUserWrite } from "./user";
|
|
|
|
export const ZodUserAuthGet = ZodUser.extend({
|
|
email: zod.string(),
|
|
avatar: zod.boolean(),
|
|
|
|
});
|
|
|
|
export type UserAuthGet = zod.infer<typeof ZodUserAuthGet>;
|
|
|
|
export function isUserAuthGet(data: any): data is UserAuthGet {
|
|
try {
|
|
ZodUserAuthGet.parse(data);
|
|
return true;
|
|
} catch (e: any) {
|
|
console.log(`Fail to parse data type='ZodUserAuthGet' error=${e}`);
|
|
return false;
|
|
}
|
|
}
|
|
export const ZodUserAuthGetWrite = ZodUserWrite.extend({
|
|
email: zod.string().optional(),
|
|
avatar: zod.boolean().optional(),
|
|
|
|
});
|
|
|
|
export type UserAuthGetWrite = zod.infer<typeof ZodUserAuthGetWrite>;
|
|
|
|
export function isUserAuthGetWrite(data: any): data is UserAuthGetWrite {
|
|
try {
|
|
ZodUserAuthGetWrite.parse(data);
|
|
return true;
|
|
} catch (e: any) {
|
|
console.log(`Fail to parse data type='ZodUserAuthGetWrite' error=${e}`);
|
|
return false;
|
|
}
|
|
}
|