@servemate/dto
Version:
Type-safe DTO package for ServeMate types and Zod validation. Shared across server and client.
356 lines • 13.9 kB
TypeScript
import { z } from 'zod';
/**
* Defines the options for sorting tables in the system.
*
*/
export declare const TableSortOptionsEnum: {
readonly ID: "id";
readonly TABLE_NUMBER: "tableNumber";
readonly CAPACITY: "capacity";
readonly STATUS: "status";
readonly SERVER_ID: "serverId";
readonly ORDER_TIME: "orderTime";
readonly IS_OCCUPIED: "isOccupied";
readonly WALK_IN: "walkIn";
readonly RESERVATION: "reservation";
};
export type TableSortOptions = (typeof TableSortOptionsEnum)[keyof typeof TableSortOptionsEnum];
export declare const SeatingType: {
readonly WALK_IN: "WALK_IN";
readonly RESERVATION: "RESERVATION";
};
export type SeatingType = (typeof SeatingType)[keyof typeof SeatingType];
/**
* Table-related schemas
*/
export declare const TableBaseTableSchema: z.ZodObject<{
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;
}, "strip", z.ZodTypeAny, {
status: "AVAILABLE" | "OCCUPIED" | "RESERVED" | "ORDERING" | "SERVING" | "PAYMENT";
id: number;
tableNumber: number;
capacity: number;
additionalCapacity: number;
isOccupied: boolean;
originalCapacity: number;
guests: number;
}, {
status: "AVAILABLE" | "OCCUPIED" | "RESERVED" | "ORDERING" | "SERVING" | "PAYMENT";
id: number;
tableNumber: number;
capacity: number;
additionalCapacity: number;
isOccupied: boolean;
originalCapacity: number;
guests: number;
}>;
export declare const TableSeatingSchema: 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;
}, "tableNumber" | "guests"> & {
reservationId: z.ZodOptional<z.ZodNumber>;
SeatingType: z.ZodDefault<z.ZodPipeline<z.ZodEffects<z.ZodString, string, string>, z.ZodNativeEnum<{
readonly WALK_IN: "WALK_IN";
readonly RESERVATION: "RESERVATION";
}>>>;
}, "strip", z.ZodTypeAny, {
tableNumber: number;
guests: number;
SeatingType: "WALK_IN" | "RESERVATION";
reservationId?: number | undefined;
}, {
tableNumber: number;
guests: number;
reservationId?: number | undefined;
SeatingType?: string | undefined;
}>;
export declare const TableAssignmentSchema: z.ZodObject<{
serverId: z.ZodNumber;
isPrimary: z.ZodDefault<z.ZodBoolean>;
assignedTables: z.ZodArray<z.ZodNumber, "many">;
}, "strip", z.ZodTypeAny, {
serverId: number;
isPrimary: boolean;
assignedTables: number[];
}, {
serverId: number;
assignedTables: number[];
isPrimary?: boolean | undefined;
}>;
export declare const TableSchema: z.ZodObject<{
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">>;
}, "strip", z.ZodTypeAny, {
status: "AVAILABLE" | "OCCUPIED" | "RESERVED" | "ORDERING" | "SERVING" | "PAYMENT";
id: number;
tableNumber: number;
capacity: number;
additionalCapacity: number;
isOccupied: boolean;
originalCapacity: number;
guests: number;
orders?: {
status: "COMPLETED" | "AWAITING" | "RECEIVED" | "SERVED" | "CANCELED" | "DISPUTED" | "READY_TO_PAY";
id: number;
orderTime: Date;
}[] | undefined;
assignment?: {
serverId: number;
isPrimary: boolean;
}[] | undefined;
}, {
status: "AVAILABLE" | "OCCUPIED" | "RESERVED" | "ORDERING" | "SERVING" | "PAYMENT";
id: number;
tableNumber: number;
capacity: number;
additionalCapacity: number;
isOccupied: boolean;
originalCapacity: number;
guests: number;
orders?: {
id: number;
orderTime: Date;
status?: "COMPLETED" | "AWAITING" | "RECEIVED" | "SERVED" | "CANCELED" | "DISPUTED" | "READY_TO_PAY" | undefined;
}[] | undefined;
assignment?: {
serverId: number;
isPrimary?: boolean | undefined;
}[] | undefined;
}>;
export declare const TableSearchCriteriaSchema: z.ZodObject<{
id: z.ZodEffects<z.ZodOptional<z.ZodString>, number | undefined, string | undefined>;
tableNumber: z.ZodOptional<z.ZodNumber>;
minCapacity: z.ZodOptional<z.ZodNumber>;
maxCapacity: z.ZodOptional<z.ZodNumber>;
isOccupied: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "true" | "false" | undefined>;
status: z.ZodOptional<z.ZodPipeline<z.ZodEffects<z.ZodString, string, string>, z.ZodNativeEnum<{
readonly AVAILABLE: "AVAILABLE";
readonly OCCUPIED: "OCCUPIED";
readonly RESERVED: "RESERVED";
readonly ORDERING: "ORDERING";
readonly SERVING: "SERVING";
readonly PAYMENT: "PAYMENT";
}>>>;
serverId: z.ZodOptional<z.ZodNumber>;
page: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
pageSize: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
sortBy: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodString>>, TableSortOptions, string | undefined>;
sortOrder: z.ZodDefault<z.ZodOptional<z.ZodEnum<["asc", "desc"]>>>;
}, "strip", z.ZodTypeAny, {
page: number;
pageSize: number;
sortOrder: "asc" | "desc";
sortBy: TableSortOptions;
status?: "AVAILABLE" | "OCCUPIED" | "RESERVED" | "ORDERING" | "SERVING" | "PAYMENT" | undefined;
id?: number | undefined;
tableNumber?: number | undefined;
serverId?: number | undefined;
isOccupied?: boolean | undefined;
minCapacity?: number | undefined;
maxCapacity?: number | undefined;
}, {
status?: string | undefined;
page?: number | undefined;
pageSize?: number | undefined;
sortOrder?: "asc" | "desc" | undefined;
id?: string | undefined;
sortBy?: string | undefined;
tableNumber?: number | undefined;
serverId?: number | undefined;
isOccupied?: "true" | "false" | undefined;
minCapacity?: number | undefined;
maxCapacity?: number | undefined;
}>;
export declare const TableCreateSchema: z.ZodObject<{
tableNumber: z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodNumber, z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, number, string>]>, number, string | number>, number, string | number>;
capacity: z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodNumber, z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, number, string>]>, number, string | number>, number, string | number>;
}, "strip", z.ZodTypeAny, {
tableNumber: number;
capacity: number;
}, {
tableNumber: string | number;
capacity: string | number;
}>;
export declare const TableUpdatesSchema: z.ZodObject<{
tableNumber: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodNumber, z.ZodEffects<z.ZodString, string, string>]>, number, string | number>, number, string | number>, number, string | number>>;
capacity: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodNumber, z.ZodEffects<z.ZodString, string, string>]>, number, string | number>, number, string | number>, number, string | number>>;
}, "strip", z.ZodTypeAny, {
tableNumber?: number | undefined;
capacity?: number | undefined;
}, {
tableNumber?: string | number | undefined;
capacity?: string | number | undefined;
}>;
export declare const TableIdSchema: z.ZodObject<{
id: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodNumber, z.ZodEffects<z.ZodString, string, string>]>, number, string | number>, number, string | number>, number, string | number>;
}, "strip", z.ZodTypeAny, {
id: number;
}, {
id: string | number;
}>;
/**
* Table-related types
*/
export type TablesDTO = z.infer<typeof TableSchema>;
/**
* Represents a table assignment in the restaurant management system.
* This type is inferred from the TableAssignmentSchema and includes details about
* the assignment of a server to a specific table.
*/
export type TableAssignment = z.infer<typeof TableAssignmentSchema>;
/**
* Represents the structure for creating a new table in the restaurant management system.
*
* @property {number} tableNumber - The number assigned to the table. Must be a positive integer.
* @property {number} capacity - The seating capacity of the table. Must be a positive integer.
*/
export type TableCreate = z.infer<typeof TableCreateSchema>;
/**
* Represents the search criteria for tables in the system.
*
* @property {number} [id] - The unique identifier of the table.
* @property {number} [tableNumber] - The number assigned to the table.
* @property {number} [minCapacity] - The minimum seating capacity of the table.
* @property {number} [maxCapacity] - The maximum seating capacity of the table.
* @property {boolean} [isOccupied] - Whether the table is currently occupied.
* @property {TableCondition} [status] - The current status of the table.
* @property {number} [serverId] - The ID of the server assigned to the table.
* @property {number} [page=1] - The page number for pagination (default: 1).
* @property {number} [pageSize=10] - The number of items per page (default: 10).
* @property {TableSortOptions} [sortBy] - The field to sort the results by.
* @property {'asc' | 'desc'} [sortOrder='asc'] - The order of sorting (default: 'asc').
*/
export type TableSearchCriteria = z.infer<typeof TableSearchCriteriaSchema> & {
page: number;
pageSize: number;
sortBy: TableSortOptions;
sortOrder: 'asc' | 'desc';
};
/**
* Represents a table list item derived from the TablesDTO type, excluding the 'originalCapacity' property.
*
* @typedef {Omit<TablesDTO, 'originalCapacity'>} TableListItem
*/
export type TableListItem = Omit<TablesDTO, 'originalCapacity'>;
export type TablesList = {
tables: TableListItem[];
totalCount: number;
page: number;
pageSize: number;
totalPages: number;
};
/**
* Represents the structure for updating an existing table.
*
* @property {number} [tableNumber] - The new number to assign to the table. Must be a positive integer.
* @property {number} [capacity] - The new seating capacity for the table. Must be a positive integer.
*/
export type TableUpdate = z.infer<typeof TableUpdatesSchema>;
/**
* Represents the structure for identifying a specific table.
*
* @property {number} id - The unique identifier of the table. Must be a positive integer.
*/
export type TableId = z.infer<typeof TableIdSchema>;
export type TableSeatingDTO = z.infer<typeof TableSeatingSchema>;
//# sourceMappingURL=tables.dto.d.ts.map