62 lines
1.6 KiB
TypeScript
62 lines
1.6 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, ZodGenericDataSoftDeleteWrite } 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 ZodTrackWrite = ZodGenericDataSoftDeleteWrite.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).optional(),
|
|
|
|
});
|
|
|
|
export type TrackWrite = zod.infer<typeof ZodTrackWrite>;
|
|
|
|
export function isTrackWrite(data: any): data is TrackWrite {
|
|
try {
|
|
ZodTrackWrite.parse(data);
|
|
return true;
|
|
} catch (e: any) {
|
|
console.log(`Fail to parse data type='ZodTrackWrite' error=${e}`);
|
|
return false;
|
|
}
|
|
}
|