karso/front/src/back-api/model/application.ts

65 lines
1.6 KiB
TypeScript

/**
* Interface of the server (auto-generated code)
*/
import { z as zod } from "zod";
import {ZodInteger} from "./integer";
import {ZodGenericDataSoftDelete, ZodGenericDataSoftDeleteWrite } from "./generic-data-soft-delete";
export const ZodApplication = ZodGenericDataSoftDelete.extend({
name: zod.string().optional(),
description: zod.string().optional(),
redirect: zod.string(),
redirectDev: zod.string().optional(),
notification: zod.string().optional(),
/**
* Expiration time
*/
ttl: ZodInteger,
/**
* Right is manage with Karso
*/
manageRight: zod.boolean(),
});
export type Application = zod.infer<typeof ZodApplication>;
export function isApplication(data: any): data is Application {
try {
ZodApplication.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodApplication' error=${e}`);
return false;
}
}
export const ZodApplicationWrite = ZodGenericDataSoftDeleteWrite.extend({
name: zod.string().nullable().optional(),
description: zod.string().nullable().optional(),
redirect: zod.string().optional(),
redirectDev: zod.string().nullable().optional(),
notification: zod.string().nullable().optional(),
/**
* Expiration time
*/
ttl: ZodInteger.optional(),
/**
* Right is manage with Karso
*/
manageRight: zod.boolean().optional(),
});
export type ApplicationWrite = zod.infer<typeof ZodApplicationWrite>;
export function isApplicationWrite(data: any): data is ApplicationWrite {
try {
ZodApplicationWrite.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodApplicationWrite' error=${e}`);
return false;
}
}