karso/front/src/back-api/model/user-create.ts

39 lines
923 B
TypeScript

/**
* Interface of the server (auto-generated code)
*/
import { z as zod } from "zod";
export const ZodUserCreate = zod.object({
login: zod.string().max(255).optional(),
email: zod.string().max(255).optional(),
password: zod.string().max(255).optional(),
});
export type UserCreate = zod.infer<typeof ZodUserCreate>;
export function isUserCreate(data: any): data is UserCreate {
try {
ZodUserCreate.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodUserCreate' error=${e}`);
return false;
}
}
export const ZodUserCreateWrite = ZodUserCreate.partial();
export type UserCreateWrite = zod.infer<typeof ZodUserCreateWrite>;
export function isUserCreateWrite(data: any): data is UserCreateWrite {
try {
ZodUserCreateWrite.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodUserCreateWrite' error=${e}`);
return false;
}
}