@novha/anlia-core-lib 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cdk/bin/infrastructure.ts +18 -0
- package/cdk/bin/project-names.ts +7 -0
- package/cdk/lib/infrastructure.ts +37 -0
- package/cdk.json +70 -0
- package/dist/cdk/bin/infrastructure.d.ts +1 -0
- package/dist/cdk/bin/infrastructure.js +20 -0
- package/dist/cdk/bin/project-names.d.ts +6 -0
- package/dist/cdk/bin/project-names.js +4 -0
- package/dist/cdk/lib/infrastructure.d.ts +6 -0
- package/dist/cdk/lib/infrastructure.js +32 -0
- package/dist/src/enums/domain/DayOfWeek.d.ts +9 -0
- package/dist/src/enums/domain/DayOfWeek.js +13 -0
- package/dist/src/enums/domain/Delivery.d.ts +19 -0
- package/dist/src/enums/domain/Delivery.js +24 -0
- package/dist/src/enums/domain/Employee.d.ts +12 -0
- package/dist/src/enums/domain/Employee.js +16 -0
- package/dist/src/enums/domain/Ingredient.d.ts +31 -0
- package/dist/src/enums/domain/Ingredient.js +37 -0
- package/dist/src/enums/domain/Inventory.d.ts +29 -0
- package/dist/src/enums/domain/Inventory.js +36 -0
- package/dist/src/enums/domain/Kitchen.d.ts +49 -0
- package/dist/src/enums/domain/Kitchen.js +59 -0
- package/dist/src/enums/domain/Menu.d.ts +13 -0
- package/dist/src/enums/domain/Menu.js +18 -0
- package/dist/src/enums/domain/Payments.d.ts +21 -0
- package/dist/src/enums/domain/Payments.js +26 -0
- package/dist/src/enums/domain/Recipe.d.ts +14 -0
- package/dist/src/enums/domain/Recipe.js +19 -0
- package/dist/src/enums/domain/Reservation.d.ts +17 -0
- package/dist/src/enums/domain/Reservation.js +22 -0
- package/dist/src/enums/domain/Restaurant.d.ts +39 -0
- package/dist/src/enums/domain/Restaurant.js +45 -0
- package/dist/src/enums/domain/Table.d.ts +23 -0
- package/dist/src/enums/domain/Table.js +29 -0
- package/dist/src/enums/domain/Vendors.d.ts +29 -0
- package/dist/src/enums/domain/Vendors.js +35 -0
- package/dist/src/enums/index.d.ts +13 -0
- package/dist/src/enums/index.js +29 -0
- package/dist/src/eventBridge/EventBridgeModule.d.ts +2 -0
- package/dist/src/eventBridge/EventBridgeModule.js +26 -0
- package/dist/src/eventBridge/domain/EventBridgeOptions.d.ts +8 -0
- package/dist/src/eventBridge/domain/EventBridgeOptions.js +2 -0
- package/dist/src/eventBridge/ioc/index.d.ts +3 -0
- package/dist/src/eventBridge/ioc/index.js +6 -0
- package/dist/src/eventBridge/ioc.d.ts +3 -0
- package/dist/src/eventBridge/ioc.js +6 -0
- package/dist/src/eventBridge/service/EventBridgeService.d.ts +5 -0
- package/dist/src/eventBridge/service/EventBridgeService.js +2 -0
- package/dist/src/eventBridge/service/EventBridgeServiceImpl.d.ts +13 -0
- package/dist/src/eventBridge/service/EventBridgeServiceImpl.js +63 -0
- package/dist/src/events/domain/CustomerEvents.d.ts +54 -0
- package/dist/src/events/domain/CustomerEvents.js +2 -0
- package/dist/src/events/domain/DeliveryEvents.d.ts +61 -0
- package/dist/src/events/domain/DeliveryEvents.js +2 -0
- package/dist/src/events/domain/DomainEvent.d.ts +12 -0
- package/dist/src/events/domain/DomainEvent.js +2 -0
- package/dist/src/events/domain/DomainEventType.d.ts +119 -0
- package/dist/src/events/domain/DomainEventType.js +136 -0
- package/dist/src/events/domain/EmployeeEvents.d.ts +51 -0
- package/dist/src/events/domain/EmployeeEvents.js +2 -0
- package/dist/src/events/domain/InventoryEvents.d.ts +141 -0
- package/dist/src/events/domain/InventoryEvents.js +2 -0
- package/dist/src/events/domain/OrderEvents.d.ts +105 -0
- package/dist/src/events/domain/OrderEvents.js +2 -0
- package/dist/src/events/domain/PaymentEvents.d.ts +73 -0
- package/dist/src/events/domain/PaymentEvents.js +2 -0
- package/dist/src/events/domain/RecipeEvents.d.ts +45 -0
- package/dist/src/events/domain/RecipeEvents.js +2 -0
- package/dist/src/events/domain/ReservationEvents.d.ts +93 -0
- package/dist/src/events/domain/ReservationEvents.js +2 -0
- package/dist/src/events/domain/RestaurantEvents.d.ts +62 -0
- package/dist/src/events/domain/RestaurantEvents.js +2 -0
- package/dist/src/events/domain/TableEvents.d.ts +71 -0
- package/dist/src/events/domain/TableEvents.js +2 -0
- package/dist/src/events/domain/VendorEvents.d.ts +28 -0
- package/dist/src/events/domain/VendorEvents.js +2 -0
- package/dist/src/events/index.d.ts +13 -0
- package/dist/src/events/index.js +29 -0
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.js +20 -0
- package/dist/src/interfaces/Address.d.ts +7 -0
- package/dist/src/interfaces/Address.js +2 -0
- package/dist/src/interfaces/Customer.d.ts +21 -0
- package/dist/src/interfaces/Customer.js +2 -0
- package/dist/src/interfaces/Delivery.d.ts +62 -0
- package/dist/src/interfaces/Delivery.js +2 -0
- package/dist/src/interfaces/Employee.d.ts +19 -0
- package/dist/src/interfaces/Employee.js +2 -0
- package/dist/src/interfaces/Ingredient.d.ts +42 -0
- package/dist/src/interfaces/Ingredient.js +2 -0
- package/dist/src/interfaces/Inventory.d.ts +26 -0
- package/dist/src/interfaces/Inventory.js +2 -0
- package/dist/src/interfaces/Kitchen.d.ts +72 -0
- package/dist/src/interfaces/Kitchen.js +2 -0
- package/dist/src/interfaces/Location.d.ts +14 -0
- package/dist/src/interfaces/Location.js +2 -0
- package/dist/src/interfaces/Menu.d.ts +72 -0
- package/dist/src/interfaces/Menu.js +2 -0
- package/dist/src/interfaces/Money.d.ts +5 -0
- package/dist/src/interfaces/Money.js +2 -0
- package/dist/src/interfaces/OpeningHours.d.ts +7 -0
- package/dist/src/interfaces/OpeningHours.js +2 -0
- package/dist/src/interfaces/Payment.d.ts +36 -0
- package/dist/src/interfaces/Payment.js +2 -0
- package/dist/src/interfaces/Recipe.d.ts +58 -0
- package/dist/src/interfaces/Recipe.js +2 -0
- package/dist/src/interfaces/Resevation.d.ts +25 -0
- package/dist/src/interfaces/Resevation.js +2 -0
- package/dist/src/interfaces/Restaurant.d.ts +24 -0
- package/dist/src/interfaces/Restaurant.js +2 -0
- package/dist/src/interfaces/Table.d.ts +54 -0
- package/dist/src/interfaces/Table.js +2 -0
- package/dist/src/interfaces/Vendor.d.ts +19 -0
- package/dist/src/interfaces/Vendor.js +2 -0
- package/dist/src/interfaces/domain/Address.d.ts +7 -0
- package/dist/src/interfaces/domain/Address.js +2 -0
- package/dist/src/interfaces/domain/Customer.d.ts +21 -0
- package/dist/src/interfaces/domain/Customer.js +2 -0
- package/dist/src/interfaces/domain/Delivery.d.ts +62 -0
- package/dist/src/interfaces/domain/Delivery.js +2 -0
- package/dist/src/interfaces/domain/Employee.d.ts +19 -0
- package/dist/src/interfaces/domain/Employee.js +2 -0
- package/dist/src/interfaces/domain/Ingredient.d.ts +42 -0
- package/dist/src/interfaces/domain/Ingredient.js +2 -0
- package/dist/src/interfaces/domain/Inventory.d.ts +26 -0
- package/dist/src/interfaces/domain/Inventory.js +2 -0
- package/dist/src/interfaces/domain/Kitchen.d.ts +72 -0
- package/dist/src/interfaces/domain/Kitchen.js +2 -0
- package/dist/src/interfaces/domain/Location.d.ts +14 -0
- package/dist/src/interfaces/domain/Location.js +2 -0
- package/dist/src/interfaces/domain/Menu.d.ts +72 -0
- package/dist/src/interfaces/domain/Menu.js +2 -0
- package/dist/src/interfaces/domain/Money.d.ts +5 -0
- package/dist/src/interfaces/domain/Money.js +2 -0
- package/dist/src/interfaces/domain/OpeningHours.d.ts +7 -0
- package/dist/src/interfaces/domain/OpeningHours.js +2 -0
- package/dist/src/interfaces/domain/Payment.d.ts +36 -0
- package/dist/src/interfaces/domain/Payment.js +2 -0
- package/dist/src/interfaces/domain/Recipe.d.ts +58 -0
- package/dist/src/interfaces/domain/Recipe.js +2 -0
- package/dist/src/interfaces/domain/Reservation.d.ts +25 -0
- package/dist/src/interfaces/domain/Reservation.js +2 -0
- package/dist/src/interfaces/domain/Restaurant.d.ts +24 -0
- package/dist/src/interfaces/domain/Restaurant.js +2 -0
- package/dist/src/interfaces/domain/Table.d.ts +54 -0
- package/dist/src/interfaces/domain/Table.js +2 -0
- package/dist/src/interfaces/domain/Vendor.d.ts +19 -0
- package/dist/src/interfaces/domain/Vendor.js +2 -0
- package/dist/src/interfaces/index.d.ts +17 -0
- package/dist/src/interfaces/index.js +33 -0
- package/dist/src/orders/OrderModule.d.ts +2 -0
- package/dist/src/orders/OrderModule.js +28 -0
- package/dist/src/orders/domain/Enums.d.ts +16 -0
- package/dist/src/orders/domain/Enums.js +21 -0
- package/dist/src/orders/domain/Order.d.ts +89 -0
- package/dist/src/orders/domain/Order.js +2 -0
- package/dist/src/orders/domain/OrderItem.d.ts +53 -0
- package/dist/src/orders/domain/OrderItem.js +2 -0
- package/dist/src/orders/domain/posDto/SquareOrder.d.ts +347 -0
- package/dist/src/orders/domain/posDto/SquareOrder.js +8 -0
- package/dist/src/orders/index.d.ts +7 -0
- package/dist/src/orders/index.js +25 -0
- package/dist/src/orders/ioc/index.d.ts +3 -0
- package/dist/src/orders/ioc/index.js +6 -0
- package/dist/src/orders/services/square/SquareOrderService.d.ts +22 -0
- package/dist/src/orders/services/square/SquareOrderService.js +4 -0
- package/dist/src/orders/services/square/SquareOrderServiceImpl.d.ts +32 -0
- package/dist/src/orders/services/square/SquareOrderServiceImpl.js +308 -0
- package/jest.config.js +8 -0
- package/package.json +43 -0
- package/src/enums/domain/DayOfWeek.ts +9 -0
- package/src/enums/domain/Delivery.ts +20 -0
- package/src/enums/domain/Employee.ts +12 -0
- package/src/enums/domain/Ingredient.ts +33 -0
- package/src/enums/domain/Inventory.ts +39 -0
- package/src/enums/domain/Kitchen.ts +89 -0
- package/src/enums/domain/Menu.ts +14 -0
- package/src/enums/domain/Payments.ts +41 -0
- package/src/enums/domain/Recipe.ts +15 -0
- package/src/enums/domain/Reservation.ts +18 -0
- package/src/enums/domain/Restaurant.ts +41 -0
- package/src/enums/domain/Table.ts +39 -0
- package/src/enums/domain/Vendors.ts +45 -0
- package/src/enums/index.ts +13 -0
- package/src/eventBridge/EventBridgeModule.ts +14 -0
- package/src/eventBridge/domain/EventBridgeOptions.ts +8 -0
- package/src/eventBridge/ioc/index.ts +3 -0
- package/src/eventBridge/ioc.ts +3 -0
- package/src/eventBridge/service/EventBridgeService.ts +8 -0
- package/src/eventBridge/service/EventBridgeServiceImpl.ts +67 -0
- package/src/events/domain/CustomerEvents.ts +79 -0
- package/src/events/domain/DeliveryEvents.ts +82 -0
- package/src/events/domain/DomainEvent.ts +17 -0
- package/src/events/domain/DomainEventType.ts +143 -0
- package/src/events/domain/EmployeeEvents.ts +74 -0
- package/src/events/domain/InventoryEvents.ts +184 -0
- package/src/events/domain/OrderEvents.ts +142 -0
- package/src/events/domain/PaymentEvents.ts +92 -0
- package/src/events/domain/RecipeEvents.ts +64 -0
- package/src/events/domain/ReservationEvents.ts +133 -0
- package/src/events/domain/RestaurantEvents.ts +89 -0
- package/src/events/domain/TableEvents.ts +102 -0
- package/src/events/domain/VendorEvents.ts +42 -0
- package/src/events/index.ts +13 -0
- package/src/index.ts +4 -0
- package/src/interfaces/domain/Address.ts +7 -0
- package/src/interfaces/domain/Customer.ts +33 -0
- package/src/interfaces/domain/Delivery.ts +96 -0
- package/src/interfaces/domain/Employee.ts +29 -0
- package/src/interfaces/domain/Ingredient.ts +68 -0
- package/src/interfaces/domain/Inventory.ts +52 -0
- package/src/interfaces/domain/Kitchen.ts +128 -0
- package/src/interfaces/domain/Location.ts +20 -0
- package/src/interfaces/domain/Menu.ts +121 -0
- package/src/interfaces/domain/Money.ts +6 -0
- package/src/interfaces/domain/OpeningHours.ts +11 -0
- package/src/interfaces/domain/Payment.ts +45 -0
- package/src/interfaces/domain/Recipe.ts +91 -0
- package/src/interfaces/domain/Reservation.ts +45 -0
- package/src/interfaces/domain/Restaurant.ts +45 -0
- package/src/interfaces/domain/Table.ts +69 -0
- package/src/interfaces/domain/Vendor.ts +35 -0
- package/src/interfaces/index.ts +17 -0
- package/src/orders/OrderModule.ts +17 -0
- package/src/orders/domain/Enums.ts +17 -0
- package/src/orders/domain/Order.ts +109 -0
- package/src/orders/domain/OrderItem.ts +68 -0
- package/src/orders/domain/posDto/SquareOrder.ts +346 -0
- package/src/orders/index.ts +7 -0
- package/src/orders/ioc/index.ts +3 -0
- package/src/orders/services/square/SquareOrderService.ts +27 -0
- package/src/orders/services/square/SquareOrderServiceImpl.ts +330 -0
- package/tsconfig.json +18 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
|
|
2
|
+
import { MenuItemStatus, MenuStatus } from "../../enums/domain/Menu";
|
|
3
|
+
import { Money } from "./Money";
|
|
4
|
+
|
|
5
|
+
export interface IMenuItemModifierOption {
|
|
6
|
+
id: string;
|
|
7
|
+
|
|
8
|
+
name: string;
|
|
9
|
+
|
|
10
|
+
/** Additional cost on top of the item's base price. */
|
|
11
|
+
additionalPrice?: Money;
|
|
12
|
+
|
|
13
|
+
isDefault?: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface IMenuItemModifier {
|
|
17
|
+
id: string;
|
|
18
|
+
|
|
19
|
+
/** Display name of the modifier group (e.g. "Choose a size"). */
|
|
20
|
+
name: string;
|
|
21
|
+
|
|
22
|
+
required: boolean;
|
|
23
|
+
|
|
24
|
+
/** Minimum number of selections. */
|
|
25
|
+
minSelections: number;
|
|
26
|
+
|
|
27
|
+
/** Maximum number of selections (undefined = unlimited). */
|
|
28
|
+
maxSelections?: number;
|
|
29
|
+
|
|
30
|
+
options: IMenuItemModifierOption[];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface IMenuCategory {
|
|
34
|
+
id: string;
|
|
35
|
+
|
|
36
|
+
menuId: string;
|
|
37
|
+
|
|
38
|
+
name: string;
|
|
39
|
+
|
|
40
|
+
description?: string;
|
|
41
|
+
|
|
42
|
+
/** Display order among sibling categories. */
|
|
43
|
+
sortOrder: number;
|
|
44
|
+
|
|
45
|
+
imageUrl?: string;
|
|
46
|
+
|
|
47
|
+
isActive: boolean;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface IMenuItem {
|
|
51
|
+
id: string;
|
|
52
|
+
|
|
53
|
+
restaurantId: string;
|
|
54
|
+
|
|
55
|
+
menuId: string;
|
|
56
|
+
|
|
57
|
+
categoryId: string;
|
|
58
|
+
|
|
59
|
+
name: string;
|
|
60
|
+
|
|
61
|
+
description?: string;
|
|
62
|
+
|
|
63
|
+
price: Money;
|
|
64
|
+
|
|
65
|
+
status: MenuItemStatus;
|
|
66
|
+
|
|
67
|
+
/** Estimated kitchen preparation time in minutes. */
|
|
68
|
+
preparationTimeMinutes?: number;
|
|
69
|
+
|
|
70
|
+
/** Link to the recipe or production spec. */
|
|
71
|
+
recipeId?: string;
|
|
72
|
+
|
|
73
|
+
allergens?: string[];
|
|
74
|
+
|
|
75
|
+
modifiers?: IMenuItemModifier[];
|
|
76
|
+
|
|
77
|
+
imageUrl?: string;
|
|
78
|
+
|
|
79
|
+
/** Display order within its category. */
|
|
80
|
+
sortOrder: number;
|
|
81
|
+
|
|
82
|
+
isAvailable: boolean;
|
|
83
|
+
|
|
84
|
+
/** Calorie count for nutritional display. */
|
|
85
|
+
calories?: number;
|
|
86
|
+
|
|
87
|
+
tags?: string[];
|
|
88
|
+
|
|
89
|
+
createdAt: Date;
|
|
90
|
+
|
|
91
|
+
updatedAt: Date;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface IMenu {
|
|
95
|
+
id: string;
|
|
96
|
+
|
|
97
|
+
restaurantId: string;
|
|
98
|
+
|
|
99
|
+
/** Optional location scope — null means the menu applies to all locations. */
|
|
100
|
+
locationId?: string;
|
|
101
|
+
|
|
102
|
+
name: string;
|
|
103
|
+
|
|
104
|
+
description?: string;
|
|
105
|
+
|
|
106
|
+
status: MenuStatus;
|
|
107
|
+
|
|
108
|
+
categories: IMenuCategory[];
|
|
109
|
+
|
|
110
|
+
items: IMenuItem[];
|
|
111
|
+
|
|
112
|
+
/** ISO 8601 date-time when the menu becomes effective. */
|
|
113
|
+
validFrom?: Date;
|
|
114
|
+
|
|
115
|
+
/** ISO 8601 date-time when the menu expires. */
|
|
116
|
+
validUntil?: Date;
|
|
117
|
+
|
|
118
|
+
createdAt: Date;
|
|
119
|
+
|
|
120
|
+
updatedAt: Date;
|
|
121
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { PaymentMethod, PaymentStatus } from "../../enums/domain/Payments";
|
|
2
|
+
import { Money } from "./Money";
|
|
3
|
+
|
|
4
|
+
export interface IPayment {
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal payment identifier.
|
|
8
|
+
*/
|
|
9
|
+
id: string;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Vendor payment identifier.
|
|
13
|
+
*/
|
|
14
|
+
externalId?: string;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Payment method.
|
|
18
|
+
*/
|
|
19
|
+
method: PaymentMethod;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Payment amount.
|
|
23
|
+
*/
|
|
24
|
+
amount: Money;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Payment status.
|
|
28
|
+
*/
|
|
29
|
+
status: PaymentStatus;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Authorization code.
|
|
33
|
+
*/
|
|
34
|
+
authorizationCode?: string;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Transaction reference.
|
|
38
|
+
*/
|
|
39
|
+
reference?: string;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Paid timestamp.
|
|
43
|
+
*/
|
|
44
|
+
paidAt: Date;
|
|
45
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { InventoryUnit } from "../../enums/domain/Inventory";
|
|
2
|
+
import { AllergenType, DietaryFlag } from "../../enums/domain/Ingredient";
|
|
3
|
+
import { INutritionalInfo } from "./Ingredient";
|
|
4
|
+
import { RecipeStatus, RecipeYieldUnit } from "../../enums/domain/Recipe";
|
|
5
|
+
|
|
6
|
+
export interface IRecipeIngredient {
|
|
7
|
+
ingredientId: string;
|
|
8
|
+
|
|
9
|
+
/** Display name snapshot (denormalised for readability). */
|
|
10
|
+
name: string;
|
|
11
|
+
|
|
12
|
+
quantity: number;
|
|
13
|
+
|
|
14
|
+
unit: InventoryUnit;
|
|
15
|
+
|
|
16
|
+
/** If true this ingredient can be omitted without breaking the recipe. */
|
|
17
|
+
optional: boolean;
|
|
18
|
+
|
|
19
|
+
notes?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface IRecipeStep {
|
|
23
|
+
/** 1-based step number. */
|
|
24
|
+
stepNumber: number;
|
|
25
|
+
|
|
26
|
+
instruction: string;
|
|
27
|
+
|
|
28
|
+
/** Estimated time to complete this step in minutes. */
|
|
29
|
+
durationMinutes?: number;
|
|
30
|
+
|
|
31
|
+
/** Equipment required for this step (e.g. "Stand mixer", "Salamander"). */
|
|
32
|
+
equipment?: string[];
|
|
33
|
+
|
|
34
|
+
imageUrl?: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface IRecipe {
|
|
38
|
+
id: string;
|
|
39
|
+
|
|
40
|
+
restaurantId: string;
|
|
41
|
+
|
|
42
|
+
/** Display name of the recipe. */
|
|
43
|
+
name: string;
|
|
44
|
+
|
|
45
|
+
description?: string;
|
|
46
|
+
|
|
47
|
+
status: RecipeStatus;
|
|
48
|
+
|
|
49
|
+
/** ID of the menu item this recipe produces, if applicable. */
|
|
50
|
+
menuItemId?: string;
|
|
51
|
+
|
|
52
|
+
ingredients: IRecipeIngredient[];
|
|
53
|
+
|
|
54
|
+
steps: IRecipeStep[];
|
|
55
|
+
|
|
56
|
+
/** Number of portions (or other yield units) this recipe produces. */
|
|
57
|
+
yieldQuantity: number;
|
|
58
|
+
|
|
59
|
+
yieldUnit: RecipeYieldUnit;
|
|
60
|
+
|
|
61
|
+
/** Total preparation time in minutes (before cooking). */
|
|
62
|
+
prepTimeMinutes?: number;
|
|
63
|
+
|
|
64
|
+
/** Total cooking/baking time in minutes. */
|
|
65
|
+
cookTimeMinutes?: number;
|
|
66
|
+
|
|
67
|
+
allergens?: AllergenType[];
|
|
68
|
+
|
|
69
|
+
dietaryFlags?: DietaryFlag[];
|
|
70
|
+
|
|
71
|
+
/** Aggregated nutritional info for one yield unit of this recipe. */
|
|
72
|
+
nutritionalInfo?: INutritionalInfo;
|
|
73
|
+
|
|
74
|
+
/** Internal cost to produce one yield unit, calculated from ingredients. */
|
|
75
|
+
costPerYield?: number;
|
|
76
|
+
|
|
77
|
+
/** URL to a reference photo or instructional video. */
|
|
78
|
+
imageUrl?: string;
|
|
79
|
+
|
|
80
|
+
/** Free-form chef notes or plating instructions. */
|
|
81
|
+
notes?: string;
|
|
82
|
+
|
|
83
|
+
/** Version counter — increment when the recipe changes. */
|
|
84
|
+
version: number;
|
|
85
|
+
|
|
86
|
+
createdBy?: string;
|
|
87
|
+
|
|
88
|
+
createdAt: Date;
|
|
89
|
+
|
|
90
|
+
updatedAt: Date;
|
|
91
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ReservationSource, ReservationStatus } from "../../enums/domain/Reservation";
|
|
2
|
+
|
|
3
|
+
export interface IReservation {
|
|
4
|
+
id: string;
|
|
5
|
+
|
|
6
|
+
restaurantId: string;
|
|
7
|
+
|
|
8
|
+
customerId: string;
|
|
9
|
+
|
|
10
|
+
// Booking information
|
|
11
|
+
reservationDate: Date;
|
|
12
|
+
startTime: string;
|
|
13
|
+
endTime: string;
|
|
14
|
+
|
|
15
|
+
partySize: number;
|
|
16
|
+
|
|
17
|
+
// Status tracking
|
|
18
|
+
status: ReservationStatus;
|
|
19
|
+
|
|
20
|
+
// Table assignment
|
|
21
|
+
tableIds: string[];
|
|
22
|
+
|
|
23
|
+
// Customer requests
|
|
24
|
+
specialRequests?: string;
|
|
25
|
+
|
|
26
|
+
// Contact snapshot
|
|
27
|
+
customerName: string;
|
|
28
|
+
customerPhone?: string;
|
|
29
|
+
customerEmail?: string;
|
|
30
|
+
|
|
31
|
+
// Source of booking
|
|
32
|
+
source: ReservationSource;
|
|
33
|
+
|
|
34
|
+
// Lifecycle timestamps
|
|
35
|
+
createdAt: Date;
|
|
36
|
+
updatedAt: Date;
|
|
37
|
+
cancelledAt?: Date;
|
|
38
|
+
confirmedAt?: Date;
|
|
39
|
+
checkedInAt?: Date;
|
|
40
|
+
completedAt?: Date;
|
|
41
|
+
|
|
42
|
+
// Staff handling
|
|
43
|
+
createdBy?: string;
|
|
44
|
+
assignedEmployeeId?: string;
|
|
45
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { CuisineType, RestaurantStatus, RestaurantType } from "../../enums/domain/Restaurant";
|
|
2
|
+
import { IAddress } from "./Address";
|
|
3
|
+
import { OperatingHours } from "./OpeningHours";
|
|
4
|
+
|
|
5
|
+
export interface IRestaurant {
|
|
6
|
+
id: string;
|
|
7
|
+
|
|
8
|
+
// Basic Information
|
|
9
|
+
name: string;
|
|
10
|
+
legalName?: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
|
|
13
|
+
// Contact Information
|
|
14
|
+
email?: string;
|
|
15
|
+
phone?: string;
|
|
16
|
+
website?: string;
|
|
17
|
+
|
|
18
|
+
// Address
|
|
19
|
+
address: IAddress;
|
|
20
|
+
|
|
21
|
+
// Business Information
|
|
22
|
+
businessType: RestaurantType;
|
|
23
|
+
cuisineTypes: CuisineType[];
|
|
24
|
+
|
|
25
|
+
// Operating Hours
|
|
26
|
+
operatingHours: OperatingHours[];
|
|
27
|
+
|
|
28
|
+
// Time & Currency
|
|
29
|
+
timezone: string;
|
|
30
|
+
currency: string;
|
|
31
|
+
locale: string;
|
|
32
|
+
|
|
33
|
+
// Capacity
|
|
34
|
+
seatingCapacity?: number;
|
|
35
|
+
|
|
36
|
+
// Status
|
|
37
|
+
status: RestaurantStatus;
|
|
38
|
+
|
|
39
|
+
// Branding
|
|
40
|
+
logoUrl?: string;
|
|
41
|
+
|
|
42
|
+
// Audit
|
|
43
|
+
createdAt: Date;
|
|
44
|
+
updatedAt: Date;
|
|
45
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { TableArea, TableShape, TableStatus } from "../../enums/domain/Table";
|
|
2
|
+
|
|
3
|
+
export interface ITablePosition {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
|
|
7
|
+
rotation?: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface ITable {
|
|
11
|
+
id: string;
|
|
12
|
+
|
|
13
|
+
restaurantId: string;
|
|
14
|
+
locationId?: string;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Human-readable table number or identifier.
|
|
18
|
+
* Examples: "1", "12", "A5", "Patio-3"
|
|
19
|
+
*/
|
|
20
|
+
number: string;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Optional display name.
|
|
24
|
+
*/
|
|
25
|
+
name?: string;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Number of guests this table can comfortably seat.
|
|
29
|
+
*/
|
|
30
|
+
capacity: number;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Physical area of the restaurant.
|
|
34
|
+
*/
|
|
35
|
+
area?: TableArea;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Shape of the table.
|
|
39
|
+
*/
|
|
40
|
+
shape?: TableShape;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Current operational status.
|
|
44
|
+
*/
|
|
45
|
+
status: TableStatus;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Can this table be combined with others?
|
|
49
|
+
*/
|
|
50
|
+
combinable: boolean;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* IDs of tables that may be combined with this one.
|
|
54
|
+
*/
|
|
55
|
+
combinableTableIds?: string[];
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Optional floor plan coordinates.
|
|
59
|
+
*/
|
|
60
|
+
position?: ITablePosition;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Notes visible to staff.
|
|
64
|
+
*/
|
|
65
|
+
notes?: string;
|
|
66
|
+
|
|
67
|
+
createdAt: Date;
|
|
68
|
+
updatedAt: Date;
|
|
69
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Vendor, VendorStatus, VendorType } from "../../enums/domain/Vendors";
|
|
2
|
+
import { IAddress } from "./Address";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export interface IVendor {
|
|
6
|
+
id: string;
|
|
7
|
+
|
|
8
|
+
restaurantId: string;
|
|
9
|
+
|
|
10
|
+
name: string;
|
|
11
|
+
|
|
12
|
+
vendorCode: Vendor;
|
|
13
|
+
|
|
14
|
+
type: VendorType;
|
|
15
|
+
|
|
16
|
+
status: VendorStatus;
|
|
17
|
+
|
|
18
|
+
contactName?: string;
|
|
19
|
+
|
|
20
|
+
email?: string;
|
|
21
|
+
|
|
22
|
+
phoneNumber?: string;
|
|
23
|
+
|
|
24
|
+
address?: IAddress;
|
|
25
|
+
|
|
26
|
+
taxId?: string;
|
|
27
|
+
|
|
28
|
+
website?: string;
|
|
29
|
+
|
|
30
|
+
notes?: string;
|
|
31
|
+
|
|
32
|
+
createdAt: Date;
|
|
33
|
+
|
|
34
|
+
updatedAt: Date;
|
|
35
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from "./domain/Address";
|
|
2
|
+
export * from "./domain/Employee";
|
|
3
|
+
export * from "./domain/Inventory";
|
|
4
|
+
export * from "./domain/Kitchen";
|
|
5
|
+
export * from "./domain/Menu";
|
|
6
|
+
export * from "./domain/Payment";
|
|
7
|
+
export * from "./domain/Recipe";
|
|
8
|
+
export * from "./domain/Restaurant";
|
|
9
|
+
export * from "./domain/Table";
|
|
10
|
+
export * from "./domain/Vendor";
|
|
11
|
+
export * from "./domain/Delivery";
|
|
12
|
+
export * from "./domain/Ingredient";
|
|
13
|
+
export * from "./domain/Customer";
|
|
14
|
+
export * from "./domain/Money";
|
|
15
|
+
export * from "./domain/Location";
|
|
16
|
+
export * from "./domain/Reservation";
|
|
17
|
+
export * from "./domain/OpeningHours";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Module } from "@nestjs/common";
|
|
2
|
+
import { EventBridgeModule } from "../eventBridge/EventBridgeModule";
|
|
3
|
+
import { SquareOrderServiceImpl } from "./services/square/SquareOrderServiceImpl";
|
|
4
|
+
import { OrderSymbols } from "./ioc";
|
|
5
|
+
|
|
6
|
+
@Module({
|
|
7
|
+
imports: [EventBridgeModule],
|
|
8
|
+
providers: [
|
|
9
|
+
{
|
|
10
|
+
provide: OrderSymbols.SquareOrderService,
|
|
11
|
+
useClass: SquareOrderServiceImpl,
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
exports: [OrderSymbols.SquareOrderService],
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
export class OrderModule {}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export enum OrderType {
|
|
2
|
+
DINE_IN = "DINE_IN",
|
|
3
|
+
TAKEAWAY = "TAKEAWAY",
|
|
4
|
+
DELIVERY = "DELIVERY",
|
|
5
|
+
CURBSIDE = "CURBSIDE",
|
|
6
|
+
DRIVE_THROUGH = "DRIVE_THROUGH"
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export enum OrderStatus {
|
|
10
|
+
PENDING = "PENDING",
|
|
11
|
+
ACCEPTED = "ACCEPTED",
|
|
12
|
+
IN_PROGRESS = "IN_PROGRESS",
|
|
13
|
+
READY = "READY",
|
|
14
|
+
COMPLETED = "COMPLETED",
|
|
15
|
+
CANCELLED = "CANCELLED",
|
|
16
|
+
REFUNDED = "REFUNDED"
|
|
17
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { ICustomer } from "../../interfaces/domain/Customer";
|
|
2
|
+
import { IEmployee } from "../../interfaces/domain/Employee";
|
|
3
|
+
import { Money } from "../../interfaces/domain/Money";
|
|
4
|
+
import { IOrderItem } from "./OrderItem";
|
|
5
|
+
import { OrderStatus, OrderType } from "./Enums";
|
|
6
|
+
import { IPayment } from "../../interfaces/domain/Payment";
|
|
7
|
+
import { IVendor } from "../../interfaces/domain/Vendor";
|
|
8
|
+
|
|
9
|
+
export interface IOrder {
|
|
10
|
+
/**
|
|
11
|
+
* Unique order identifier in your platform.
|
|
12
|
+
*/
|
|
13
|
+
id: string;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Original vendor order identifier.
|
|
17
|
+
*/
|
|
18
|
+
externalId: string;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Restaurant that owns the order.
|
|
22
|
+
*/
|
|
23
|
+
restaurantId: string;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* POS vendor.
|
|
27
|
+
*/
|
|
28
|
+
vendor: IVendor;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Location/branch.
|
|
32
|
+
*/
|
|
33
|
+
locationId: string;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Customer (optional).
|
|
37
|
+
*/
|
|
38
|
+
customer?: ICustomer;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Employee who created the order.
|
|
42
|
+
*/
|
|
43
|
+
employee?: IEmployee;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Ordered items.
|
|
47
|
+
*/
|
|
48
|
+
items: IOrderItem[];
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Current order status.
|
|
52
|
+
*/
|
|
53
|
+
status: OrderStatus;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Order type.
|
|
57
|
+
*/
|
|
58
|
+
type: OrderType;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Subtotal before discounts and taxes.
|
|
62
|
+
*/
|
|
63
|
+
subtotal: Money;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Total discount.
|
|
67
|
+
*/
|
|
68
|
+
discount: Money;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Total tax.
|
|
72
|
+
*/
|
|
73
|
+
tax: Money;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Tip amount.
|
|
77
|
+
*/
|
|
78
|
+
tip: Money;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Final amount paid.
|
|
82
|
+
*/
|
|
83
|
+
total: Money;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Payment information.
|
|
87
|
+
*/
|
|
88
|
+
payments: IPayment[];
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Optional notes.
|
|
92
|
+
*/
|
|
93
|
+
notes?: string;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Date/time the order was created.
|
|
97
|
+
*/
|
|
98
|
+
createdAt: Date;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Date/time last updated.
|
|
102
|
+
*/
|
|
103
|
+
updatedAt: Date;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Date/time completed.
|
|
107
|
+
*/
|
|
108
|
+
completedAt?: Date;
|
|
109
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Money } from "../../interfaces/domain/Money";
|
|
2
|
+
|
|
3
|
+
export interface IOrderItemModifier {
|
|
4
|
+
id: string;
|
|
5
|
+
|
|
6
|
+
name: string;
|
|
7
|
+
|
|
8
|
+
quantity?: number;
|
|
9
|
+
|
|
10
|
+
price?: Money;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface IOrderItem {
|
|
14
|
+
/**
|
|
15
|
+
* Unique identifier of the line item.
|
|
16
|
+
*/
|
|
17
|
+
id: string;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Product/Menu item identifier.
|
|
21
|
+
*/
|
|
22
|
+
productId: string;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Display name.
|
|
26
|
+
*/
|
|
27
|
+
name: string;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Category (Burger, Drinks, Dessert, etc.)
|
|
31
|
+
*/
|
|
32
|
+
category?: string;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Quantity ordered.
|
|
36
|
+
*/
|
|
37
|
+
quantity: number;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Unit selling price.
|
|
41
|
+
*/
|
|
42
|
+
unitPrice: Money;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Total discount applied to this item.
|
|
46
|
+
*/
|
|
47
|
+
discount?: Money;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Tax applied to this item.
|
|
51
|
+
*/
|
|
52
|
+
tax?: Money;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Final total for this line.
|
|
56
|
+
*/
|
|
57
|
+
total: Money;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Optional modifiers.
|
|
61
|
+
*/
|
|
62
|
+
modifiers?: IOrderItemModifier[];
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Free-text note from customer.
|
|
66
|
+
*/
|
|
67
|
+
notes?: string;
|
|
68
|
+
}
|