/** * Interface of the server (auto-generated code) */ import { z as zod } from "zod"; import {ZodObjectId} from "./object-id"; import {ZodLocalDate} from "./local-date"; import {ZodGenericDataSoftDelete, ZodGenericDataSoftDeleteUpdate , ZodGenericDataSoftDeleteCreate } from "./generic-data-soft-delete"; export const ZodAlbum = ZodGenericDataSoftDelete.extend({ name: zod.string().optional(), description: zod.string().optional(), /** * List of Id of the specific covers */ covers: zod.array(ZodObjectId).optional(), publication: ZodLocalDate.optional(), }); export type Album = zod.infer; export function isAlbum(data: any): data is Album { try { ZodAlbum.parse(data); return true; } catch (e: any) { console.log(`Fail to parse data type='ZodAlbum' error=${e}`); return false; } } export const ZodAlbumUpdate = ZodGenericDataSoftDeleteUpdate.extend({ name: zod.string().nullable().optional(), description: zod.string().nullable().optional(), /** * List of Id of the specific covers */ covers: zod.array(ZodObjectId).nullable().optional(), publication: ZodLocalDate.nullable().optional(), }); export type AlbumUpdate = zod.infer; export function isAlbumUpdate(data: any): data is AlbumUpdate { try { ZodAlbumUpdate.parse(data); return true; } catch (e: any) { console.log(`Fail to parse data type='ZodAlbumUpdate' error=${e}`); return false; } } export const ZodAlbumCreate = ZodGenericDataSoftDeleteCreate.extend({ name: zod.string().nullable().optional(), description: zod.string().nullable().optional(), /** * List of Id of the specific covers */ covers: zod.array(ZodObjectId).nullable().optional(), publication: ZodLocalDate.nullable().optional(), }); export type AlbumCreate = zod.infer; export function isAlbumCreate(data: any): data is AlbumCreate { try { ZodAlbumCreate.parse(data); return true; } catch (e: any) { console.log(`Fail to parse data type='ZodAlbumCreate' error=${e}`); return false; } }