mirror of
https://github.com/CaramelFur/Picsur.git
synced 2025-10-25 23:46:06 +02:00
14 lines
495 B
TypeScript
14 lines
495 B
TypeScript
import { z } from 'zod';
|
|
import { IsApiKey } from '../validators/api-key.validator.js';
|
|
import { IsEntityID } from '../validators/entity-id.validator.js';
|
|
|
|
export const EApiKeySchema = z.object({
|
|
id: IsEntityID(),
|
|
key: IsApiKey(),
|
|
user: IsEntityID(),
|
|
name: z.string().min(3).max(255),
|
|
created: z.preprocess((data: any) => new Date(data), z.date()),
|
|
last_used: z.preprocess((data: any) => new Date(data), z.date()).nullable(),
|
|
});
|
|
export type EApiKey = z.infer<typeof EApiKeySchema>;
|