infoalloggi-monorepo/apps/infoalloggi/src/schemas/public/Emails.ts
Marco Pedone 60e4b187bf Refactor: Update Zod schemas and replace custom types with imported schemas across various files
- Replaced custom Zod types with imported schemas in stripe router and user router.
- Updated payment controller to use new enum imports for order types and payment statuses.
- Refactored payment tests to utilize the new enum structure.
- Removed deprecated zod_types file and created new zod_chat_types file for chat-related schemas.
- Adjusted service files to align with the new order type enums and schemas.
- Enhanced the Caratteristiche type definition using Zod for better validation.

Co-authored-by: Copilot <copilot@github.com>
2026-04-28 20:32:19 +02:00

46 lines
No EOL
1.4 KiB
TypeScript

import { usersId, type UsersId } from './Users';
import type { ColumnType, Selectable, Insertable, Updateable } from 'kysely';
import { z } from 'zod';
/** Identifier type for public.emails */
export type EmailsIdEmail = number & { __brand: 'public.emails' };
/** Represents the table public.emails */
export default interface EmailsTable {
id_email: ColumnType<EmailsIdEmail, EmailsIdEmail | undefined, EmailsIdEmail>;
user_id: ColumnType<UsersId, UsersId, UsersId>;
created_at: ColumnType<Date, Date | string | undefined, Date | string>;
data: ColumnType<unknown, unknown, unknown>;
}
export type Emails = Selectable<EmailsTable>;
export type NewEmails = Insertable<EmailsTable>;
export type EmailsUpdate = Updateable<EmailsTable>;
export const emailsIdEmail = z.number().transform(value => value as EmailsIdEmail);
export const EmailsSchema = z.object({
id_email: emailsIdEmail,
user_id: usersId,
created_at: z.date(),
data: z.unknown(),
});
export const NewEmailsSchema = z.object({
id_email: emailsIdEmail.optional(),
user_id: usersId,
created_at: z.union([z.date(), z.string()]).pipe(z.coerce.date()).optional(),
data: z.unknown(),
});
export const EmailsUpdateSchema = z.object({
id_email: emailsIdEmail.optional(),
user_id: usersId.optional(),
created_at: z.union([z.date(), z.string()]).pipe(z.coerce.date()).optional(),
data: z.unknown().optional(),
});