@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,72 @@
|
|
|
1
|
+
import { KitchenItemStatus, KitchenPriority, KitchenStationStatus, KitchenStationType, KitchenStatus, KitchenTicketStatus } from "../../enums/domain/Kitchen";
|
|
2
|
+
export interface KitchenStation {
|
|
3
|
+
id: string;
|
|
4
|
+
kitchenId: string;
|
|
5
|
+
name: string;
|
|
6
|
+
type: KitchenStationType;
|
|
7
|
+
status: KitchenStationStatus;
|
|
8
|
+
createdAt: Date;
|
|
9
|
+
}
|
|
10
|
+
export interface Kitchen {
|
|
11
|
+
id: string;
|
|
12
|
+
restaurantId: string;
|
|
13
|
+
name: string;
|
|
14
|
+
status: KitchenStatus;
|
|
15
|
+
stations: KitchenStation[];
|
|
16
|
+
createdAt: Date;
|
|
17
|
+
updatedAt: Date;
|
|
18
|
+
}
|
|
19
|
+
export interface KitchenTicket {
|
|
20
|
+
id: string;
|
|
21
|
+
restaurantId: string;
|
|
22
|
+
orderId: string;
|
|
23
|
+
stationId?: string;
|
|
24
|
+
items: KitchenTicketItem[];
|
|
25
|
+
status: KitchenTicketStatus;
|
|
26
|
+
priority: KitchenPriority;
|
|
27
|
+
createdAt: Date;
|
|
28
|
+
startedAt?: Date;
|
|
29
|
+
completedAt?: Date;
|
|
30
|
+
}
|
|
31
|
+
export interface KitchenTicketItem {
|
|
32
|
+
id: string;
|
|
33
|
+
/**
|
|
34
|
+
* Parent kitchen ticket
|
|
35
|
+
*/
|
|
36
|
+
kitchenTicketId: string;
|
|
37
|
+
/**
|
|
38
|
+
* Original order item reference
|
|
39
|
+
*/
|
|
40
|
+
orderItemId: string;
|
|
41
|
+
/**
|
|
42
|
+
* Menu item being prepared
|
|
43
|
+
*/
|
|
44
|
+
menuItemId: string;
|
|
45
|
+
/**
|
|
46
|
+
* Snapshot of item name at preparation time
|
|
47
|
+
* (important if menu changes later)
|
|
48
|
+
*/
|
|
49
|
+
menuItemName: string;
|
|
50
|
+
/**
|
|
51
|
+
* Number of items to prepare
|
|
52
|
+
*/
|
|
53
|
+
quantity: number;
|
|
54
|
+
/**
|
|
55
|
+
* Kitchen preparation status
|
|
56
|
+
*/
|
|
57
|
+
status: KitchenItemStatus;
|
|
58
|
+
/**
|
|
59
|
+
* Preparation instructions
|
|
60
|
+
*/
|
|
61
|
+
notes?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Which kitchen station handles it
|
|
64
|
+
*/
|
|
65
|
+
stationId?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Timing information
|
|
68
|
+
*/
|
|
69
|
+
startedAt?: Date;
|
|
70
|
+
completedAt?: Date;
|
|
71
|
+
createdAt: Date;
|
|
72
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface ILocation {
|
|
2
|
+
id?: string;
|
|
3
|
+
name?: string;
|
|
4
|
+
addressLine1: string;
|
|
5
|
+
addressLine2?: string;
|
|
6
|
+
city: string;
|
|
7
|
+
stateOrProvince: string;
|
|
8
|
+
postalCode: string;
|
|
9
|
+
country: string;
|
|
10
|
+
latitude?: number;
|
|
11
|
+
longitude?: number;
|
|
12
|
+
timezone?: string;
|
|
13
|
+
instructions?: string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { MenuItemStatus, MenuStatus } from "../../enums/domain/Menu";
|
|
2
|
+
import { Money } from "./Money";
|
|
3
|
+
export interface IMenuItemModifierOption {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
/** Additional cost on top of the item's base price. */
|
|
7
|
+
additionalPrice?: Money;
|
|
8
|
+
isDefault?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface IMenuItemModifier {
|
|
11
|
+
id: string;
|
|
12
|
+
/** Display name of the modifier group (e.g. "Choose a size"). */
|
|
13
|
+
name: string;
|
|
14
|
+
required: boolean;
|
|
15
|
+
/** Minimum number of selections. */
|
|
16
|
+
minSelections: number;
|
|
17
|
+
/** Maximum number of selections (undefined = unlimited). */
|
|
18
|
+
maxSelections?: number;
|
|
19
|
+
options: IMenuItemModifierOption[];
|
|
20
|
+
}
|
|
21
|
+
export interface IMenuCategory {
|
|
22
|
+
id: string;
|
|
23
|
+
menuId: string;
|
|
24
|
+
name: string;
|
|
25
|
+
description?: string;
|
|
26
|
+
/** Display order among sibling categories. */
|
|
27
|
+
sortOrder: number;
|
|
28
|
+
imageUrl?: string;
|
|
29
|
+
isActive: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface IMenuItem {
|
|
32
|
+
id: string;
|
|
33
|
+
restaurantId: string;
|
|
34
|
+
menuId: string;
|
|
35
|
+
categoryId: string;
|
|
36
|
+
name: string;
|
|
37
|
+
description?: string;
|
|
38
|
+
price: Money;
|
|
39
|
+
status: MenuItemStatus;
|
|
40
|
+
/** Estimated kitchen preparation time in minutes. */
|
|
41
|
+
preparationTimeMinutes?: number;
|
|
42
|
+
/** Link to the recipe or production spec. */
|
|
43
|
+
recipeId?: string;
|
|
44
|
+
allergens?: string[];
|
|
45
|
+
modifiers?: IMenuItemModifier[];
|
|
46
|
+
imageUrl?: string;
|
|
47
|
+
/** Display order within its category. */
|
|
48
|
+
sortOrder: number;
|
|
49
|
+
isAvailable: boolean;
|
|
50
|
+
/** Calorie count for nutritional display. */
|
|
51
|
+
calories?: number;
|
|
52
|
+
tags?: string[];
|
|
53
|
+
createdAt: Date;
|
|
54
|
+
updatedAt: Date;
|
|
55
|
+
}
|
|
56
|
+
export interface IMenu {
|
|
57
|
+
id: string;
|
|
58
|
+
restaurantId: string;
|
|
59
|
+
/** Optional location scope — null means the menu applies to all locations. */
|
|
60
|
+
locationId?: string;
|
|
61
|
+
name: string;
|
|
62
|
+
description?: string;
|
|
63
|
+
status: MenuStatus;
|
|
64
|
+
categories: IMenuCategory[];
|
|
65
|
+
items: IMenuItem[];
|
|
66
|
+
/** ISO 8601 date-time when the menu becomes effective. */
|
|
67
|
+
validFrom?: Date;
|
|
68
|
+
/** ISO 8601 date-time when the menu expires. */
|
|
69
|
+
validUntil?: Date;
|
|
70
|
+
createdAt: Date;
|
|
71
|
+
updatedAt: Date;
|
|
72
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { PaymentMethod, PaymentStatus } from "../../enums/domain/Payments";
|
|
2
|
+
import { Money } from "./Money";
|
|
3
|
+
export interface IPayment {
|
|
4
|
+
/**
|
|
5
|
+
* Internal payment identifier.
|
|
6
|
+
*/
|
|
7
|
+
id: string;
|
|
8
|
+
/**
|
|
9
|
+
* Vendor payment identifier.
|
|
10
|
+
*/
|
|
11
|
+
externalId?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Payment method.
|
|
14
|
+
*/
|
|
15
|
+
method: PaymentMethod;
|
|
16
|
+
/**
|
|
17
|
+
* Payment amount.
|
|
18
|
+
*/
|
|
19
|
+
amount: Money;
|
|
20
|
+
/**
|
|
21
|
+
* Payment status.
|
|
22
|
+
*/
|
|
23
|
+
status: PaymentStatus;
|
|
24
|
+
/**
|
|
25
|
+
* Authorization code.
|
|
26
|
+
*/
|
|
27
|
+
authorizationCode?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Transaction reference.
|
|
30
|
+
*/
|
|
31
|
+
reference?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Paid timestamp.
|
|
34
|
+
*/
|
|
35
|
+
paidAt: Date;
|
|
36
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
export interface IRecipeIngredient {
|
|
6
|
+
ingredientId: string;
|
|
7
|
+
/** Display name snapshot (denormalised for readability). */
|
|
8
|
+
name: string;
|
|
9
|
+
quantity: number;
|
|
10
|
+
unit: InventoryUnit;
|
|
11
|
+
/** If true this ingredient can be omitted without breaking the recipe. */
|
|
12
|
+
optional: boolean;
|
|
13
|
+
notes?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface IRecipeStep {
|
|
16
|
+
/** 1-based step number. */
|
|
17
|
+
stepNumber: number;
|
|
18
|
+
instruction: string;
|
|
19
|
+
/** Estimated time to complete this step in minutes. */
|
|
20
|
+
durationMinutes?: number;
|
|
21
|
+
/** Equipment required for this step (e.g. "Stand mixer", "Salamander"). */
|
|
22
|
+
equipment?: string[];
|
|
23
|
+
imageUrl?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface IRecipe {
|
|
26
|
+
id: string;
|
|
27
|
+
restaurantId: string;
|
|
28
|
+
/** Display name of the recipe. */
|
|
29
|
+
name: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
status: RecipeStatus;
|
|
32
|
+
/** ID of the menu item this recipe produces, if applicable. */
|
|
33
|
+
menuItemId?: string;
|
|
34
|
+
ingredients: IRecipeIngredient[];
|
|
35
|
+
steps: IRecipeStep[];
|
|
36
|
+
/** Number of portions (or other yield units) this recipe produces. */
|
|
37
|
+
yieldQuantity: number;
|
|
38
|
+
yieldUnit: RecipeYieldUnit;
|
|
39
|
+
/** Total preparation time in minutes (before cooking). */
|
|
40
|
+
prepTimeMinutes?: number;
|
|
41
|
+
/** Total cooking/baking time in minutes. */
|
|
42
|
+
cookTimeMinutes?: number;
|
|
43
|
+
allergens?: AllergenType[];
|
|
44
|
+
dietaryFlags?: DietaryFlag[];
|
|
45
|
+
/** Aggregated nutritional info for one yield unit of this recipe. */
|
|
46
|
+
nutritionalInfo?: INutritionalInfo;
|
|
47
|
+
/** Internal cost to produce one yield unit, calculated from ingredients. */
|
|
48
|
+
costPerYield?: number;
|
|
49
|
+
/** URL to a reference photo or instructional video. */
|
|
50
|
+
imageUrl?: string;
|
|
51
|
+
/** Free-form chef notes or plating instructions. */
|
|
52
|
+
notes?: string;
|
|
53
|
+
/** Version counter — increment when the recipe changes. */
|
|
54
|
+
version: number;
|
|
55
|
+
createdBy?: string;
|
|
56
|
+
createdAt: Date;
|
|
57
|
+
updatedAt: Date;
|
|
58
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ReservationSource, ReservationStatus } from "../../enums/domain/Reservation";
|
|
2
|
+
export interface IReservation {
|
|
3
|
+
id: string;
|
|
4
|
+
restaurantId: string;
|
|
5
|
+
customerId: string;
|
|
6
|
+
reservationDate: Date;
|
|
7
|
+
startTime: string;
|
|
8
|
+
endTime: string;
|
|
9
|
+
partySize: number;
|
|
10
|
+
status: ReservationStatus;
|
|
11
|
+
tableIds: string[];
|
|
12
|
+
specialRequests?: string;
|
|
13
|
+
customerName: string;
|
|
14
|
+
customerPhone?: string;
|
|
15
|
+
customerEmail?: string;
|
|
16
|
+
source: ReservationSource;
|
|
17
|
+
createdAt: Date;
|
|
18
|
+
updatedAt: Date;
|
|
19
|
+
cancelledAt?: Date;
|
|
20
|
+
confirmedAt?: Date;
|
|
21
|
+
checkedInAt?: Date;
|
|
22
|
+
completedAt?: Date;
|
|
23
|
+
createdBy?: string;
|
|
24
|
+
assignedEmployeeId?: string;
|
|
25
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { CuisineType, RestaurantStatus, RestaurantType } from "../../enums/domain/Restaurant";
|
|
2
|
+
import { IAddress } from "./Address";
|
|
3
|
+
import { OperatingHours } from "./OpeningHours";
|
|
4
|
+
export interface IRestaurant {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
legalName?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
email?: string;
|
|
10
|
+
phone?: string;
|
|
11
|
+
website?: string;
|
|
12
|
+
address: IAddress;
|
|
13
|
+
businessType: RestaurantType;
|
|
14
|
+
cuisineTypes: CuisineType[];
|
|
15
|
+
operatingHours: OperatingHours[];
|
|
16
|
+
timezone: string;
|
|
17
|
+
currency: string;
|
|
18
|
+
locale: string;
|
|
19
|
+
seatingCapacity?: number;
|
|
20
|
+
status: RestaurantStatus;
|
|
21
|
+
logoUrl?: string;
|
|
22
|
+
createdAt: Date;
|
|
23
|
+
updatedAt: Date;
|
|
24
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { TableArea, TableShape, TableStatus } from "../../enums/domain/Table";
|
|
2
|
+
export interface ITablePosition {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
rotation?: number;
|
|
6
|
+
}
|
|
7
|
+
export interface ITable {
|
|
8
|
+
id: string;
|
|
9
|
+
restaurantId: string;
|
|
10
|
+
locationId?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Human-readable table number or identifier.
|
|
13
|
+
* Examples: "1", "12", "A5", "Patio-3"
|
|
14
|
+
*/
|
|
15
|
+
number: string;
|
|
16
|
+
/**
|
|
17
|
+
* Optional display name.
|
|
18
|
+
*/
|
|
19
|
+
name?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Number of guests this table can comfortably seat.
|
|
22
|
+
*/
|
|
23
|
+
capacity: number;
|
|
24
|
+
/**
|
|
25
|
+
* Physical area of the restaurant.
|
|
26
|
+
*/
|
|
27
|
+
area?: TableArea;
|
|
28
|
+
/**
|
|
29
|
+
* Shape of the table.
|
|
30
|
+
*/
|
|
31
|
+
shape?: TableShape;
|
|
32
|
+
/**
|
|
33
|
+
* Current operational status.
|
|
34
|
+
*/
|
|
35
|
+
status: TableStatus;
|
|
36
|
+
/**
|
|
37
|
+
* Can this table be combined with others?
|
|
38
|
+
*/
|
|
39
|
+
combinable: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* IDs of tables that may be combined with this one.
|
|
42
|
+
*/
|
|
43
|
+
combinableTableIds?: string[];
|
|
44
|
+
/**
|
|
45
|
+
* Optional floor plan coordinates.
|
|
46
|
+
*/
|
|
47
|
+
position?: ITablePosition;
|
|
48
|
+
/**
|
|
49
|
+
* Notes visible to staff.
|
|
50
|
+
*/
|
|
51
|
+
notes?: string;
|
|
52
|
+
createdAt: Date;
|
|
53
|
+
updatedAt: Date;
|
|
54
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Vendor, VendorStatus, VendorType } from "../../enums/domain/Vendors";
|
|
2
|
+
import { IAddress } from "./Address";
|
|
3
|
+
export interface IVendor {
|
|
4
|
+
id: string;
|
|
5
|
+
restaurantId: string;
|
|
6
|
+
name: string;
|
|
7
|
+
vendorCode: Vendor;
|
|
8
|
+
type: VendorType;
|
|
9
|
+
status: VendorStatus;
|
|
10
|
+
contactName?: string;
|
|
11
|
+
email?: string;
|
|
12
|
+
phoneNumber?: string;
|
|
13
|
+
address?: IAddress;
|
|
14
|
+
taxId?: string;
|
|
15
|
+
website?: string;
|
|
16
|
+
notes?: string;
|
|
17
|
+
createdAt: Date;
|
|
18
|
+
updatedAt: Date;
|
|
19
|
+
}
|
|
@@ -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,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./domain/Address"), exports);
|
|
18
|
+
__exportStar(require("./domain/Employee"), exports);
|
|
19
|
+
__exportStar(require("./domain/Inventory"), exports);
|
|
20
|
+
__exportStar(require("./domain/Kitchen"), exports);
|
|
21
|
+
__exportStar(require("./domain/Menu"), exports);
|
|
22
|
+
__exportStar(require("./domain/Payment"), exports);
|
|
23
|
+
__exportStar(require("./domain/Recipe"), exports);
|
|
24
|
+
__exportStar(require("./domain/Restaurant"), exports);
|
|
25
|
+
__exportStar(require("./domain/Table"), exports);
|
|
26
|
+
__exportStar(require("./domain/Vendor"), exports);
|
|
27
|
+
__exportStar(require("./domain/Delivery"), exports);
|
|
28
|
+
__exportStar(require("./domain/Ingredient"), exports);
|
|
29
|
+
__exportStar(require("./domain/Customer"), exports);
|
|
30
|
+
__exportStar(require("./domain/Money"), exports);
|
|
31
|
+
__exportStar(require("./domain/Location"), exports);
|
|
32
|
+
__exportStar(require("./domain/Reservation"), exports);
|
|
33
|
+
__exportStar(require("./domain/OpeningHours"), exports);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.OrderModule = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
const EventBridgeModule_1 = require("../eventBridge/EventBridgeModule");
|
|
12
|
+
const SquareOrderServiceImpl_1 = require("./services/square/SquareOrderServiceImpl");
|
|
13
|
+
const ioc_1 = require("./ioc");
|
|
14
|
+
let OrderModule = class OrderModule {
|
|
15
|
+
};
|
|
16
|
+
exports.OrderModule = OrderModule;
|
|
17
|
+
exports.OrderModule = OrderModule = __decorate([
|
|
18
|
+
(0, common_1.Module)({
|
|
19
|
+
imports: [EventBridgeModule_1.EventBridgeModule],
|
|
20
|
+
providers: [
|
|
21
|
+
{
|
|
22
|
+
provide: ioc_1.OrderSymbols.SquareOrderService,
|
|
23
|
+
useClass: SquareOrderServiceImpl_1.SquareOrderServiceImpl,
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
exports: [ioc_1.OrderSymbols.SquareOrderService],
|
|
27
|
+
})
|
|
28
|
+
], OrderModule);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare enum OrderType {
|
|
2
|
+
DINE_IN = "DINE_IN",
|
|
3
|
+
TAKEAWAY = "TAKEAWAY",
|
|
4
|
+
DELIVERY = "DELIVERY",
|
|
5
|
+
CURBSIDE = "CURBSIDE",
|
|
6
|
+
DRIVE_THROUGH = "DRIVE_THROUGH"
|
|
7
|
+
}
|
|
8
|
+
export declare enum OrderStatus {
|
|
9
|
+
PENDING = "PENDING",
|
|
10
|
+
ACCEPTED = "ACCEPTED",
|
|
11
|
+
IN_PROGRESS = "IN_PROGRESS",
|
|
12
|
+
READY = "READY",
|
|
13
|
+
COMPLETED = "COMPLETED",
|
|
14
|
+
CANCELLED = "CANCELLED",
|
|
15
|
+
REFUNDED = "REFUNDED"
|
|
16
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OrderStatus = exports.OrderType = void 0;
|
|
4
|
+
var OrderType;
|
|
5
|
+
(function (OrderType) {
|
|
6
|
+
OrderType["DINE_IN"] = "DINE_IN";
|
|
7
|
+
OrderType["TAKEAWAY"] = "TAKEAWAY";
|
|
8
|
+
OrderType["DELIVERY"] = "DELIVERY";
|
|
9
|
+
OrderType["CURBSIDE"] = "CURBSIDE";
|
|
10
|
+
OrderType["DRIVE_THROUGH"] = "DRIVE_THROUGH";
|
|
11
|
+
})(OrderType || (exports.OrderType = OrderType = {}));
|
|
12
|
+
var OrderStatus;
|
|
13
|
+
(function (OrderStatus) {
|
|
14
|
+
OrderStatus["PENDING"] = "PENDING";
|
|
15
|
+
OrderStatus["ACCEPTED"] = "ACCEPTED";
|
|
16
|
+
OrderStatus["IN_PROGRESS"] = "IN_PROGRESS";
|
|
17
|
+
OrderStatus["READY"] = "READY";
|
|
18
|
+
OrderStatus["COMPLETED"] = "COMPLETED";
|
|
19
|
+
OrderStatus["CANCELLED"] = "CANCELLED";
|
|
20
|
+
OrderStatus["REFUNDED"] = "REFUNDED";
|
|
21
|
+
})(OrderStatus || (exports.OrderStatus = OrderStatus = {}));
|
|
@@ -0,0 +1,89 @@
|
|
|
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
|
+
export interface IOrder {
|
|
9
|
+
/**
|
|
10
|
+
* Unique order identifier in your platform.
|
|
11
|
+
*/
|
|
12
|
+
id: string;
|
|
13
|
+
/**
|
|
14
|
+
* Original vendor order identifier.
|
|
15
|
+
*/
|
|
16
|
+
externalId: string;
|
|
17
|
+
/**
|
|
18
|
+
* Restaurant that owns the order.
|
|
19
|
+
*/
|
|
20
|
+
restaurantId: string;
|
|
21
|
+
/**
|
|
22
|
+
* POS vendor.
|
|
23
|
+
*/
|
|
24
|
+
vendor: IVendor;
|
|
25
|
+
/**
|
|
26
|
+
* Location/branch.
|
|
27
|
+
*/
|
|
28
|
+
locationId: string;
|
|
29
|
+
/**
|
|
30
|
+
* Customer (optional).
|
|
31
|
+
*/
|
|
32
|
+
customer?: ICustomer;
|
|
33
|
+
/**
|
|
34
|
+
* Employee who created the order.
|
|
35
|
+
*/
|
|
36
|
+
employee?: IEmployee;
|
|
37
|
+
/**
|
|
38
|
+
* Ordered items.
|
|
39
|
+
*/
|
|
40
|
+
items: IOrderItem[];
|
|
41
|
+
/**
|
|
42
|
+
* Current order status.
|
|
43
|
+
*/
|
|
44
|
+
status: OrderStatus;
|
|
45
|
+
/**
|
|
46
|
+
* Order type.
|
|
47
|
+
*/
|
|
48
|
+
type: OrderType;
|
|
49
|
+
/**
|
|
50
|
+
* Subtotal before discounts and taxes.
|
|
51
|
+
*/
|
|
52
|
+
subtotal: Money;
|
|
53
|
+
/**
|
|
54
|
+
* Total discount.
|
|
55
|
+
*/
|
|
56
|
+
discount: Money;
|
|
57
|
+
/**
|
|
58
|
+
* Total tax.
|
|
59
|
+
*/
|
|
60
|
+
tax: Money;
|
|
61
|
+
/**
|
|
62
|
+
* Tip amount.
|
|
63
|
+
*/
|
|
64
|
+
tip: Money;
|
|
65
|
+
/**
|
|
66
|
+
* Final amount paid.
|
|
67
|
+
*/
|
|
68
|
+
total: Money;
|
|
69
|
+
/**
|
|
70
|
+
* Payment information.
|
|
71
|
+
*/
|
|
72
|
+
payments: IPayment[];
|
|
73
|
+
/**
|
|
74
|
+
* Optional notes.
|
|
75
|
+
*/
|
|
76
|
+
notes?: string;
|
|
77
|
+
/**
|
|
78
|
+
* Date/time the order was created.
|
|
79
|
+
*/
|
|
80
|
+
createdAt: Date;
|
|
81
|
+
/**
|
|
82
|
+
* Date/time last updated.
|
|
83
|
+
*/
|
|
84
|
+
updatedAt: Date;
|
|
85
|
+
/**
|
|
86
|
+
* Date/time completed.
|
|
87
|
+
*/
|
|
88
|
+
completedAt?: Date;
|
|
89
|
+
}
|