karso/front/src/back-api/model/application.ts
Edouard DUPIN 307a091178 plop
2025-07-04 18:15:12 +02:00

97 lines
2.7 KiB
TypeScript

/**
* Interface of the server (auto-generated code)
*/
import { z as zod } from "zod";
import {ZodLong} from "./long";
import {ZodInteger} from "./integer";
import {ZodGenericDataSoftDelete, ZodGenericDataSoftDeleteUpdate , ZodGenericDataSoftDeleteCreate } from "./generic-data-soft-delete";
export const ZodApplication = ZodGenericDataSoftDelete.extend({
name: zod.string().min(1).max(256).optional(),
description: zod.string().min(1).max(2048).optional(),
redirect: zod.string().min(1).max(2048),
redirectDev: zod.string().min(1).max(2048).optional(),
notification: zod.string().min(1).max(2048).optional(),
/**
* Expiration time
*/
ttl: ZodInteger,
/**
* Right is manage with Karso
*/
manageRight: zod.boolean(),
users: zod.array(ZodLong),
});
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 ZodApplicationUpdate = ZodGenericDataSoftDeleteUpdate.extend({
name: zod.string().min(1).max(256).nullable().optional(),
description: zod.string().min(1).max(2048).nullable().optional(),
redirect: zod.string().min(1).max(2048),
redirectDev: zod.string().min(1).max(2048).nullable().optional(),
notification: zod.string().min(1).max(2048).nullable().optional(),
/**
* Expiration time
*/
ttl: ZodInteger,
/**
* Right is manage with Karso
*/
manageRight: zod.boolean(),
users: zod.array(ZodLong),
});
export type ApplicationUpdate = zod.infer<typeof ZodApplicationUpdate>;
export function isApplicationUpdate(data: any): data is ApplicationUpdate {
try {
ZodApplicationUpdate.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodApplicationUpdate' error=${e}`);
return false;
}
}
export const ZodApplicationCreate = ZodGenericDataSoftDeleteCreate.extend({
name: zod.string().min(1).max(256).nullable().optional(),
description: zod.string().min(1).max(2048).nullable().optional(),
redirect: zod.string().min(1).max(2048),
redirectDev: zod.string().min(1).max(2048).nullable().optional(),
notification: zod.string().min(1).max(2048).nullable().optional(),
/**
* Expiration time
*/
ttl: ZodInteger,
/**
* Right is manage with Karso
*/
manageRight: zod.boolean(),
users: zod.array(ZodLong),
});
export type ApplicationCreate = zod.infer<typeof ZodApplicationCreate>;
export function isApplicationCreate(data: any): data is ApplicationCreate {
try {
ZodApplicationCreate.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodApplicationCreate' error=${e}`);
return false;
}
}