@servemate/dto
Version:
Type-safe DTO package for ServeMate types and Zod validation. Shared across server and client.
991 lines • 39.9 kB
TypeScript
import { z } from 'zod';
/**
* Schema for validating reservation data using Zod.
*
* Properties:
* - `id`: A positive integer representing the reservation ID.
* - `guestsCount`: A positive integer representing the number of guests.
* - `time`: A union of string (transformed to Date) or Date representing the reservation time.
* - `name`: A string representing the name of the person making the reservation.
* - `email`: An optional nullable string representing the email of the person making the reservation.
* - `phone`: A string representing the phone number of the person making the reservation.
* - `status`: A string transformed to uppercase and validated against the `ReservationStatus` enum, defaulting to `PENDING`.
* - `allergies`: A union of an array of strings (transformed to uppercase) or a comma-separated string (transformed to an array of uppercase strings), validated against the `Allergies` enum.
* - `tables`: A union of an array of table IDs or a comma-separated string of table IDs, defaulting to an empty array.
* - `comments`: An optional nullable string for additional comments.
* - `createdAt`: A date representing when the reservation was created, defaulting to the current date.
* - `updatedAt`: A date representing when the reservation was last updated.
* - `isActive`: A union of boolean or string (transformed to boolean), defaulting to `true`.
*/
export declare const ReservationSchema: z.ZodObject<{
id: z.ZodNumber;
guestsCount: z.ZodNumber;
time: z.ZodUnion<[z.ZodEffects<z.ZodString, Date, string>, z.ZodDate]>;
name: z.ZodString;
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
phone: z.ZodString;
status: z.ZodDefault<z.ZodPipeline<z.ZodEffects<z.ZodString, string, string>, z.ZodNativeEnum<{
readonly PENDING: "PENDING";
readonly CONFIRMED: "CONFIRMED";
readonly CANCELLED: "CANCELLED";
readonly COMPLETED: "COMPLETED";
readonly NO_SHOW: "NO_SHOW";
}>>>;
allergies: z.ZodPipeline<z.ZodUnion<[z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>, z.ZodEffects<z.ZodString, string[], string>]>, z.ZodArray<z.ZodNativeEnum<{
readonly GLUTEN: "GLUTEN";
readonly DAIRY: "DAIRY";
readonly EGG: "EGG";
readonly PEANUT: "PEANUT";
readonly TREENUT: "TREENUT";
readonly FISH: "FISH";
readonly SHELLFISH: "SHELLFISH";
readonly SOY: "SOY";
readonly SESAME: "SESAME";
readonly CELERY: "CELERY";
readonly MUSTARD: "MUSTARD";
readonly LUPIN: "LUPIN";
readonly SULPHITES: "SULPHITES";
readonly MOLLUSCS: "MOLLUSCS";
}>, "many">>;
tables: z.ZodPipeline<z.ZodUnion<[z.ZodArray<z.ZodObject<Pick<{
id: z.ZodNumber;
tableNumber: z.ZodNumber;
capacity: z.ZodNumber;
additionalCapacity: z.ZodNumber;
isOccupied: z.ZodBoolean;
status: z.ZodNativeEnum<{
readonly AVAILABLE: "AVAILABLE";
readonly OCCUPIED: "OCCUPIED";
readonly RESERVED: "RESERVED";
readonly ORDERING: "ORDERING";
readonly SERVING: "SERVING";
readonly PAYMENT: "PAYMENT";
}>;
guests: z.ZodNumber;
originalCapacity: z.ZodNumber;
}, "id">, "strip", z.ZodTypeAny, {
id: number;
}, {
id: number;
}>, "many">, z.ZodEffects<z.ZodString, number[], string>]>, z.ZodDefault<z.ZodArray<z.ZodNumber, "many">>>;
comments: z.ZodOptional<z.ZodNullable<z.ZodString>>;
createdAt: z.ZodDefault<z.ZodDate>;
updatedAt: z.ZodDate;
isActive: z.ZodDefault<z.ZodUnion<[z.ZodBoolean, z.ZodEffects<z.ZodString, boolean | undefined, string>]>>;
}, "strip", z.ZodTypeAny, {
status: "PENDING" | "CONFIRMED" | "CANCELLED" | "COMPLETED" | "NO_SHOW";
id: number;
name: string;
createdAt: Date;
updatedAt: Date;
allergies: ("GLUTEN" | "DAIRY" | "EGG" | "PEANUT" | "TREENUT" | "FISH" | "SHELLFISH" | "SOY" | "SESAME" | "CELERY" | "MUSTARD" | "LUPIN" | "SULPHITES" | "MOLLUSCS")[];
guestsCount: number;
isActive: boolean;
time: Date;
phone: string;
tables: number[];
comments?: string | null | undefined;
email?: string | null | undefined;
}, {
id: number;
name: string;
updatedAt: Date;
allergies: string | string[];
guestsCount: number;
time: string | Date;
phone: string;
tables: string | {
id: number;
}[];
status?: string | undefined;
createdAt?: Date | undefined;
comments?: string | null | undefined;
email?: string | null | undefined;
isActive?: string | boolean | undefined;
}>;
/**
* Type representing a reservation data transfer object (DTO).
*/
export type ReservationDTO = z.infer<typeof ReservationSchema>;
/**
* @constant
* @name ReservationSearchCriteria
* @description
* This schema defines the search criteria for reservations. It extends the base `searchCriteriaSchema`
* and includes a partial selection of fields from `ReservationSchema` with additional search-specific fields.
*
* @property {string} sortBy - The field by which to sort the results. Defaults to 'time'.
* @property {number} [guestsCountMin] - The minimum number of guests. Must be a positive integer.
* @property {number} [guestsCountMax] - The maximum number of guests. Must be a positive integer.
* @property {Date | string} [timeStart] - The start time for the reservation search. Can be a string that will be transformed into a Date object.
* @property {Date | string} [timeEnd] - The end time for the reservation search. Can be a string that will be transformed into a Date object.
*
* @extends searchCriteriaSchema
* @see ReservationSchema
*/
export declare const ReservationSearchCriteria: z.ZodObject<Pick<{
page: z.ZodDefault<z.ZodNumber>;
pageSize: z.ZodDefault<z.ZodNumber>;
totalPages: z.ZodNumber;
totalCount: z.ZodNumber;
}, "page" | "pageSize"> & {
sortOrder: z.ZodDefault<z.ZodOptional<z.ZodNativeEnum<{
readonly ASC: "asc";
readonly DESC: "desc";
}>>>;
} & {
sortBy: z.ZodDefault<z.ZodString>;
guestsCountMin: z.ZodOptional<z.ZodNumber>;
guestsCountMax: z.ZodOptional<z.ZodNumber>;
timeStart: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodString, Date, string>, z.ZodDate]>>;
timeEnd: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodString, Date, string>, z.ZodDate]>>;
status: z.ZodOptional<z.ZodDefault<z.ZodPipeline<z.ZodEffects<z.ZodString, string, string>, z.ZodNativeEnum<{
readonly PENDING: "PENDING";
readonly CONFIRMED: "CONFIRMED";
readonly CANCELLED: "CANCELLED";
readonly COMPLETED: "COMPLETED";
readonly NO_SHOW: "NO_SHOW";
}>>>>;
name: z.ZodOptional<z.ZodString>;
allergies: z.ZodOptional<z.ZodPipeline<z.ZodUnion<[z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>, z.ZodEffects<z.ZodString, string[], string>]>, z.ZodArray<z.ZodNativeEnum<{
readonly GLUTEN: "GLUTEN";
readonly DAIRY: "DAIRY";
readonly EGG: "EGG";
readonly PEANUT: "PEANUT";
readonly TREENUT: "TREENUT";
readonly FISH: "FISH";
readonly SHELLFISH: "SHELLFISH";
readonly SOY: "SOY";
readonly SESAME: "SESAME";
readonly CELERY: "CELERY";
readonly MUSTARD: "MUSTARD";
readonly LUPIN: "LUPIN";
readonly SULPHITES: "SULPHITES";
readonly MOLLUSCS: "MOLLUSCS";
}>, "many">>>;
guestsCount: z.ZodOptional<z.ZodNumber>;
email: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
isActive: z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodBoolean, z.ZodEffects<z.ZodString, boolean | undefined, string>]>>>;
time: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodString, Date, string>, z.ZodDate]>>;
phone: z.ZodOptional<z.ZodString>;
tables: z.ZodOptional<z.ZodPipeline<z.ZodUnion<[z.ZodArray<z.ZodObject<Pick<{
id: z.ZodNumber;
tableNumber: z.ZodNumber;
capacity: z.ZodNumber;
additionalCapacity: z.ZodNumber;
isOccupied: z.ZodBoolean;
status: z.ZodNativeEnum<{
readonly AVAILABLE: "AVAILABLE";
readonly OCCUPIED: "OCCUPIED";
readonly RESERVED: "RESERVED";
readonly ORDERING: "ORDERING";
readonly SERVING: "SERVING";
readonly PAYMENT: "PAYMENT";
}>;
guests: z.ZodNumber;
originalCapacity: z.ZodNumber;
}, "id">, "strip", z.ZodTypeAny, {
id: number;
}, {
id: number;
}>, "many">, z.ZodEffects<z.ZodString, number[], string>]>, z.ZodDefault<z.ZodArray<z.ZodNumber, "many">>>>;
}, "strip", z.ZodTypeAny, {
page: number;
pageSize: number;
sortOrder: "asc" | "desc";
sortBy: string;
status?: "PENDING" | "CONFIRMED" | "CANCELLED" | "COMPLETED" | "NO_SHOW" | undefined;
name?: string | undefined;
allergies?: ("GLUTEN" | "DAIRY" | "EGG" | "PEANUT" | "TREENUT" | "FISH" | "SHELLFISH" | "SOY" | "SESAME" | "CELERY" | "MUSTARD" | "LUPIN" | "SULPHITES" | "MOLLUSCS")[] | undefined;
guestsCount?: number | undefined;
email?: string | null | undefined;
isActive?: boolean | undefined;
time?: Date | undefined;
phone?: string | undefined;
tables?: number[] | undefined;
guestsCountMin?: number | undefined;
guestsCountMax?: number | undefined;
timeStart?: Date | undefined;
timeEnd?: Date | undefined;
}, {
status?: string | undefined;
page?: number | undefined;
pageSize?: number | undefined;
sortOrder?: "asc" | "desc" | undefined;
name?: string | undefined;
allergies?: string | string[] | undefined;
sortBy?: string | undefined;
guestsCount?: number | undefined;
email?: string | null | undefined;
isActive?: string | boolean | undefined;
time?: string | Date | undefined;
phone?: string | undefined;
tables?: string | {
id: number;
}[] | undefined;
guestsCountMin?: number | undefined;
guestsCountMax?: number | undefined;
timeStart?: string | Date | undefined;
timeEnd?: string | Date | undefined;
}>;
/**
* Type representing the search criteria for reservations.
*/
export type ReservationSearchCriteriaDTO = z.infer<typeof ReservationSearchCriteria>;
/**
* Schema for creating a reservation, omitting the following fields:
* - `id`: The unique identifier for the reservation.
* - `updatedAt`: The timestamp when the reservation was last updated.
* - `createdAt`: The timestamp when the reservation was created.
* - `isActive`: The status indicating whether the reservation is active.
*/
export declare const CreateReservationSchema: z.ZodObject<Omit<{
id: z.ZodNumber;
guestsCount: z.ZodNumber;
time: z.ZodUnion<[z.ZodEffects<z.ZodString, Date, string>, z.ZodDate]>;
name: z.ZodString;
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
phone: z.ZodString;
status: z.ZodDefault<z.ZodPipeline<z.ZodEffects<z.ZodString, string, string>, z.ZodNativeEnum<{
readonly PENDING: "PENDING";
readonly CONFIRMED: "CONFIRMED";
readonly CANCELLED: "CANCELLED";
readonly COMPLETED: "COMPLETED";
readonly NO_SHOW: "NO_SHOW";
}>>>;
allergies: z.ZodPipeline<z.ZodUnion<[z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>, z.ZodEffects<z.ZodString, string[], string>]>, z.ZodArray<z.ZodNativeEnum<{
readonly GLUTEN: "GLUTEN";
readonly DAIRY: "DAIRY";
readonly EGG: "EGG";
readonly PEANUT: "PEANUT";
readonly TREENUT: "TREENUT";
readonly FISH: "FISH";
readonly SHELLFISH: "SHELLFISH";
readonly SOY: "SOY";
readonly SESAME: "SESAME";
readonly CELERY: "CELERY";
readonly MUSTARD: "MUSTARD";
readonly LUPIN: "LUPIN";
readonly SULPHITES: "SULPHITES";
readonly MOLLUSCS: "MOLLUSCS";
}>, "many">>;
tables: z.ZodPipeline<z.ZodUnion<[z.ZodArray<z.ZodObject<Pick<{
id: z.ZodNumber;
tableNumber: z.ZodNumber;
capacity: z.ZodNumber;
additionalCapacity: z.ZodNumber;
isOccupied: z.ZodBoolean;
status: z.ZodNativeEnum<{
readonly AVAILABLE: "AVAILABLE";
readonly OCCUPIED: "OCCUPIED";
readonly RESERVED: "RESERVED";
readonly ORDERING: "ORDERING";
readonly SERVING: "SERVING";
readonly PAYMENT: "PAYMENT";
}>;
guests: z.ZodNumber;
originalCapacity: z.ZodNumber;
}, "id">, "strip", z.ZodTypeAny, {
id: number;
}, {
id: number;
}>, "many">, z.ZodEffects<z.ZodString, number[], string>]>, z.ZodDefault<z.ZodArray<z.ZodNumber, "many">>>;
comments: z.ZodOptional<z.ZodNullable<z.ZodString>>;
createdAt: z.ZodDefault<z.ZodDate>;
updatedAt: z.ZodDate;
isActive: z.ZodDefault<z.ZodUnion<[z.ZodBoolean, z.ZodEffects<z.ZodString, boolean | undefined, string>]>>;
}, "id" | "createdAt" | "updatedAt" | "isActive">, "strip", z.ZodTypeAny, {
status: "PENDING" | "CONFIRMED" | "CANCELLED" | "COMPLETED" | "NO_SHOW";
name: string;
allergies: ("GLUTEN" | "DAIRY" | "EGG" | "PEANUT" | "TREENUT" | "FISH" | "SHELLFISH" | "SOY" | "SESAME" | "CELERY" | "MUSTARD" | "LUPIN" | "SULPHITES" | "MOLLUSCS")[];
guestsCount: number;
time: Date;
phone: string;
tables: number[];
comments?: string | null | undefined;
email?: string | null | undefined;
}, {
name: string;
allergies: string | string[];
guestsCount: number;
time: string | Date;
phone: string;
tables: string | {
id: number;
}[];
status?: string | undefined;
comments?: string | null | undefined;
email?: string | null | undefined;
}>;
/**
* Type representing the data transfer object (DTO) for creating a reservation.
*/
export type CreateReservationDTO = z.infer<typeof CreateReservationSchema>;
/**
* Extends the ReservationSchema to include an array of tables.
* Each table in the array contains only the `id` and `tableNumber` properties.
*
* @constant
* @type {ZodSchema}
*/
export declare const ReservationWithTablesSchema: z.ZodObject<{
id: z.ZodNumber;
guestsCount: z.ZodNumber;
time: z.ZodUnion<[z.ZodEffects<z.ZodString, Date, string>, z.ZodDate]>;
name: z.ZodString;
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
phone: z.ZodString;
status: z.ZodDefault<z.ZodPipeline<z.ZodEffects<z.ZodString, string, string>, z.ZodNativeEnum<{
readonly PENDING: "PENDING";
readonly CONFIRMED: "CONFIRMED";
readonly CANCELLED: "CANCELLED";
readonly COMPLETED: "COMPLETED";
readonly NO_SHOW: "NO_SHOW";
}>>>;
allergies: z.ZodPipeline<z.ZodUnion<[z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>, z.ZodEffects<z.ZodString, string[], string>]>, z.ZodArray<z.ZodNativeEnum<{
readonly GLUTEN: "GLUTEN";
readonly DAIRY: "DAIRY";
readonly EGG: "EGG";
readonly PEANUT: "PEANUT";
readonly TREENUT: "TREENUT";
readonly FISH: "FISH";
readonly SHELLFISH: "SHELLFISH";
readonly SOY: "SOY";
readonly SESAME: "SESAME";
readonly CELERY: "CELERY";
readonly MUSTARD: "MUSTARD";
readonly LUPIN: "LUPIN";
readonly SULPHITES: "SULPHITES";
readonly MOLLUSCS: "MOLLUSCS";
}>, "many">>;
comments: z.ZodOptional<z.ZodNullable<z.ZodString>>;
createdAt: z.ZodDefault<z.ZodDate>;
updatedAt: z.ZodDate;
isActive: z.ZodDefault<z.ZodUnion<[z.ZodBoolean, z.ZodEffects<z.ZodString, boolean | undefined, string>]>>;
} & {
tables: z.ZodArray<z.ZodObject<Pick<{
id: z.ZodNumber;
tableNumber: z.ZodNumber;
capacity: z.ZodNumber;
additionalCapacity: z.ZodNumber;
isOccupied: z.ZodBoolean;
status: z.ZodNativeEnum<{
readonly AVAILABLE: "AVAILABLE";
readonly OCCUPIED: "OCCUPIED";
readonly RESERVED: "RESERVED";
readonly ORDERING: "ORDERING";
readonly SERVING: "SERVING";
readonly PAYMENT: "PAYMENT";
}>;
guests: z.ZodNumber;
originalCapacity: z.ZodNumber;
} & {
orders: z.ZodOptional<z.ZodArray<z.ZodObject<Pick<{
id: z.ZodNumber;
tableNumber: z.ZodNumber;
orderNumber: z.ZodNumber;
guestsCount: z.ZodNumber;
orderTime: z.ZodDate;
updatedAt: z.ZodDate;
allergies: z.ZodOptional<z.ZodArray<z.ZodNativeEnum<{
readonly GLUTEN: "GLUTEN";
readonly DAIRY: "DAIRY";
readonly EGG: "EGG";
readonly PEANUT: "PEANUT";
readonly TREENUT: "TREENUT";
readonly FISH: "FISH";
readonly SHELLFISH: "SHELLFISH";
readonly SOY: "SOY";
readonly SESAME: "SESAME";
readonly CELERY: "CELERY";
readonly MUSTARD: "MUSTARD";
readonly LUPIN: "LUPIN";
readonly SULPHITES: "SULPHITES";
readonly MOLLUSCS: "MOLLUSCS";
}>, "many">>;
serverId: z.ZodNumber;
totalAmount: z.ZodDefault<z.ZodNumber>;
status: z.ZodDefault<z.ZodNativeEnum<{
readonly AWAITING: "AWAITING";
readonly RECEIVED: "RECEIVED";
readonly SERVED: "SERVED";
readonly CANCELED: "CANCELED";
readonly DISPUTED: "DISPUTED";
readonly READY_TO_PAY: "READY_TO_PAY";
readonly COMPLETED: "COMPLETED";
}>>;
comments: z.ZodNullable<z.ZodOptional<z.ZodString>>;
completionTime: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
discount: z.ZodDefault<z.ZodNumber>;
tip: z.ZodDefault<z.ZodNumber>;
shiftId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
}, "status" | "id" | "orderTime">, "strip", z.ZodTypeAny, {
status: "COMPLETED" | "AWAITING" | "RECEIVED" | "SERVED" | "CANCELED" | "DISPUTED" | "READY_TO_PAY";
id: number;
orderTime: Date;
}, {
id: number;
orderTime: Date;
status?: "COMPLETED" | "AWAITING" | "RECEIVED" | "SERVED" | "CANCELED" | "DISPUTED" | "READY_TO_PAY" | undefined;
}>, "many">>;
assignment: z.ZodOptional<z.ZodArray<z.ZodObject<Pick<{
serverId: z.ZodNumber;
isPrimary: z.ZodDefault<z.ZodBoolean>;
assignedTables: z.ZodArray<z.ZodNumber, "many">;
}, "serverId" | "isPrimary">, "strip", z.ZodTypeAny, {
serverId: number;
isPrimary: boolean;
}, {
serverId: number;
isPrimary?: boolean | undefined;
}>, "many">>;
}, "id" | "tableNumber">, "strip", z.ZodTypeAny, {
id: number;
tableNumber: number;
}, {
id: number;
tableNumber: number;
}>, "many">;
}, "strip", z.ZodTypeAny, {
status: "PENDING" | "CONFIRMED" | "CANCELLED" | "COMPLETED" | "NO_SHOW";
id: number;
name: string;
createdAt: Date;
updatedAt: Date;
allergies: ("GLUTEN" | "DAIRY" | "EGG" | "PEANUT" | "TREENUT" | "FISH" | "SHELLFISH" | "SOY" | "SESAME" | "CELERY" | "MUSTARD" | "LUPIN" | "SULPHITES" | "MOLLUSCS")[];
guestsCount: number;
isActive: boolean;
time: Date;
phone: string;
tables: {
id: number;
tableNumber: number;
}[];
comments?: string | null | undefined;
email?: string | null | undefined;
}, {
id: number;
name: string;
updatedAt: Date;
allergies: string | string[];
guestsCount: number;
time: string | Date;
phone: string;
tables: {
id: number;
tableNumber: number;
}[];
status?: string | undefined;
createdAt?: Date | undefined;
comments?: string | null | undefined;
email?: string | null | undefined;
isActive?: string | boolean | undefined;
}>;
/**
* Type representing a reservation with detailed table information.
*/
export type ReservationWithTablesDTO = z.infer<typeof ReservationWithTablesSchema>;
/**
* Represents a conflict in a reservation.
*
* @constant
* @type {z.ZodObject}
*
* @property {string} reservationId - The unique identifier of the reservation.
* @property {string} time - The time of the reservation.
* @property {Array<{ id: string, tableNumber: number }>} tables - An array of tables involved in the reservation conflict, each containing an id and table number.
*/
export declare const ReservationConflict: z.ZodObject<{
reservationId: z.ZodNumber;
time: z.ZodUnion<[z.ZodEffects<z.ZodString, Date, string>, z.ZodDate]>;
tables: z.ZodArray<z.ZodObject<Pick<{
id: z.ZodNumber;
tableNumber: z.ZodNumber;
capacity: z.ZodNumber;
additionalCapacity: z.ZodNumber;
isOccupied: z.ZodBoolean;
status: z.ZodNativeEnum<{
readonly AVAILABLE: "AVAILABLE";
readonly OCCUPIED: "OCCUPIED";
readonly RESERVED: "RESERVED";
readonly ORDERING: "ORDERING";
readonly SERVING: "SERVING";
readonly PAYMENT: "PAYMENT";
}>;
guests: z.ZodNumber;
originalCapacity: z.ZodNumber;
}, "id" | "tableNumber">, "strip", z.ZodTypeAny, {
id: number;
tableNumber: number;
}, {
id: number;
tableNumber: number;
}>, "many">;
}, "strip", z.ZodTypeAny, {
time: Date;
reservationId: number;
tables: {
id: number;
tableNumber: number;
}[];
}, {
time: string | Date;
reservationId: number;
tables: {
id: number;
tableNumber: number;
}[];
}>;
export type ReservationConflictDTO = z.infer<typeof ReservationConflict>;
export declare const ReservationDetailedSchema: z.ZodObject<{
reservation: z.ZodObject<{
id: z.ZodNumber;
guestsCount: z.ZodNumber;
time: z.ZodUnion<[z.ZodEffects<z.ZodString, Date, string>, z.ZodDate]>;
name: z.ZodString;
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
phone: z.ZodString;
status: z.ZodDefault<z.ZodPipeline<z.ZodEffects<z.ZodString, string, string>, z.ZodNativeEnum<{
readonly PENDING: "PENDING";
readonly CONFIRMED: "CONFIRMED";
readonly CANCELLED: "CANCELLED";
readonly COMPLETED: "COMPLETED";
readonly NO_SHOW: "NO_SHOW";
}>>>;
allergies: z.ZodPipeline<z.ZodUnion<[z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>, z.ZodEffects<z.ZodString, string[], string>]>, z.ZodArray<z.ZodNativeEnum<{
readonly GLUTEN: "GLUTEN";
readonly DAIRY: "DAIRY";
readonly EGG: "EGG";
readonly PEANUT: "PEANUT";
readonly TREENUT: "TREENUT";
readonly FISH: "FISH";
readonly SHELLFISH: "SHELLFISH";
readonly SOY: "SOY";
readonly SESAME: "SESAME";
readonly CELERY: "CELERY";
readonly MUSTARD: "MUSTARD";
readonly LUPIN: "LUPIN";
readonly SULPHITES: "SULPHITES";
readonly MOLLUSCS: "MOLLUSCS";
}>, "many">>;
comments: z.ZodOptional<z.ZodNullable<z.ZodString>>;
createdAt: z.ZodDefault<z.ZodDate>;
updatedAt: z.ZodDate;
isActive: z.ZodDefault<z.ZodUnion<[z.ZodBoolean, z.ZodEffects<z.ZodString, boolean | undefined, string>]>>;
} & {
tables: z.ZodArray<z.ZodObject<Pick<{
id: z.ZodNumber;
tableNumber: z.ZodNumber;
capacity: z.ZodNumber;
additionalCapacity: z.ZodNumber;
isOccupied: z.ZodBoolean;
status: z.ZodNativeEnum<{
readonly AVAILABLE: "AVAILABLE";
readonly OCCUPIED: "OCCUPIED";
readonly RESERVED: "RESERVED";
readonly ORDERING: "ORDERING";
readonly SERVING: "SERVING";
readonly PAYMENT: "PAYMENT";
}>;
guests: z.ZodNumber;
originalCapacity: z.ZodNumber;
} & {
orders: z.ZodOptional<z.ZodArray<z.ZodObject<Pick<{
id: z.ZodNumber;
tableNumber: z.ZodNumber;
orderNumber: z.ZodNumber;
guestsCount: z.ZodNumber;
orderTime: z.ZodDate;
updatedAt: z.ZodDate;
allergies: z.ZodOptional<z.ZodArray<z.ZodNativeEnum<{
readonly GLUTEN: "GLUTEN";
readonly DAIRY: "DAIRY";
readonly EGG: "EGG";
readonly PEANUT: "PEANUT";
readonly TREENUT: "TREENUT";
readonly FISH: "FISH";
readonly SHELLFISH: "SHELLFISH";
readonly SOY: "SOY";
readonly SESAME: "SESAME";
readonly CELERY: "CELERY";
readonly MUSTARD: "MUSTARD";
readonly LUPIN: "LUPIN";
readonly SULPHITES: "SULPHITES";
readonly MOLLUSCS: "MOLLUSCS";
}>, "many">>;
serverId: z.ZodNumber;
totalAmount: z.ZodDefault<z.ZodNumber>;
status: z.ZodDefault<z.ZodNativeEnum<{
readonly AWAITING: "AWAITING";
readonly RECEIVED: "RECEIVED";
readonly SERVED: "SERVED";
readonly CANCELED: "CANCELED";
readonly DISPUTED: "DISPUTED";
readonly READY_TO_PAY: "READY_TO_PAY";
readonly COMPLETED: "COMPLETED";
}>>;
comments: z.ZodNullable<z.ZodOptional<z.ZodString>>;
completionTime: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
discount: z.ZodDefault<z.ZodNumber>;
tip: z.ZodDefault<z.ZodNumber>;
shiftId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
}, "status" | "id" | "orderTime">, "strip", z.ZodTypeAny, {
status: "COMPLETED" | "AWAITING" | "RECEIVED" | "SERVED" | "CANCELED" | "DISPUTED" | "READY_TO_PAY";
id: number;
orderTime: Date;
}, {
id: number;
orderTime: Date;
status?: "COMPLETED" | "AWAITING" | "RECEIVED" | "SERVED" | "CANCELED" | "DISPUTED" | "READY_TO_PAY" | undefined;
}>, "many">>;
assignment: z.ZodOptional<z.ZodArray<z.ZodObject<Pick<{
serverId: z.ZodNumber;
isPrimary: z.ZodDefault<z.ZodBoolean>;
assignedTables: z.ZodArray<z.ZodNumber, "many">;
}, "serverId" | "isPrimary">, "strip", z.ZodTypeAny, {
serverId: number;
isPrimary: boolean;
}, {
serverId: number;
isPrimary?: boolean | undefined;
}>, "many">>;
}, "id" | "tableNumber">, "strip", z.ZodTypeAny, {
id: number;
tableNumber: number;
}, {
id: number;
tableNumber: number;
}>, "many">;
}, "strip", z.ZodTypeAny, {
status: "PENDING" | "CONFIRMED" | "CANCELLED" | "COMPLETED" | "NO_SHOW";
id: number;
name: string;
createdAt: Date;
updatedAt: Date;
allergies: ("GLUTEN" | "DAIRY" | "EGG" | "PEANUT" | "TREENUT" | "FISH" | "SHELLFISH" | "SOY" | "SESAME" | "CELERY" | "MUSTARD" | "LUPIN" | "SULPHITES" | "MOLLUSCS")[];
guestsCount: number;
isActive: boolean;
time: Date;
phone: string;
tables: {
id: number;
tableNumber: number;
}[];
comments?: string | null | undefined;
email?: string | null | undefined;
}, {
id: number;
name: string;
updatedAt: Date;
allergies: string | string[];
guestsCount: number;
time: string | Date;
phone: string;
tables: {
id: number;
tableNumber: number;
}[];
status?: string | undefined;
createdAt?: Date | undefined;
comments?: string | null | undefined;
email?: string | null | undefined;
isActive?: string | boolean | undefined;
}>;
conflict: z.ZodArray<z.ZodObject<{
reservationId: z.ZodNumber;
time: z.ZodUnion<[z.ZodEffects<z.ZodString, Date, string>, z.ZodDate]>;
tables: z.ZodArray<z.ZodObject<Pick<{
id: z.ZodNumber;
tableNumber: z.ZodNumber;
capacity: z.ZodNumber;
additionalCapacity: z.ZodNumber;
isOccupied: z.ZodBoolean;
status: z.ZodNativeEnum<{
readonly AVAILABLE: "AVAILABLE";
readonly OCCUPIED: "OCCUPIED";
readonly RESERVED: "RESERVED";
readonly ORDERING: "ORDERING";
readonly SERVING: "SERVING";
readonly PAYMENT: "PAYMENT";
}>;
guests: z.ZodNumber;
originalCapacity: z.ZodNumber;
}, "id" | "tableNumber">, "strip", z.ZodTypeAny, {
id: number;
tableNumber: number;
}, {
id: number;
tableNumber: number;
}>, "many">;
}, "strip", z.ZodTypeAny, {
time: Date;
reservationId: number;
tables: {
id: number;
tableNumber: number;
}[];
}, {
time: string | Date;
reservationId: number;
tables: {
id: number;
tableNumber: number;
}[];
}>, "many">;
}, "strip", z.ZodTypeAny, {
reservation: {
status: "PENDING" | "CONFIRMED" | "CANCELLED" | "COMPLETED" | "NO_SHOW";
id: number;
name: string;
createdAt: Date;
updatedAt: Date;
allergies: ("GLUTEN" | "DAIRY" | "EGG" | "PEANUT" | "TREENUT" | "FISH" | "SHELLFISH" | "SOY" | "SESAME" | "CELERY" | "MUSTARD" | "LUPIN" | "SULPHITES" | "MOLLUSCS")[];
guestsCount: number;
isActive: boolean;
time: Date;
phone: string;
tables: {
id: number;
tableNumber: number;
}[];
comments?: string | null | undefined;
email?: string | null | undefined;
};
conflict: {
time: Date;
reservationId: number;
tables: {
id: number;
tableNumber: number;
}[];
}[];
}, {
reservation: {
id: number;
name: string;
updatedAt: Date;
allergies: string | string[];
guestsCount: number;
time: string | Date;
phone: string;
tables: {
id: number;
tableNumber: number;
}[];
status?: string | undefined;
createdAt?: Date | undefined;
comments?: string | null | undefined;
email?: string | null | undefined;
isActive?: string | boolean | undefined;
};
conflict: {
time: string | Date;
reservationId: number;
tables: {
id: number;
tableNumber: number;
}[];
}[];
}>;
/**
* Type representing detailed reservation information, including conflicts.
*/
export type ReservationDetailedDTO = z.infer<typeof ReservationDetailedSchema>;
/**
* Schema for updating a reservation.
*
* This schema is derived from `ReservationSchema` by omitting the fields
* `createdAt`, `updatedAt`, and `id`. The resulting schema is then made
* partially optional, meaning that any of the remaining fields can be
* provided, but none are required.
*
* Additionally, a refinement is added to ensure that at least one field
* is provided when updating a reservation. If no fields are provided,
* an error message "At least one field must be provided to update a reservation."
* will be returned.
*/
export declare const UpdateReservationSchema: z.ZodEffects<z.ZodObject<{
status: z.ZodOptional<z.ZodDefault<z.ZodPipeline<z.ZodEffects<z.ZodString, string, string>, z.ZodNativeEnum<{
readonly PENDING: "PENDING";
readonly CONFIRMED: "CONFIRMED";
readonly CANCELLED: "CANCELLED";
readonly COMPLETED: "COMPLETED";
readonly NO_SHOW: "NO_SHOW";
}>>>>;
name: z.ZodOptional<z.ZodString>;
allergies: z.ZodOptional<z.ZodPipeline<z.ZodUnion<[z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>, z.ZodEffects<z.ZodString, string[], string>]>, z.ZodArray<z.ZodNativeEnum<{
readonly GLUTEN: "GLUTEN";
readonly DAIRY: "DAIRY";
readonly EGG: "EGG";
readonly PEANUT: "PEANUT";
readonly TREENUT: "TREENUT";
readonly FISH: "FISH";
readonly SHELLFISH: "SHELLFISH";
readonly SOY: "SOY";
readonly SESAME: "SESAME";
readonly CELERY: "CELERY";
readonly MUSTARD: "MUSTARD";
readonly LUPIN: "LUPIN";
readonly SULPHITES: "SULPHITES";
readonly MOLLUSCS: "MOLLUSCS";
}>, "many">>>;
guestsCount: z.ZodOptional<z.ZodNumber>;
comments: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
email: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
isActive: z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodBoolean, z.ZodEffects<z.ZodString, boolean | undefined, string>]>>>;
time: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodString, Date, string>, z.ZodDate]>>;
phone: z.ZodOptional<z.ZodString>;
tables: z.ZodOptional<z.ZodPipeline<z.ZodUnion<[z.ZodArray<z.ZodObject<Pick<{
id: z.ZodNumber;
tableNumber: z.ZodNumber;
capacity: z.ZodNumber;
additionalCapacity: z.ZodNumber;
isOccupied: z.ZodBoolean;
status: z.ZodNativeEnum<{
readonly AVAILABLE: "AVAILABLE";
readonly OCCUPIED: "OCCUPIED";
readonly RESERVED: "RESERVED";
readonly ORDERING: "ORDERING";
readonly SERVING: "SERVING";
readonly PAYMENT: "PAYMENT";
}>;
guests: z.ZodNumber;
originalCapacity: z.ZodNumber;
}, "id">, "strip", z.ZodTypeAny, {
id: number;
}, {
id: number;
}>, "many">, z.ZodEffects<z.ZodString, number[], string>]>, z.ZodDefault<z.ZodArray<z.ZodNumber, "many">>>>;
}, "strip", z.ZodTypeAny, {
status?: "PENDING" | "CONFIRMED" | "CANCELLED" | "COMPLETED" | "NO_SHOW" | undefined;
name?: string | undefined;
allergies?: ("GLUTEN" | "DAIRY" | "EGG" | "PEANUT" | "TREENUT" | "FISH" | "SHELLFISH" | "SOY" | "SESAME" | "CELERY" | "MUSTARD" | "LUPIN" | "SULPHITES" | "MOLLUSCS")[] | undefined;
guestsCount?: number | undefined;
comments?: string | null | undefined;
email?: string | null | undefined;
isActive?: boolean | undefined;
time?: Date | undefined;
phone?: string | undefined;
tables?: number[] | undefined;
}, {
status?: string | undefined;
name?: string | undefined;
allergies?: string | string[] | undefined;
guestsCount?: number | undefined;
comments?: string | null | undefined;
email?: string | null | undefined;
isActive?: string | boolean | undefined;
time?: string | Date | undefined;
phone?: string | undefined;
tables?: string | {
id: number;
}[] | undefined;
}>, {
status?: "PENDING" | "CONFIRMED" | "CANCELLED" | "COMPLETED" | "NO_SHOW" | undefined;
name?: string | undefined;
allergies?: ("GLUTEN" | "DAIRY" | "EGG" | "PEANUT" | "TREENUT" | "FISH" | "SHELLFISH" | "SOY" | "SESAME" | "CELERY" | "MUSTARD" | "LUPIN" | "SULPHITES" | "MOLLUSCS")[] | undefined;
guestsCount?: number | undefined;
comments?: string | null | undefined;
email?: string | null | undefined;
isActive?: boolean | undefined;
time?: Date | undefined;
phone?: string | undefined;
tables?: number[] | undefined;
}, {
status?: string | undefined;
name?: string | undefined;
allergies?: string | string[] | undefined;
guestsCount?: number | undefined;
comments?: string | null | undefined;
email?: string | null | undefined;
isActive?: string | boolean | undefined;
time?: string | Date | undefined;
phone?: string | undefined;
tables?: string | {
id: number;
}[] | undefined;
}>;
/**
* Type representing the data transfer object (DTO) for updating a reservation.
* This type is inferred from the `UpdateReservationSchema` using Zod.
*/
export type UpdateReservationDTO = z.infer<typeof UpdateReservationSchema>;
/**
* Type representing the ID of a reservation.
*
* This type is inferred from the `id` shape of the `ReservationSchema`.
*/
export type ReservationId = z.infer<typeof ReservationSchema.shape.id>;
/**
* Schema for validating partial updates to reservation guest information.
*
* This schema allows partial updates by making all fields optional and
* ensures that at least one field is provided when updating a reservation.
*
* Fields:
* - `email`: The email address of the guest.
* - `name`: The name of the guest.
* - `phone`: The phone number of the guest.
* - `allergies`: Any allergies the guest may have.
* - `guestsCount`: The number of guests.
*
* Validation:
* - At least one field must be provided to update a reservation.
*
* @constant {object} ReservationGuestInfoSchema
*/
export declare const ReservationGuestInfoSchema: z.ZodEffects<z.ZodObject<{
name: z.ZodOptional<z.ZodString>;
allergies: z.ZodOptional<z.ZodPipeline<z.ZodUnion<[z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>, z.ZodEffects<z.ZodString, string[], string>]>, z.ZodArray<z.ZodNativeEnum<{
readonly GLUTEN: "GLUTEN";
readonly DAIRY: "DAIRY";
readonly EGG: "EGG";
readonly PEANUT: "PEANUT";
readonly TREENUT: "TREENUT";
readonly FISH: "FISH";
readonly SHELLFISH: "SHELLFISH";
readonly SOY: "SOY";
readonly SESAME: "SESAME";
readonly CELERY: "CELERY";
readonly MUSTARD: "MUSTARD";
readonly LUPIN: "LUPIN";
readonly SULPHITES: "SULPHITES";
readonly MOLLUSCS: "MOLLUSCS";
}>, "many">>>;
guestsCount: z.ZodOptional<z.ZodNumber>;
email: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
phone: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
name?: string | undefined;
allergies?: ("GLUTEN" | "DAIRY" | "EGG" | "PEANUT" | "TREENUT" | "FISH" | "SHELLFISH" | "SOY" | "SESAME" | "CELERY" | "MUSTARD" | "LUPIN" | "SULPHITES" | "MOLLUSCS")[] | undefined;
guestsCount?: number | undefined;
email?: string | null | undefined;
phone?: string | undefined;
}, {
name?: string | undefined;
allergies?: string | string[] | undefined;
guestsCount?: number | undefined;
email?: string | null | undefined;
phone?: string | undefined;
}>, {
name?: string | undefined;
allergies?: ("GLUTEN" | "DAIRY" | "EGG" | "PEANUT" | "TREENUT" | "FISH" | "SHELLFISH" | "SOY" | "SESAME" | "CELERY" | "MUSTARD" | "LUPIN" | "SULPHITES" | "MOLLUSCS")[] | undefined;
guestsCount?: number | undefined;
email?: string | null | undefined;
phone?: string | undefined;
}, {
name?: string | undefined;
allergies?: string | string[] | undefined;
guestsCount?: number | undefined;
email?: string | null | undefined;
phone?: string | undefined;
}>;
/**
* Type representing the guest information for a reservation.
*
* This type is inferred from the `ReservationGuestInfoSchema` using Zod's `infer` method.
*
* @see ReservationGuestInfoSchema
*/
export type ReservationGuestInfo = z.infer<typeof ReservationGuestInfoSchema>;
//# sourceMappingURL=reservation.dto.d.ts.map