karso/front_angular/src/back-api/model/generic-token.ts

48 lines
1.2 KiB
TypeScript

/**
* Interface of the server (auto-generated code)
*/
import { z as zod } from "zod";
import {ZodLong} from "./long";
import {ZodTimestamp} from "./timestamp";
import {ZodGenericDataSoftDelete, ZodGenericDataSoftDeleteWrite } from "./generic-data-soft-delete";
export const ZodGenericToken = ZodGenericDataSoftDelete.extend({
parentId: ZodLong,
name: zod.string(),
endValidityTime: ZodTimestamp,
token: zod.string(),
});
export type GenericToken = zod.infer<typeof ZodGenericToken>;
export function isGenericToken(data: any): data is GenericToken {
try {
ZodGenericToken.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodGenericToken' error=${e}`);
return false;
}
}
export const ZodGenericTokenWrite = ZodGenericDataSoftDeleteWrite.extend({
parentId: ZodLong.optional(),
name: zod.string().optional(),
endValidityTime: ZodTimestamp.optional(),
token: zod.string().optional(),
});
export type GenericTokenWrite = zod.infer<typeof ZodGenericTokenWrite>;
export function isGenericTokenWrite(data: any): data is GenericTokenWrite {
try {
ZodGenericTokenWrite.parse(data);
return true;
} catch (e: any) {
console.log(`Fail to parse data type='ZodGenericTokenWrite' error=${e}`);
return false;
}
}