karusic/front/src/app/back-api/model/node-small.ts

51 lines
1.3 KiB
TypeScript

/**
* Interface of the server (auto-generated code)
*/
import { z as zod } from "zod";
import {ZodUUID} from "./uuid";
import {ZodGenericDataSoftDelete, ZodGenericDataSoftDeleteWrite } from "./generic-data-soft-delete";
export const ZodNodeSmall = ZodGenericDataSoftDelete.extend({
name: zod.string().max(256).optional(),
description: zod.string().optional(),
/**
* List of Id of the specific covers
*/
covers: zod.array(ZodUUID),
});
export type NodeSmall = zod.infer<typeof ZodNodeSmall>;
export function isNodeSmall(data: any): data is NodeSmall {
try {
ZodNodeSmall.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodNodeSmall' error=${e}`);
return false;
}
}
export const ZodNodeSmallWrite = ZodGenericDataSoftDeleteWrite.extend({
name: zod.string().max(256).nullable().optional(),
description: zod.string().nullable().optional(),
/**
* List of Id of the specific covers
*/
covers: zod.array(ZodUUID).optional(),
});
export type NodeSmallWrite = zod.infer<typeof ZodNodeSmallWrite>;
export function isNodeSmallWrite(data: any): data is NodeSmallWrite {
try {
ZodNodeSmallWrite.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodNodeSmallWrite' error=${e}`);
return false;
}
}