@managesome/eposmatic-toolkit 0.2.591 → 0.2.593
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.
|
@@ -61,4 +61,12 @@ export declare const WORKER_ENDPOINTS: {
|
|
|
61
61
|
readonly REOPENED_FOODSTREET_ORIGINAL_ORDER: "/reopened-foodstreet-original-order";
|
|
62
62
|
readonly REOPENED_FOODSTREET_SPLIT_ORDER: "/reopened-foodstreet-split-order";
|
|
63
63
|
readonly POST_WAREHOUSE_ACTIVITY_LOGS: "/post-warehouse-activity-logs";
|
|
64
|
+
readonly START_INSTORE_SHIFT: "/start-instore-shift";
|
|
65
|
+
readonly END_INSTORE_SHIFT: "/end-instore-shift";
|
|
66
|
+
readonly REOPEN_INSTORE_SHIFT: "/reopen-instore-shift";
|
|
67
|
+
readonly START_TENANT_DAY: "/start-tenant-day";
|
|
68
|
+
readonly END_TENANT_DAY: "/end-tenant-day";
|
|
69
|
+
readonly REOPEN_TENANT_DAY: "/reopen-tenant-day";
|
|
70
|
+
readonly OPEN_CASH_DRAWER_SESSION: "/open-cash-drawer-session";
|
|
71
|
+
readonly CLOSE_CASH_DRAWER_SESSION: "/close-cash-drawer-session";
|
|
64
72
|
};
|
|
@@ -75,4 +75,17 @@ exports.WORKER_ENDPOINTS = {
|
|
|
75
75
|
REOPENED_FOODSTREET_SPLIT_ORDER: '/reopened-foodstreet-split-order',
|
|
76
76
|
// ========================>> Activity Logs <<======================= //
|
|
77
77
|
POST_WAREHOUSE_ACTIVITY_LOGS: '/post-warehouse-activity-logs',
|
|
78
|
+
// ========================>> Shift / Business Day / Cash Drawer (compile) <<======================= //
|
|
79
|
+
// Fired by items-service AFTER it completes the corresponding lifecycle write;
|
|
80
|
+
// the worker recompiles derived aggregates (shift totals, drawer running
|
|
81
|
+
// balances, day totals + reports) from the ledger — idempotent, and the
|
|
82
|
+
// day-end job heals any missed incremental compile.
|
|
83
|
+
START_INSTORE_SHIFT: '/start-instore-shift',
|
|
84
|
+
END_INSTORE_SHIFT: '/end-instore-shift',
|
|
85
|
+
REOPEN_INSTORE_SHIFT: '/reopen-instore-shift',
|
|
86
|
+
START_TENANT_DAY: '/start-tenant-day',
|
|
87
|
+
END_TENANT_DAY: '/end-tenant-day',
|
|
88
|
+
REOPEN_TENANT_DAY: '/reopen-tenant-day',
|
|
89
|
+
OPEN_CASH_DRAWER_SESSION: '/open-cash-drawer-session',
|
|
90
|
+
CLOSE_CASH_DRAWER_SESSION: '/close-cash-drawer-session',
|
|
78
91
|
};
|
|
@@ -76,12 +76,21 @@ function getWarehouseCatalogFetchedData(categories, items) {
|
|
|
76
76
|
items: [],
|
|
77
77
|
},
|
|
78
78
|
}), {});
|
|
79
|
+
// Secondary lookup by category _id: synced categories carry a fresh per-target
|
|
80
|
+
// _id (≠ ref_id) while items store that category _id, so a ref_id-only lookup
|
|
81
|
+
// would silently drop those items from the catalog.
|
|
82
|
+
const categoriesByItemId = categories.reduce((acc, category) => {
|
|
83
|
+
if (category._id != null) {
|
|
84
|
+
acc[category._id] = categoriesObj[category.ref_id];
|
|
85
|
+
}
|
|
86
|
+
return acc;
|
|
87
|
+
}, {});
|
|
79
88
|
const uncategorizedItems = [];
|
|
80
89
|
for (let i = 0; i < items.length; i++) {
|
|
81
90
|
const item = items[i];
|
|
82
91
|
const sortedItem = getPartialWarehouseItemWithPrice(item);
|
|
83
92
|
if (item.category_id) {
|
|
84
|
-
categoriesObj[item.category_id]?.items.push(sortedItem);
|
|
93
|
+
(categoriesObj[item.category_id] ?? categoriesByItemId[item.category_id])?.items.push(sortedItem);
|
|
85
94
|
}
|
|
86
95
|
else {
|
|
87
96
|
uncategorizedItems.push(sortedItem);
|
|
@@ -90,3 +90,72 @@ export interface ICloseCashDrawerSessionRequestBody {
|
|
|
90
90
|
cash_amount: number;
|
|
91
91
|
denominations: Record<string, number>;
|
|
92
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Worker compile payloads for the business day / instore shift lifecycle.
|
|
95
|
+
*
|
|
96
|
+
* items-service fires these (fire-and-forget) AFTER it completes the
|
|
97
|
+
* corresponding lifecycle write; workers-service recompiles derived aggregates
|
|
98
|
+
* (shift totals, drawer running balances, day totals + reports) from the
|
|
99
|
+
* ledger. The ids are the session/document ids needed to scope the recompile —
|
|
100
|
+
* the worker does NOT create or close any lifecycle state.
|
|
101
|
+
*/
|
|
102
|
+
export interface IStartInstoreShiftWorkerBody {
|
|
103
|
+
tenant_id: string;
|
|
104
|
+
/** The business day (tenant_day_sessions doc id) the shift belongs to. */
|
|
105
|
+
day_id: string;
|
|
106
|
+
/** The shift session doc id created by the open. */
|
|
107
|
+
shift_session_id: string;
|
|
108
|
+
/** The shift TEMPLATE id. */
|
|
109
|
+
shift_id: string;
|
|
110
|
+
}
|
|
111
|
+
export interface IEndInstoreShiftWorkerBody {
|
|
112
|
+
tenant_id: string;
|
|
113
|
+
/** The business day (tenant_day_sessions doc id). */
|
|
114
|
+
day_id: string;
|
|
115
|
+
/** The shift session doc id being closed. */
|
|
116
|
+
shift_session_id: string;
|
|
117
|
+
/** The shift TEMPLATE id. */
|
|
118
|
+
shift_id: string;
|
|
119
|
+
}
|
|
120
|
+
export interface IReopenInstoreShiftWorkerBody {
|
|
121
|
+
tenant_id: string;
|
|
122
|
+
/** The business day (tenant_day_sessions doc id). */
|
|
123
|
+
day_id: string;
|
|
124
|
+
/** The shift session doc id being reopened. */
|
|
125
|
+
shift_session_id: string;
|
|
126
|
+
/** The shift TEMPLATE id. */
|
|
127
|
+
shift_id: string;
|
|
128
|
+
}
|
|
129
|
+
export interface IStartTenantDayWorkerBody {
|
|
130
|
+
tenant_id: string;
|
|
131
|
+
/** The newly opened business day (tenant_day_sessions doc id). */
|
|
132
|
+
day_session_id: string;
|
|
133
|
+
}
|
|
134
|
+
export interface IEndTenantDayWorkerBody {
|
|
135
|
+
tenant_id: string;
|
|
136
|
+
/** The business day being closed (tenant_day_sessions doc id). */
|
|
137
|
+
day_session_id: string;
|
|
138
|
+
}
|
|
139
|
+
export interface IReopenTenantDayWorkerBody {
|
|
140
|
+
tenant_id: string;
|
|
141
|
+
/** The business day being reopened (tenant_day_sessions doc id). */
|
|
142
|
+
day_session_id: string;
|
|
143
|
+
}
|
|
144
|
+
export interface IOpenCashDrawerSessionWorkerBody {
|
|
145
|
+
tenant_id: string;
|
|
146
|
+
/** The business day (tenant_day_sessions doc id). */
|
|
147
|
+
day_id: string;
|
|
148
|
+
/** The cash drawer doc id. */
|
|
149
|
+
drawer_id: string;
|
|
150
|
+
/** The drawer session doc id created/reopened by the open. */
|
|
151
|
+
drawer_session_id: string;
|
|
152
|
+
}
|
|
153
|
+
export interface ICloseCashDrawerSessionWorkerBody {
|
|
154
|
+
tenant_id: string;
|
|
155
|
+
/** The business day (tenant_day_sessions doc id). */
|
|
156
|
+
day_id: string;
|
|
157
|
+
/** The cash drawer doc id. */
|
|
158
|
+
drawer_id: string;
|
|
159
|
+
/** The drawer session doc id being closed. */
|
|
160
|
+
drawer_session_id: string;
|
|
161
|
+
}
|