2025-05-01 23:10:05 +02:00

77 lines
2.4 KiB
TypeScript

/**
* Interface of the server (auto-generated code)
*/
import { z as zod } from "zod";
import {ZodIsoDate} from "./iso-date";
import {ZodObjectId} from "./object-id";
import {ZodOIDGenericDataSoftDelete, ZodOIDGenericDataSoftDeleteUpdate , ZodOIDGenericDataSoftDeleteCreate } from "./oid-generic-data-soft-delete";
export const ZodArtist = ZodOIDGenericDataSoftDelete.extend({
name: zod.string().min(1).max(256).optional(),
description: zod.string().max(8192).optional(),
/**
* List of Id of the specific covers
*/
covers: zod.array(ZodObjectId).readonly().optional(),
firstName: zod.string().min(1).max(256).optional(),
surname: zod.string().min(1).max(256).optional(),
birth: ZodIsoDate.optional(),
death: ZodIsoDate.optional(),
});
export type Artist = zod.infer<typeof ZodArtist>;
export function isArtist(data: any): data is Artist {
try {
ZodArtist.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodArtist' error=${e}`);
return false;
}
}
export const ZodArtistUpdate = ZodOIDGenericDataSoftDeleteUpdate.extend({
name: zod.string().min(1).max(256).nullable().optional(),
description: zod.string().max(8192).nullable().optional(),
firstName: zod.string().min(1).max(256).nullable().optional(),
surname: zod.string().min(1).max(256).nullable().optional(),
birth: ZodIsoDate.nullable().optional(),
death: ZodIsoDate.nullable().optional(),
});
export type ArtistUpdate = zod.infer<typeof ZodArtistUpdate>;
export function isArtistUpdate(data: any): data is ArtistUpdate {
try {
ZodArtistUpdate.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodArtistUpdate' error=${e}`);
return false;
}
}
export const ZodArtistCreate = ZodOIDGenericDataSoftDeleteCreate.extend({
name: zod.string().min(1).max(256).nullable().optional(),
description: zod.string().max(8192).nullable().optional(),
firstName: zod.string().min(1).max(256).nullable().optional(),
surname: zod.string().min(1).max(256).nullable().optional(),
birth: ZodIsoDate.nullable().optional(),
death: ZodIsoDate.nullable().optional(),
});
export type ArtistCreate = zod.infer<typeof ZodArtistCreate>;
export function isArtistCreate(data: any): data is ArtistCreate {
try {
ZodArtistCreate.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodArtistCreate' error=${e}`);
return false;
}
}