bigbuffet-rw/src/schemas/patron.ts
2023-09-18 16:08:54 -05:00

15 lines
No EOL
307 B
TypeScript

import { z } from 'zod';
const patronUserSchema = z.object({
is_patron: z.boolean().catch(false),
url: z.string().url(),
}).transform((patron) => {
return {
id: patron.url,
...patron,
};
});
type PatronUser = z.infer<typeof patronUserSchema>;
export { patronUserSchema, type PatronUser };