51 lines
1.3 KiB
TypeScript
51 lines
1.3 KiB
TypeScript
/**
|
|
* Interface of the server (auto-generated code)
|
|
*/
|
|
import { z as zod } from "zod";
|
|
|
|
import {ZodObjectId} from "./object-id";
|
|
import {ZodGenericDataSoftDelete, ZodGenericDataSoftDeleteWrite } from "./generic-data-soft-delete";
|
|
|
|
export const ZodGender = ZodGenericDataSoftDelete.extend({
|
|
name: zod.string().max(256).optional(),
|
|
description: zod.string().optional(),
|
|
/**
|
|
* List of Id of the specific covers
|
|
*/
|
|
covers: zod.array(ZodObjectId).optional(),
|
|
|
|
});
|
|
|
|
export type Gender = zod.infer<typeof ZodGender>;
|
|
|
|
export function isGender(data: any): data is Gender {
|
|
try {
|
|
ZodGender.parse(data);
|
|
return true;
|
|
} catch (e: any) {
|
|
console.log(`Fail to parse data type='ZodGender' error=${e}`);
|
|
return false;
|
|
}
|
|
}
|
|
export const ZodGenderWrite = ZodGenericDataSoftDeleteWrite.extend({
|
|
name: zod.string().max(256).nullable().optional(),
|
|
description: zod.string().nullable().optional(),
|
|
/**
|
|
* List of Id of the specific covers
|
|
*/
|
|
covers: zod.array(ZodObjectId).nullable().optional(),
|
|
|
|
});
|
|
|
|
export type GenderWrite = zod.infer<typeof ZodGenderWrite>;
|
|
|
|
export function isGenderWrite(data: any): data is GenderWrite {
|
|
try {
|
|
ZodGenderWrite.parse(data);
|
|
return true;
|
|
} catch (e: any) {
|
|
console.log(`Fail to parse data type='ZodGenderWrite' error=${e}`);
|
|
return false;
|
|
}
|
|
}
|