mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 08:13:56 +10:00
29 lines
801 B
TypeScript
29 lines
801 B
TypeScript
import { z } from 'zod';
|
|
|
|
// Not proud of the below but it's a way to deal with Infinity when returning JSON.
|
|
export const ZLimitsSchema = z.object({
|
|
documents: z
|
|
.preprocess((v) => (v === null ? Infinity : Number(v)), z.number())
|
|
.optional()
|
|
.default(0),
|
|
recipients: z
|
|
.preprocess((v) => (v === null ? Infinity : Number(v)), z.number())
|
|
.optional()
|
|
.default(0),
|
|
});
|
|
|
|
export type TLimitsSchema = z.infer<typeof ZLimitsSchema>;
|
|
|
|
export const ZLimitsResponseSchema = z.object({
|
|
quota: ZLimitsSchema,
|
|
remaining: ZLimitsSchema,
|
|
});
|
|
|
|
export type TLimitsResponseSchema = z.infer<typeof ZLimitsResponseSchema>;
|
|
|
|
export const ZLimitsErrorResponseSchema = z.object({
|
|
error: z.string(),
|
|
});
|
|
|
|
export type TLimitsErrorResponseSchema = z.infer<typeof ZLimitsErrorResponseSchema>;
|