import { usersId, type UsersId } from './Users'; import { appuntiGroupsId, type AppuntiGroupsId } from './AppuntiGroups'; import type { ColumnType, Selectable, Insertable, Updateable } from 'kysely'; import { z } from 'zod'; /** Identifier type for public.appunti */ export type AppuntiId = string & { __brand: 'public.appunti' }; /** Represents the table public.appunti */ export default interface AppuntiTable { id: ColumnType; name: ColumnType; descrizione: ColumnType; created_at: ColumnType; userid: ColumnType; appunti_group_id: ColumnType; posizione: ColumnType; } export type Appunti = Selectable; export type NewAppunti = Insertable; export type AppuntiUpdate = Updateable; export const appuntiId = z.uuid().transform(value => value as AppuntiId); export const AppuntiSchema = z.object({ id: appuntiId, name: z.string(), descrizione: z.string().nullable(), created_at: z.date(), userid: usersId.nullable(), appunti_group_id: appuntiGroupsId, posizione: z.number().nullable(), }); export const NewAppuntiSchema = z.object({ id: appuntiId.optional(), name: z.string(), descrizione: z.string().optional().nullable(), created_at: z.union([z.date(), z.string()]).pipe(z.coerce.date()).optional(), userid: usersId.optional().nullable(), appunti_group_id: appuntiGroupsId, posizione: z.number().optional().nullable(), }); export const AppuntiUpdateSchema = z.object({ id: appuntiId.optional(), name: z.string().optional(), descrizione: z.string().optional().nullable(), created_at: z.union([z.date(), z.string()]).pipe(z.coerce.date()).optional(), userid: usersId.optional().nullable(), appunti_group_id: appuntiGroupsId.optional(), posizione: z.number().optional().nullable(), });