88 lines
2.4 KiB
TypeScript

/**
* Interface of the server (auto-generated code)
*/
import { z as zod } from "zod";
import {ZodObjectId} from "./object-id";
import {ZodLong} from "./long";
import {ZodGenericDataSoftDelete, ZodGenericDataSoftDeleteUpdate , ZodGenericDataSoftDeleteCreate } from "./generic-data-soft-delete";
export const ZodTrack = ZodGenericDataSoftDelete.extend({
name: zod.string().optional(),
description: zod.string().optional(),
/**
* List of Id of the specific covers
*/
covers: zod.array(ZodObjectId).optional(),
genderId: ZodLong.optional(),
albumId: ZodLong.optional(),
track: ZodLong.optional(),
dataId: ZodObjectId.optional(),
artists: zod.array(ZodLong),
});
export type Track = zod.infer<typeof ZodTrack>;
export function isTrack(data: any): data is Track {
try {
ZodTrack.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodTrack' error=${e}`);
return false;
}
}
export const ZodTrackUpdate = 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(),
genderId: ZodLong.nullable().optional(),
albumId: ZodLong.nullable().optional(),
track: ZodLong.nullable().optional(),
dataId: ZodObjectId.nullable().optional(),
artists: zod.array(ZodLong),
});
export type TrackUpdate = zod.infer<typeof ZodTrackUpdate>;
export function isTrackUpdate(data: any): data is TrackUpdate {
try {
ZodTrackUpdate.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodTrackUpdate' error=${e}`);
return false;
}
}
export const ZodTrackCreate = 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(),
genderId: ZodLong.nullable().optional(),
albumId: ZodLong.nullable().optional(),
track: ZodLong.nullable().optional(),
dataId: ZodObjectId.nullable().optional(),
artists: zod.array(ZodLong),
});
export type TrackCreate = zod.infer<typeof ZodTrackCreate>;
export function isTrackCreate(data: any): data is TrackCreate {
try {
ZodTrackCreate.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodTrackCreate' error=${e}`);
return false;
}
}