/** * Interface of the server (auto-generated code) */ import { z as zod } from "zod"; import {ZodTimestamp} from "./timestamp"; import {ZodUUID} from "./uuid"; import {ZodGenericDataSoftDelete, ZodGenericDataSoftDeleteWrite } from "./generic-data-soft-delete"; export const ZodUser = ZodGenericDataSoftDelete.extend({ login: zod.string().min(3).max(128), lastConnection: ZodTimestamp.optional(), blocked: zod.boolean().optional(), blockedReason: zod.string().max(512).optional(), /** * List of Id of the specific covers */ covers: zod.array(ZodUUID).optional(), }); export type User = zod.infer; export function isUser(data: any): data is User { try { ZodUser.parse(data); return true; } catch (e: any) { console.log(`Fail to parse data type='ZodUser' error=${e}`); return false; } } export const ZodUserWrite = ZodGenericDataSoftDeleteWrite.extend({ login: zod.string().min(3).max(128).optional(), lastConnection: ZodTimestamp.nullable().optional(), blocked: zod.boolean().nullable().optional(), blockedReason: zod.string().max(512).nullable().optional(), /** * List of Id of the specific covers */ covers: zod.array(ZodUUID).nullable().optional(), }); export type UserWrite = zod.infer; export function isUserWrite(data: any): data is UserWrite { try { ZodUserWrite.parse(data); return true; } catch (e: any) { console.log(`Fail to parse data type='ZodUserWrite' error=${e}`); return false; } }