@managesome/eposmatic-toolkit 0.3.7 → 0.3.9

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.
Files changed (439) hide show
  1. package/esm/constants/ANALYTICS.js +146 -0
  2. package/esm/constants/API_ERRORS.js +6 -0
  3. package/esm/constants/COMMON.js +369 -0
  4. package/esm/constants/DELIVERY.js +45 -0
  5. package/esm/constants/DIALER_ENUMS.js +11 -0
  6. package/esm/constants/ENUMS.js +1988 -0
  7. package/esm/constants/FBR_ENUMS.js +18 -0
  8. package/esm/constants/HUBRISE_ENUMS.js +179 -0
  9. package/esm/constants/INTERNAL_ENUMS.js +49 -0
  10. package/esm/constants/NOTIFICATIONS.js +6 -0
  11. package/esm/constants/ORDER.js +251 -0
  12. package/esm/constants/PRA_ENUMS.js +18 -0
  13. package/esm/constants/REPORT_WEBVIEW.js +28 -0
  14. package/esm/constants/RFQ_GO.js +83 -0
  15. package/esm/constants/SMARTPAY_ENUMS.js +55 -0
  16. package/esm/constants/SOCKET.js +149 -0
  17. package/esm/constants/SRB_ENUMS.js +13 -0
  18. package/esm/constants/SWITCHPAY.js +28 -0
  19. package/esm/constants/TENANT_ENUMS.js +90 -0
  20. package/esm/constants/TENANT_PURCHASE_ORDER.js +91 -0
  21. package/esm/constants/WALLET.js +51 -0
  22. package/esm/constants/WAREHOUSE_ANALYTICS.js +28 -0
  23. package/esm/constants/WAREHOUSE_ENUMS.js +420 -0
  24. package/esm/constants/WAREHOUSE_PURCHASE_ORDER.js +97 -0
  25. package/esm/constants/WEBVIEW.js +43 -0
  26. package/esm/constants/WORKER_ENDPOINTS.js +79 -0
  27. package/esm/constants/index.js +27 -0
  28. package/esm/constants/types.js +2 -0
  29. package/esm/helpers/fbr/generate-invoice.js +94 -0
  30. package/esm/helpers/fbr/index.js +1 -0
  31. package/esm/helpers/hubrise/hubrise-catalog.js +304 -0
  32. package/esm/helpers/hubrise/index.js +1 -0
  33. package/esm/helpers/index.js +9 -0
  34. package/esm/helpers/kpra/generate-invoice.js +26 -0
  35. package/esm/helpers/kpra/index.js +1 -0
  36. package/esm/helpers/order/generate-order.js +508 -0
  37. package/esm/helpers/order/generate-warehouse-internal-movement.js +71 -0
  38. package/esm/helpers/order/generate-warehouse-purchase-order-rfq.js +176 -0
  39. package/esm/helpers/order/generate-warehouse-purchase-order.js +187 -0
  40. package/esm/helpers/order/generate-warehouse-sale-order-rfq.js +176 -0
  41. package/esm/helpers/order/generate-warehouse-sale-order.js +149 -0
  42. package/esm/helpers/order/index.js +6 -0
  43. package/esm/helpers/pra/generate-invoice.js +94 -0
  44. package/esm/helpers/pra/index.js +1 -0
  45. package/esm/helpers/srb/generate-invoice.js +68 -0
  46. package/esm/helpers/srb/index.js +1 -0
  47. package/esm/helpers/store/all-orders-actions.js +17 -0
  48. package/esm/helpers/store/all-tenant-purchase-orders-actions.js +45 -0
  49. package/esm/helpers/store/all-warehouse-purchase-order-rfqs-actions.js +66 -0
  50. package/esm/helpers/store/all-warehouse-purchase-order-vendor-return-actions.js +50 -0
  51. package/esm/helpers/store/all-warehouse-purchase-orders-actions.js +49 -0
  52. package/esm/helpers/store/all-warehouse-sale-order-invoices-actions.js +132 -0
  53. package/esm/helpers/store/all-warehouse-sale-order-rfqs-actions.js +66 -0
  54. package/esm/helpers/store/all-warehouse-sale-orders-actions.js +72 -0
  55. package/esm/helpers/store/cart-actions.js +3563 -0
  56. package/esm/helpers/store/catalog-actions.js +379 -0
  57. package/esm/helpers/store/common-order-actions.js +937 -0
  58. package/esm/helpers/store/common-tenant-purchase-order-actions.js +440 -0
  59. package/esm/helpers/store/common-warehouse-internal-movement-actions.js +95 -0
  60. package/esm/helpers/store/common-warehouse-purchase-order-actions.js +530 -0
  61. package/esm/helpers/store/common-warehouse-purchase-order-receipt-actions.js +33 -0
  62. package/esm/helpers/store/common-warehouse-purchase-order-rfq-actions.js +523 -0
  63. package/esm/helpers/store/common-warehouse-purchase-order-vendor-return-actions.js +25 -0
  64. package/esm/helpers/store/common-warehouse-sale-order-actions.js +483 -0
  65. package/esm/helpers/store/common-warehouse-sale-order-invoice-actions.js +54 -0
  66. package/esm/helpers/store/common-warehouse-sale-order-rfq-actions.js +523 -0
  67. package/esm/helpers/store/index.js +26 -0
  68. package/esm/helpers/store/offline-ordering.js +251 -0
  69. package/esm/helpers/store/tenant-purchase-orders-cart-actions.js +379 -0
  70. package/esm/helpers/store/warehouse-purchase-order-rfq-cart-actions.js +360 -0
  71. package/esm/helpers/store/warehouse-purchase-orders-cart-actions.js +470 -0
  72. package/esm/helpers/store/warehouse-sale-order-rfq-cart-actions.js +359 -0
  73. package/esm/helpers/store/warehouse-sale-orders-cart-actions.js +456 -0
  74. package/esm/helpers/types/api-types.js +1 -0
  75. package/esm/helpers/types/cart-actions.js +1 -0
  76. package/esm/helpers/types/cart-helpers.js +1 -0
  77. package/esm/helpers/types/catalog.js +1 -0
  78. package/esm/helpers/types/common.js +1 -0
  79. package/esm/helpers/types/deliverect_menu.js +1 -0
  80. package/esm/helpers/types/email-templates.js +1 -0
  81. package/esm/helpers/types/fbr-generate-invoice.js +1 -0
  82. package/esm/helpers/types/halfhalf.js +1 -0
  83. package/esm/helpers/types/hubrise_catalog.js +1 -0
  84. package/esm/helpers/types/hubrise_customers.js +1 -0
  85. package/esm/helpers/types/hubrise_deliveries.js +1 -0
  86. package/esm/helpers/types/hubrise_location.js +1 -0
  87. package/esm/helpers/types/hubrise_orders.js +1 -0
  88. package/esm/helpers/types/index.js +33 -0
  89. package/esm/helpers/types/internal-leads.js +1 -0
  90. package/esm/helpers/types/inventory-catalog.js +1 -0
  91. package/esm/helpers/types/kpra-generate-invoice.js +1 -0
  92. package/esm/helpers/types/marketing.js +1 -0
  93. package/esm/helpers/types/order-engine.js +1 -0
  94. package/esm/helpers/types/pra-generate-invoice.js +1 -0
  95. package/esm/helpers/types/report-webview.js +1 -0
  96. package/esm/helpers/types/reports.js +1 -0
  97. package/esm/helpers/types/smartpay-apis.js +2 -0
  98. package/esm/helpers/types/specials.js +1 -0
  99. package/esm/helpers/types/split_bill.js +1 -0
  100. package/esm/helpers/types/srb-generate-invoice.js +1 -0
  101. package/esm/helpers/types/switchpay.js +1 -0
  102. package/esm/helpers/types/tenant-purchase-order-cart-actions.js +1 -0
  103. package/esm/helpers/types/warehouse-catalog.js +1 -0
  104. package/esm/helpers/types/warehouse-purchase-order-cart-actions.js +1 -0
  105. package/esm/helpers/types/warehouse-purchase-order-rfq-cart-actions.js +1 -0
  106. package/esm/helpers/types/warehouse-sale-order-cart-actions.js +1 -0
  107. package/esm/helpers/types/warehouse-sale-order-rfq-cart-actions.js +1 -0
  108. package/esm/helpers/types/workers.js +1 -0
  109. package/esm/helpers/utils/asaanbill-identifier-helpers.js +31 -0
  110. package/esm/helpers/utils/business-day-helpers.js +201 -0
  111. package/esm/helpers/utils/cart-helpers.js +156 -0
  112. package/esm/helpers/utils/catalog-conversion.js +129 -0
  113. package/esm/helpers/utils/code-redemption-helpers.js +452 -0
  114. package/esm/helpers/utils/color-helpers.js +31 -0
  115. package/esm/helpers/utils/common.js +368 -0
  116. package/esm/helpers/utils/crypt.js +40 -0
  117. package/esm/helpers/utils/customers-helpers.js +15 -0
  118. package/esm/helpers/utils/delivery-area-helpers.js +42 -0
  119. package/esm/helpers/utils/delivery-helpers.js +87 -0
  120. package/esm/helpers/utils/denominations-helpers.js +53 -0
  121. package/esm/helpers/utils/dinein.js +39 -0
  122. package/esm/helpers/utils/discount-helpers.js +55 -0
  123. package/esm/helpers/utils/email-helpers.js +111 -0
  124. package/esm/helpers/utils/error-helpers.js +14 -0
  125. package/esm/helpers/utils/expense.js +26 -0
  126. package/esm/helpers/utils/getFormFieldsDiff.js +15 -0
  127. package/esm/helpers/utils/gift-card-helpers.js +258 -0
  128. package/esm/helpers/utils/halfhalf-setup-helpers.js +779 -0
  129. package/esm/helpers/utils/hourly-comparison-report-helpers.js +851 -0
  130. package/esm/helpers/utils/hr-helpers.js +62 -0
  131. package/esm/helpers/utils/hubrise-utils.js +32 -0
  132. package/esm/helpers/utils/image-helpers.js +95 -0
  133. package/esm/helpers/utils/image-url-helpers.js +96 -0
  134. package/esm/helpers/utils/index.js +96 -0
  135. package/esm/helpers/utils/ingredients.js +26 -0
  136. package/esm/helpers/utils/internal-amount-helpers.js +49 -0
  137. package/esm/helpers/utils/inventory.js +123 -0
  138. package/esm/helpers/utils/inventory_entries.js +91 -0
  139. package/esm/helpers/utils/inventory_transactions.js +91 -0
  140. package/esm/helpers/utils/item-report-helpers.js +2603 -0
  141. package/esm/helpers/utils/items-comparison-report-helpers.js +1057 -0
  142. package/esm/helpers/utils/kds-helpers.js +43 -0
  143. package/esm/helpers/utils/location-helpers.js +13 -0
  144. package/esm/helpers/utils/menu-helpers.js +44 -0
  145. package/esm/helpers/utils/minified-catalog.js +428 -0
  146. package/esm/helpers/utils/offer-apply-helpers.js +613 -0
  147. package/esm/helpers/utils/offers-helpers.js +3351 -0
  148. package/esm/helpers/utils/operational-roles-helpers.js +33 -0
  149. package/esm/helpers/utils/order-engine.js +1409 -0
  150. package/esm/helpers/utils/order-history.js +208 -0
  151. package/esm/helpers/utils/payment-comparison-report-helpers.js +873 -0
  152. package/esm/helpers/utils/payment-helpers.js +302 -0
  153. package/esm/helpers/utils/pdf-generator.js +110 -0
  154. package/esm/helpers/utils/platform-catalog.js +306 -0
  155. package/esm/helpers/utils/platform-num.js +188 -0
  156. package/esm/helpers/utils/platform-specific-tenant-shifts.js +19 -0
  157. package/esm/helpers/utils/price-conversion.js +24 -0
  158. package/esm/helpers/utils/printer-helpers.js +319 -0
  159. package/esm/helpers/utils/public-holidays-helpers.js +8 -0
  160. package/esm/helpers/utils/ratings-comparison-report-helpers.js +1187 -0
  161. package/esm/helpers/utils/receipt-engine.js +1050 -0
  162. package/esm/helpers/utils/review-helpers.js +391 -0
  163. package/esm/helpers/utils/rider-tracking.js +12 -0
  164. package/esm/helpers/utils/riders-report-helpers.js +1590 -0
  165. package/esm/helpers/utils/sales-comparison-report-helpers.js +1259 -0
  166. package/esm/helpers/utils/sales-comparitive-report-helpers.js +939 -0
  167. package/esm/helpers/utils/sales-overview-report-helpers.js +1046 -0
  168. package/esm/helpers/utils/sales-summary-report-helpers.js +877 -0
  169. package/esm/helpers/utils/scan-code-helpers.js +31 -0
  170. package/esm/helpers/utils/selection-model.js +68 -0
  171. package/esm/helpers/utils/shift-window-helpers.js +148 -0
  172. package/esm/helpers/utils/simplified-catalog.js +107 -0
  173. package/esm/helpers/utils/simplified-halfhalf.js +101 -0
  174. package/esm/helpers/utils/simplified-specials.js +107 -0
  175. package/esm/helpers/utils/simplified-tenant.js +411 -0
  176. package/esm/helpers/utils/specials-helpers.js +727 -0
  177. package/esm/helpers/utils/tenant-calendar-helpers.js +67 -0
  178. package/esm/helpers/utils/tenant-cash-drawer-sessions-helpers.js +248 -0
  179. package/esm/helpers/utils/tenant-cash-drawers-helpers.js +31 -0
  180. package/esm/helpers/utils/tenant-cash-in-out-helpers.js +47 -0
  181. package/esm/helpers/utils/tenant-day-sessions-helpers.js +167 -0
  182. package/esm/helpers/utils/tenant-instore-shift-sessions-helpers.js +227 -0
  183. package/esm/helpers/utils/tenant-staff-helpers.js +19 -0
  184. package/esm/helpers/utils/tenant_cash_in_hand_transactions.js +31 -0
  185. package/esm/helpers/utils/time-helpers.js +142 -0
  186. package/esm/helpers/utils/void-items-report-helpers.js +529 -0
  187. package/esm/helpers/utils/void-order-items-helpers.js +32 -0
  188. package/esm/helpers/utils/voidations-summary-report-helpers.js +800 -0
  189. package/esm/helpers/utils/wallet-helpers.js +22 -0
  190. package/esm/helpers/utils/wallet-redemption-helpers.js +46 -0
  191. package/esm/helpers/utils/warehouse-catalog-conversion.js +117 -0
  192. package/esm/helpers/utils/warehouse-inventory.js +59 -0
  193. package/esm/helpers/utils/warehouse-purchase-order-engine.js +27 -0
  194. package/esm/helpers/utils/warehouse-purchase-order-receipt-engine.js +205 -0
  195. package/esm/helpers/utils/warehouse-purchase-order-x-report-helpers.js +1432 -0
  196. package/esm/helpers/utils/warehouse-sale-order-engine.js +27 -0
  197. package/esm/helpers/utils/warehouse-sale-order-receipt-engine.js +207 -0
  198. package/esm/helpers/utils/warehouse-sale-order-x-report-helpers.js +1 -0
  199. package/esm/helpers/utils/warehouse-sale-x-report-helpers.js +1434 -0
  200. package/esm/helpers/utils/warehouse-settings-helpers.js +37 -0
  201. package/esm/helpers/utils/warehouse-void-purchase-order-items-helpers.js +34 -0
  202. package/esm/helpers/utils/warehouse-void-purchase-order-items-report-helpers.js +18 -0
  203. package/esm/helpers/utils/warehouse-void-sale-order-items-helpers.js +34 -0
  204. package/esm/helpers/utils/warehouse-void-sale-order-items-report-helpers.js +18 -0
  205. package/esm/helpers/utils/warehouse_inventory_transactions.js +91 -0
  206. package/esm/helpers/utils/x-report-helpers.js +1850 -0
  207. package/esm/index.js +3 -0
  208. package/esm/schemas/index.js +2 -0
  209. package/esm/schemas/models/app_configs.js +36 -0
  210. package/esm/schemas/models/applied_order_discounts.js +103 -0
  211. package/esm/schemas/models/brands.js +56 -0
  212. package/esm/schemas/models/categories.js +74 -0
  213. package/esm/schemas/models/close_dates.js +63 -0
  214. package/esm/schemas/models/common-models.js +449 -0
  215. package/esm/schemas/models/courses.js +62 -0
  216. package/esm/schemas/models/customer_redemptions.js +82 -0
  217. package/esm/schemas/models/customers.js +269 -0
  218. package/esm/schemas/models/deliveries.js +137 -0
  219. package/esm/schemas/models/delivery_areas.js +97 -0
  220. package/esm/schemas/models/dinein_floors.js +55 -0
  221. package/esm/schemas/models/dinein_tables.js +97 -0
  222. package/esm/schemas/models/dinein_tables_fingerprints.js +96 -0
  223. package/esm/schemas/models/discounts.js +87 -0
  224. package/esm/schemas/models/expense_categories.js +61 -0
  225. package/esm/schemas/models/expense_details.js +130 -0
  226. package/esm/schemas/models/gift_cards.js +342 -0
  227. package/esm/schemas/models/halfhalf_setup.js +142 -0
  228. package/esm/schemas/models/index.js +111 -0
  229. package/esm/schemas/models/internal_customers.js +139 -0
  230. package/esm/schemas/models/internal_invoices.js +119 -0
  231. package/esm/schemas/models/internal_leads.js +78 -0
  232. package/esm/schemas/models/internal_operational_roles.js +85 -0
  233. package/esm/schemas/models/internal_staffs.js +65 -0
  234. package/esm/schemas/models/inventories.js +103 -0
  235. package/esm/schemas/models/inventory_categories.js +52 -0
  236. package/esm/schemas/models/inventory_transactions.js +143 -0
  237. package/esm/schemas/models/item_transactions.js +117 -0
  238. package/esm/schemas/models/items.js +341 -0
  239. package/esm/schemas/models/marketing_fingerprints.js +92 -0
  240. package/esm/schemas/models/menus.js +66 -0
  241. package/esm/schemas/models/messaging_devices.js +99 -0
  242. package/esm/schemas/models/modifier_extras.js +120 -0
  243. package/esm/schemas/models/offers.js +470 -0
  244. package/esm/schemas/models/offers_fingerprints.js +61 -0
  245. package/esm/schemas/models/operational_roles.js +155 -0
  246. package/esm/schemas/models/orders.js +1051 -0
  247. package/esm/schemas/models/printer_settings.js +245 -0
  248. package/esm/schemas/models/public_holidays.js +58 -0
  249. package/esm/schemas/models/reservations.js +127 -0
  250. package/esm/schemas/models/reviews.js +145 -0
  251. package/esm/schemas/models/rewards_usage.js +61 -0
  252. package/esm/schemas/models/riders.js +75 -0
  253. package/esm/schemas/models/specials.js +169 -0
  254. package/esm/schemas/models/staff_shifts.js +66 -0
  255. package/esm/schemas/models/tenant-activity-logs.js +126 -0
  256. package/esm/schemas/models/tenant_active_jobs.js +77 -0
  257. package/esm/schemas/models/tenant_calendar.js +89 -0
  258. package/esm/schemas/models/tenant_cash_drawer_sessions.js +208 -0
  259. package/esm/schemas/models/tenant_cash_drawers.js +60 -0
  260. package/esm/schemas/models/tenant_cash_in_hand_transactions.js +69 -0
  261. package/esm/schemas/models/tenant_cash_in_out.js +104 -0
  262. package/esm/schemas/models/tenant_clients.js +66 -0
  263. package/esm/schemas/models/tenant_day_sessions.js +166 -0
  264. package/esm/schemas/models/tenant_hr_attendance_records.js +87 -0
  265. package/esm/schemas/models/tenant_hr_biometric_enrollments.js +69 -0
  266. package/esm/schemas/models/tenant_hr_departments.js +42 -0
  267. package/esm/schemas/models/tenant_hr_documents.js +71 -0
  268. package/esm/schemas/models/tenant_hr_employees.js +172 -0
  269. package/esm/schemas/models/tenant_hr_leave_requests.js +80 -0
  270. package/esm/schemas/models/tenant_hr_payrolls.js +131 -0
  271. package/esm/schemas/models/tenant_hr_performance_reviews.js +58 -0
  272. package/esm/schemas/models/tenant_hr_policies.js +57 -0
  273. package/esm/schemas/models/tenant_hr_positions.js +48 -0
  274. package/esm/schemas/models/tenant_hr_shift_schedules.js +84 -0
  275. package/esm/schemas/models/tenant_hr_shifts.js +64 -0
  276. package/esm/schemas/models/tenant_instore_shift_sessions.js +204 -0
  277. package/esm/schemas/models/tenant_instore_shifts.js +63 -0
  278. package/esm/schemas/models/tenant_inventory_department_transactions.js +116 -0
  279. package/esm/schemas/models/tenant_inventory_department_utilities.js +85 -0
  280. package/esm/schemas/models/tenant_inventory_departments.js +55 -0
  281. package/esm/schemas/models/tenant_inventory_entries.js +131 -0
  282. package/esm/schemas/models/tenant_metadata.js +88 -0
  283. package/esm/schemas/models/tenant_order_item_instructions.js +66 -0
  284. package/esm/schemas/models/tenant_purchase_order_vendor_returns.js +80 -0
  285. package/esm/schemas/models/tenant_purchase_orders.js +158 -0
  286. package/esm/schemas/models/tenant_shifts.js +57 -0
  287. package/esm/schemas/models/tenant_staffs.js +129 -0
  288. package/esm/schemas/models/tenant_vendors.js +99 -0
  289. package/esm/schemas/models/tenants.js +811 -0
  290. package/esm/schemas/models/terminal_devices.js +63 -0
  291. package/esm/schemas/models/tokens.js +73 -0
  292. package/esm/schemas/models/track_order_numbers.js +42 -0
  293. package/esm/schemas/models/void_order_items.js +210 -0
  294. package/esm/schemas/models/vouchers.js +101 -0
  295. package/esm/schemas/models/wallet_transactions.js +128 -0
  296. package/esm/schemas/models/wallets.js +44 -0
  297. package/esm/schemas/models/warehouse-activity-logs.js +144 -0
  298. package/esm/schemas/models/warehouse_categories.js +83 -0
  299. package/esm/schemas/models/warehouse_clients.js +81 -0
  300. package/esm/schemas/models/warehouse_communications.js +226 -0
  301. package/esm/schemas/models/warehouse_internal_movements.js +463 -0
  302. package/esm/schemas/models/warehouse_inventory_entries.js +125 -0
  303. package/esm/schemas/models/warehouse_inventory_lot_serial_numbers.js +188 -0
  304. package/esm/schemas/models/warehouse_inventory_transactions.js +133 -0
  305. package/esm/schemas/models/warehouse_item_transactions.js +97 -0
  306. package/esm/schemas/models/warehouse_items.js +173 -0
  307. package/esm/schemas/models/warehouse_operational_roles.js +87 -0
  308. package/esm/schemas/models/warehouse_purchase_order_receipts.js +163 -0
  309. package/esm/schemas/models/warehouse_purchase_order_rfqs.js +339 -0
  310. package/esm/schemas/models/warehouse_purchase_order_vendor_returns.js +199 -0
  311. package/esm/schemas/models/warehouse_purchase_orders.js +334 -0
  312. package/esm/schemas/models/warehouse_sale_deliveries.js +155 -0
  313. package/esm/schemas/models/warehouse_sale_invoices.js +229 -0
  314. package/esm/schemas/models/warehouse_sale_order_rfqs.js +340 -0
  315. package/esm/schemas/models/warehouse_sale_orders.js +322 -0
  316. package/esm/schemas/models/warehouse_staffs.js +104 -0
  317. package/esm/schemas/models/warehouse_track_order_numbers.js +73 -0
  318. package/esm/schemas/models/warehouse_vendors.js +99 -0
  319. package/esm/schemas/models/warehouse_void_purchase_order_items.js +174 -0
  320. package/esm/schemas/models/warehouse_void_sale_order_items.js +174 -0
  321. package/esm/schemas/models/warehouses.js +253 -0
  322. package/esm/schemas/types/app_configs.js +1 -0
  323. package/esm/schemas/types/applied_order_discounts.js +1 -0
  324. package/esm/schemas/types/brands.js +1 -0
  325. package/esm/schemas/types/categories.js +1 -0
  326. package/esm/schemas/types/close_dates.js +1 -0
  327. package/esm/schemas/types/common.js +1 -0
  328. package/esm/schemas/types/courses.js +1 -0
  329. package/esm/schemas/types/customer_redemptions.js +1 -0
  330. package/esm/schemas/types/customers.js +1 -0
  331. package/esm/schemas/types/deliveries.js +1 -0
  332. package/esm/schemas/types/delivery_areas.js +1 -0
  333. package/esm/schemas/types/dinein_floors.js +1 -0
  334. package/esm/schemas/types/dinein_tables.js +1 -0
  335. package/esm/schemas/types/dinein_tables_fingerprints.js +1 -0
  336. package/esm/schemas/types/discounts.js +1 -0
  337. package/esm/schemas/types/expense_categories.js +1 -0
  338. package/esm/schemas/types/expense_details.js +1 -0
  339. package/esm/schemas/types/gift_cards.js +1 -0
  340. package/esm/schemas/types/halfhalf_setup.js +1 -0
  341. package/esm/schemas/types/index.js +113 -0
  342. package/esm/schemas/types/internal_customers.js +1 -0
  343. package/esm/schemas/types/internal_invoices.js +1 -0
  344. package/esm/schemas/types/internal_leads.js +1 -0
  345. package/esm/schemas/types/internal_operational_roles.js +16 -0
  346. package/esm/schemas/types/internal_staffs.js +1 -0
  347. package/esm/schemas/types/inventories.js +1 -0
  348. package/esm/schemas/types/inventory_categories.js +1 -0
  349. package/esm/schemas/types/inventory_department_transactions.js +1 -0
  350. package/esm/schemas/types/inventory_department_utilities.js +1 -0
  351. package/esm/schemas/types/inventory_departments.js +1 -0
  352. package/esm/schemas/types/inventory_transactions.js +1 -0
  353. package/esm/schemas/types/item_transactions.js +1 -0
  354. package/esm/schemas/types/items.js +1 -0
  355. package/esm/schemas/types/marketing_fingerprints.js +1 -0
  356. package/esm/schemas/types/menus.js +1 -0
  357. package/esm/schemas/types/messaging_devices.js +1 -0
  358. package/esm/schemas/types/modifier_extras.js +1 -0
  359. package/esm/schemas/types/multi_tenants.js +1 -0
  360. package/esm/schemas/types/offers.js +1 -0
  361. package/esm/schemas/types/offers_fingerprints.js +1 -0
  362. package/esm/schemas/types/operational_roles.js +15 -0
  363. package/esm/schemas/types/orders.js +1 -0
  364. package/esm/schemas/types/printer_settings.js +1 -0
  365. package/esm/schemas/types/public_holidays.js +1 -0
  366. package/esm/schemas/types/reservations.js +1 -0
  367. package/esm/schemas/types/reviews.js +1 -0
  368. package/esm/schemas/types/rewards_usage.js +1 -0
  369. package/esm/schemas/types/riders.js +1 -0
  370. package/esm/schemas/types/specials.js +1 -0
  371. package/esm/schemas/types/staff_shifts.js +1 -0
  372. package/esm/schemas/types/tenant-activity-logs.js +1 -0
  373. package/esm/schemas/types/tenant_active_jobs.js +1 -0
  374. package/esm/schemas/types/tenant_calendar.js +1 -0
  375. package/esm/schemas/types/tenant_cash_drawer_sessions.js +1 -0
  376. package/esm/schemas/types/tenant_cash_drawers.js +1 -0
  377. package/esm/schemas/types/tenant_cash_in_hand_transactions.js +1 -0
  378. package/esm/schemas/types/tenant_cash_in_out.js +1 -0
  379. package/esm/schemas/types/tenant_clients.js +1 -0
  380. package/esm/schemas/types/tenant_day_sessions.js +1 -0
  381. package/esm/schemas/types/tenant_hr_attendance_records.js +1 -0
  382. package/esm/schemas/types/tenant_hr_biometric_enrollments.js +1 -0
  383. package/esm/schemas/types/tenant_hr_departments.js +1 -0
  384. package/esm/schemas/types/tenant_hr_documents.js +1 -0
  385. package/esm/schemas/types/tenant_hr_employees.js +1 -0
  386. package/esm/schemas/types/tenant_hr_leave_requests.js +1 -0
  387. package/esm/schemas/types/tenant_hr_payrolls.js +1 -0
  388. package/esm/schemas/types/tenant_hr_performance_reviews.js +1 -0
  389. package/esm/schemas/types/tenant_hr_policies.js +1 -0
  390. package/esm/schemas/types/tenant_hr_positions.js +1 -0
  391. package/esm/schemas/types/tenant_hr_shift_schedules.js +1 -0
  392. package/esm/schemas/types/tenant_hr_shifts.js +1 -0
  393. package/esm/schemas/types/tenant_instore_shift_sessions.js +1 -0
  394. package/esm/schemas/types/tenant_instore_shifts.js +1 -0
  395. package/esm/schemas/types/tenant_inventory_entries.js +1 -0
  396. package/esm/schemas/types/tenant_metadata.js +1 -0
  397. package/esm/schemas/types/tenant_order_item_instructions.js +1 -0
  398. package/esm/schemas/types/tenant_purchase_order_vendor_returns.js +1 -0
  399. package/esm/schemas/types/tenant_purchase_orders.js +1 -0
  400. package/esm/schemas/types/tenant_shifts.js +1 -0
  401. package/esm/schemas/types/tenant_staffs.js +1 -0
  402. package/esm/schemas/types/tenant_vendors.js +1 -0
  403. package/esm/schemas/types/tenants.js +1 -0
  404. package/esm/schemas/types/terminal_devices.js +1 -0
  405. package/esm/schemas/types/tokens.js +1 -0
  406. package/esm/schemas/types/track_order_numbers.js +1 -0
  407. package/esm/schemas/types/void_order_items.js +1 -0
  408. package/esm/schemas/types/vouchers.js +1 -0
  409. package/esm/schemas/types/wallet_transactions.js +1 -0
  410. package/esm/schemas/types/wallets.js +1 -0
  411. package/esm/schemas/types/warehouse-activity-logs.js +1 -0
  412. package/esm/schemas/types/warehouse_categories.js +1 -0
  413. package/esm/schemas/types/warehouse_clients.js +1 -0
  414. package/esm/schemas/types/warehouse_communications.js +1 -0
  415. package/esm/schemas/types/warehouse_internal_movements.js +1 -0
  416. package/esm/schemas/types/warehouse_inventory_entries.js +1 -0
  417. package/esm/schemas/types/warehouse_inventory_lot_serial_numbers.js +1 -0
  418. package/esm/schemas/types/warehouse_inventory_transactions.js +1 -0
  419. package/esm/schemas/types/warehouse_item_transactions.js +1 -0
  420. package/esm/schemas/types/warehouse_items.js +1 -0
  421. package/esm/schemas/types/warehouse_operational_roles.js +15 -0
  422. package/esm/schemas/types/warehouse_purchase_order_receipts.js +18 -0
  423. package/esm/schemas/types/warehouse_purchase_order_rfqs.js +1 -0
  424. package/esm/schemas/types/warehouse_purchase_order_vendor_returns.js +1 -0
  425. package/esm/schemas/types/warehouse_purchase_orders.js +1 -0
  426. package/esm/schemas/types/warehouse_sale_deliveries.js +1 -0
  427. package/esm/schemas/types/warehouse_sale_invoices.js +1 -0
  428. package/esm/schemas/types/warehouse_sale_order_rfqs.js +1 -0
  429. package/esm/schemas/types/warehouse_sale_orders.js +1 -0
  430. package/esm/schemas/types/warehouse_staffs.js +1 -0
  431. package/esm/schemas/types/warehouse_track_order_numbers.js +1 -0
  432. package/esm/schemas/types/warehouse_vendors.js +1 -0
  433. package/esm/schemas/types/warehouse_void_purchase_order_items.js +1 -0
  434. package/esm/schemas/types/warehouse_void_sale_order_items.js +1 -0
  435. package/esm/schemas/types/warehouses.js +1 -0
  436. package/lib/helpers/utils/order-engine.js +6 -1
  437. package/lib/tests/soldout-option-default-guard.test.d.ts +1 -0
  438. package/lib/tests/soldout-option-default-guard.test.js +126 -0
  439. package/package.json +6 -3
@@ -0,0 +1,142 @@
1
+ import { Schema } from 'mongoose';
2
+ import { CATEGORIES_COLLECTION_NAME } from './categories';
3
+ import { PriceSchema } from './common-models';
4
+ import { PlatformsSchema, SpecialHoursSchema } from './items';
5
+ import { SpecialItemSchema } from './specials';
6
+ import { TENANTS_COLLECTION_NAME } from './tenants';
7
+ export const HalfHalfSegmentSchema = new Schema({
8
+ _id: {
9
+ type: Schema.Types.ObjectId,
10
+ required: true,
11
+ immutable: true,
12
+ },
13
+ // `_id` is auto-generated as a BSON ObjectId by mongoose
14
+ name: {
15
+ type: String,
16
+ required: true,
17
+ },
18
+ sort_id: {
19
+ type: Number,
20
+ required: true,
21
+ },
22
+ }, {
23
+ minimize: false,
24
+ });
25
+ export const HalfHalfSetupSchema = new Schema({
26
+ _id: {
27
+ type: Schema.Types.ObjectId,
28
+ required: true,
29
+ immutable: true,
30
+ },
31
+ brand_id: {
32
+ type: String,
33
+ required: true,
34
+ immutable: true,
35
+ ref: 'brands',
36
+ },
37
+ tenants: {
38
+ type: [{ type: String, ref: TENANTS_COLLECTION_NAME }],
39
+ required: true,
40
+ },
41
+ category_id: {
42
+ type: Schema.Types.ObjectId,
43
+ required: true,
44
+ immutable: true,
45
+ ref: CATEGORIES_COLLECTION_NAME,
46
+ },
47
+ included_platforms: {
48
+ type: [PlatformsSchema],
49
+ required: true,
50
+ min: 1,
51
+ },
52
+ segments: {
53
+ type: [HalfHalfSegmentSchema],
54
+ required: true,
55
+ validate: {
56
+ validator: (value) => Array.isArray(value) && (value.length === 2 || value.length === 4),
57
+ message: 'segments must have a length of 2 or 4',
58
+ },
59
+ },
60
+ image_url: {
61
+ type: String,
62
+ required: true,
63
+ },
64
+ name: {
65
+ type: String,
66
+ required: true,
67
+ },
68
+ description: {
69
+ type: String,
70
+ required: true,
71
+ },
72
+ active: {
73
+ type: Boolean,
74
+ default: true,
75
+ },
76
+ sold_out: {
77
+ type: [{ type: String, ref: TENANTS_COLLECTION_NAME }],
78
+ default: [],
79
+ },
80
+ upsell_price: {
81
+ type: PriceSchema,
82
+ default: null,
83
+ },
84
+ discount_amount: {
85
+ type: PriceSchema,
86
+ default: null,
87
+ },
88
+ is_discount_percentage: {
89
+ type: Boolean,
90
+ default: false,
91
+ },
92
+ sort_id: {
93
+ type: Number,
94
+ required: true,
95
+ },
96
+ choose_expensive_segment_price: {
97
+ type: Boolean,
98
+ default: false,
99
+ },
100
+ item_special_hours: {
101
+ type: [SpecialHoursSchema],
102
+ default: null,
103
+ },
104
+ items: {
105
+ type: [SpecialItemSchema],
106
+ required: true,
107
+ },
108
+ excluded_refs: {
109
+ type: [String],
110
+ default: [],
111
+ },
112
+ exclusive_refs: {
113
+ type: [String],
114
+ default: [],
115
+ },
116
+ createdAt: {
117
+ type: Schema.Types.Date,
118
+ required: true,
119
+ default: () => new Date(),
120
+ immutable: true,
121
+ },
122
+ updatedAt: {
123
+ type: Schema.Types.Date,
124
+ required: true,
125
+ default: () => new Date(),
126
+ },
127
+ }, {
128
+ timestamps: true,
129
+ versionKey: false,
130
+ minimize: false,
131
+ });
132
+ export const HALFHALF_COLLECTION_NAME = 'halfhalf_setup';
133
+ /**
134
+ * Describes the indexes for `halfhalf_setup`. Values are Mongo key patterns
135
+ * that can be passed straight to `.hint()`.
136
+ * - `_id`: unique primary key.
137
+ * - `tenants`: multikey index on the tenants array for per-tenant lookups.
138
+ */
139
+ export const HALFHALF_COLLECTION_INDEXES = {
140
+ _id: { _id: 1 }, // Unique Index
141
+ tenants: { tenants: 1 }, // multikey index — per-tenant lookups
142
+ };
@@ -0,0 +1,111 @@
1
+ export * from './app_configs';
2
+ export * from './applied_order_discounts';
3
+ export * from './brands';
4
+ export * from './categories';
5
+ export * from './close_dates';
6
+ export * from './courses';
7
+ export * from './customer_redemptions';
8
+ export * from './customers';
9
+ export * from './deliveries';
10
+ export * from './delivery_areas';
11
+ export * from './dinein_floors';
12
+ export * from './dinein_tables';
13
+ export * from './dinein_tables_fingerprints';
14
+ export * from './discounts';
15
+ export * from './expense_categories';
16
+ export * from './expense_details';
17
+ export * from './gift_cards';
18
+ export * from './halfhalf_setup';
19
+ export * from './internal_customers';
20
+ export * from './internal_invoices';
21
+ export * from './internal_leads';
22
+ export * from './internal_operational_roles';
23
+ export * from './internal_staffs';
24
+ export * from './inventories';
25
+ export * from './inventory_categories';
26
+ export * from './inventory_transactions';
27
+ export * from './item_transactions';
28
+ export * from './items';
29
+ export * from './marketing_fingerprints';
30
+ export * from './menus';
31
+ export * from './messaging_devices';
32
+ export * from './modifier_extras';
33
+ export * from './offers';
34
+ export * from './offers_fingerprints';
35
+ export * from './operational_roles';
36
+ export * from './orders';
37
+ export * from './printer_settings';
38
+ export * from './public_holidays';
39
+ export * from './reservations';
40
+ export * from './reviews';
41
+ export * from './rewards_usage';
42
+ export * from './riders';
43
+ export * from './specials';
44
+ export * from './staff_shifts';
45
+ export * from './tenant-activity-logs';
46
+ export * from './tenant_active_jobs';
47
+ export * from './tenant_calendar';
48
+ export * from './tenant_cash_drawer_sessions';
49
+ export * from './tenant_cash_drawers';
50
+ export * from './tenant_cash_in_hand_transactions';
51
+ export * from './tenant_cash_in_out';
52
+ export * from './tenant_clients';
53
+ export * from './tenant_day_sessions';
54
+ export * from './tenant_hr_attendance_records';
55
+ export * from './tenant_hr_biometric_enrollments';
56
+ export * from './tenant_hr_departments';
57
+ export * from './tenant_hr_documents';
58
+ export * from './tenant_hr_employees';
59
+ export * from './tenant_hr_leave_requests';
60
+ export * from './tenant_hr_payrolls';
61
+ export * from './tenant_hr_performance_reviews';
62
+ export * from './tenant_hr_policies';
63
+ export * from './tenant_hr_positions';
64
+ export * from './tenant_hr_shift_schedules';
65
+ export * from './tenant_hr_shifts';
66
+ export * from './tenant_instore_shift_sessions';
67
+ export * from './tenant_instore_shifts';
68
+ export * from './tenant_inventory_department_transactions';
69
+ export * from './tenant_inventory_department_utilities';
70
+ export * from './tenant_inventory_departments';
71
+ export * from './tenant_inventory_entries';
72
+ export * from './tenant_metadata';
73
+ export * from './tenant_order_item_instructions';
74
+ export * from './tenant_purchase_order_vendor_returns';
75
+ export * from './tenant_purchase_orders';
76
+ export * from './tenant_shifts';
77
+ export * from './tenant_staffs';
78
+ export * from './tenant_vendors';
79
+ export * from './tenants';
80
+ export * from './terminal_devices';
81
+ export * from './tokens';
82
+ export * from './track_order_numbers';
83
+ export * from './void_order_items';
84
+ export * from './vouchers';
85
+ export * from './wallet_transactions';
86
+ export * from './wallets';
87
+ export * from './warehouse-activity-logs';
88
+ export * from './warehouse_categories';
89
+ export * from './warehouse_clients';
90
+ export * from './warehouse_communications';
91
+ export * from './warehouse_internal_movements';
92
+ export * from './warehouse_inventory_entries';
93
+ export * from './warehouse_inventory_lot_serial_numbers';
94
+ export * from './warehouse_inventory_transactions';
95
+ export * from './warehouse_item_transactions';
96
+ export * from './warehouse_items';
97
+ export * from './warehouse_operational_roles';
98
+ export * from './warehouse_purchase_order_receipts';
99
+ export * from './warehouse_purchase_order_rfqs';
100
+ export * from './warehouse_purchase_order_vendor_returns';
101
+ export * from './warehouse_purchase_orders';
102
+ export * from './warehouse_sale_deliveries';
103
+ export * from './warehouse_sale_invoices';
104
+ export * from './warehouse_sale_order_rfqs';
105
+ export * from './warehouse_sale_orders';
106
+ export * from './warehouse_staffs';
107
+ export * from './warehouse_track_order_numbers';
108
+ export * from './warehouse_vendors';
109
+ export * from './warehouse_void_purchase_order_items';
110
+ export * from './warehouse_void_sale_order_items';
111
+ export * from './warehouses';
@@ -0,0 +1,139 @@
1
+ import { Schema } from 'mongoose';
2
+ import { ALL_CURRENCY_CODES, ALL_INTERNAL_CUSTOMER_BILLING_CYCLE_NAMES, ALL_INTERNAL_CUSTOMER_PAYMENT_METHOD_NAMES, ALL_INTERNAL_CUSTOMER_SUBSCRIPTION_PLAN_NAMES, ALL_INTERNAL_CUSTOMER_SUBSCRIPTION_SERVICE_NAMES, ALL_INTERNAL_CUSTOMER_TYPE_NAMES, ALL_INTERNAL_INVOICE_STATUS_NAMES, ALL_SUBSCRIPTION_STATUS, SUBSCRIPTION_STATUS_ENUM, } from '../../constants';
3
+ export const InternalCustomerSchema = new Schema({
4
+ _id: {
5
+ type: Schema.Types.ObjectId,
6
+ required: true,
7
+ immutable: true,
8
+ },
9
+ ref_id: {
10
+ type: String,
11
+ required: true,
12
+ immutable: true,
13
+ },
14
+ customer_type: {
15
+ type: String,
16
+ enum: ALL_INTERNAL_CUSTOMER_TYPE_NAMES,
17
+ required: true,
18
+ },
19
+ full_name: {
20
+ type: String,
21
+ required: true,
22
+ },
23
+ email: {
24
+ type: String,
25
+ default: null,
26
+ },
27
+ phone_number: {
28
+ type: String,
29
+ required: true,
30
+ },
31
+ company_name: {
32
+ type: String,
33
+ required: false,
34
+ },
35
+ tax_number: {
36
+ type: String,
37
+ required: false,
38
+ },
39
+ invoice_notes: {
40
+ type: String,
41
+ default: '',
42
+ },
43
+ personal_notes: {
44
+ type: String,
45
+ default: '',
46
+ },
47
+ active: {
48
+ type: Boolean,
49
+ default: true,
50
+ },
51
+ payment_channel: {
52
+ type: String,
53
+ enum: ALL_INTERNAL_CUSTOMER_PAYMENT_METHOD_NAMES,
54
+ required: true,
55
+ },
56
+ invoice_currency: {
57
+ type: String,
58
+ enum: ALL_CURRENCY_CODES,
59
+ required: true,
60
+ },
61
+ // Subscription
62
+ subscription_plan: {
63
+ type: String,
64
+ enum: ALL_INTERNAL_CUSTOMER_SUBSCRIPTION_PLAN_NAMES,
65
+ required: true,
66
+ },
67
+ subscription_services: {
68
+ type: [String],
69
+ enum: ALL_INTERNAL_CUSTOMER_SUBSCRIPTION_SERVICE_NAMES,
70
+ default: [],
71
+ },
72
+ base_invoice_price: {
73
+ type: Number,
74
+ min: 0,
75
+ required: true,
76
+ },
77
+ base_invoice_discount_amount: {
78
+ type: Number,
79
+ min: 0,
80
+ required: true,
81
+ },
82
+ base_invoice_tax_amount: {
83
+ type: Number,
84
+ min: 0,
85
+ required: true,
86
+ },
87
+ base_invoice_grand_total: {
88
+ type: Number,
89
+ min: 0,
90
+ required: true,
91
+ },
92
+ subscription_status: {
93
+ type: String,
94
+ enum: ALL_SUBSCRIPTION_STATUS,
95
+ default: SUBSCRIPTION_STATUS_ENUM.PENDING,
96
+ },
97
+ billing_cycle: {
98
+ type: String,
99
+ enum: ALL_INTERNAL_CUSTOMER_BILLING_CYCLE_NAMES,
100
+ default: null,
101
+ },
102
+ last_invoice_id: {
103
+ type: Schema.Types.ObjectId,
104
+ default: null,
105
+ },
106
+ last_invoice_number: {
107
+ type: String,
108
+ default: null,
109
+ },
110
+ last_invoice_status: {
111
+ type: String,
112
+ enum: ALL_INTERNAL_INVOICE_STATUS_NAMES,
113
+ default: null,
114
+ },
115
+ last_invoice_due_date: {
116
+ type: Schema.Types.Date,
117
+ default: null,
118
+ },
119
+ last_invoice_paid_at: {
120
+ type: Schema.Types.Date,
121
+ default: null,
122
+ },
123
+ createdAt: {
124
+ type: Schema.Types.Date,
125
+ required: true,
126
+ default: () => new Date(),
127
+ immutable: true,
128
+ },
129
+ updatedAt: {
130
+ type: Schema.Types.Date,
131
+ required: true,
132
+ default: () => new Date(),
133
+ },
134
+ }, {
135
+ timestamps: true,
136
+ versionKey: false,
137
+ minimize: false,
138
+ });
139
+ export const INTERNAL_CUSTOMERS_COLLECTION_NAME = 'internal_customers';
@@ -0,0 +1,119 @@
1
+ import { Schema } from 'mongoose';
2
+ import { ALL_CURRENCY_CODES, ALL_INTERNAL_INVOICE_STATUS_NAMES, ALL_INTERNAL_INVOICE_TYPE_NAMES, ALL_SUBSCRIPTION_HARDWARE_NAMES, } from '../../constants';
3
+ export const InternalInvoiceSchema = new Schema({
4
+ _id: {
5
+ type: Schema.Types.ObjectId,
6
+ required: true,
7
+ immutable: true,
8
+ },
9
+ customer_id: {
10
+ type: Schema.Types.ObjectId,
11
+ required: true,
12
+ ref: 'internal_customers',
13
+ },
14
+ ref_id: {
15
+ type: String,
16
+ default: null,
17
+ },
18
+ customer_name: {
19
+ type: String,
20
+ default: '',
21
+ },
22
+ tax_number: {
23
+ type: String,
24
+ default: null,
25
+ },
26
+ invoice_number: {
27
+ type: String,
28
+ required: true,
29
+ },
30
+ invoice_type: {
31
+ type: String,
32
+ enum: ALL_INTERNAL_INVOICE_TYPE_NAMES,
33
+ required: true,
34
+ },
35
+ hardware: {
36
+ type: [String],
37
+ enum: ALL_SUBSCRIPTION_HARDWARE_NAMES,
38
+ default: null,
39
+ },
40
+ currency: {
41
+ type: String,
42
+ enum: ALL_CURRENCY_CODES,
43
+ required: true,
44
+ },
45
+ subtotal: {
46
+ type: Number,
47
+ min: 0,
48
+ required: true,
49
+ },
50
+ discount_amount: {
51
+ type: Number,
52
+ min: 0,
53
+ default: 0,
54
+ },
55
+ tax_amount: {
56
+ type: Number,
57
+ min: 0,
58
+ default: 0,
59
+ },
60
+ grand_total: {
61
+ type: Number,
62
+ min: 0,
63
+ required: true,
64
+ },
65
+ notes: {
66
+ type: String,
67
+ default: '',
68
+ },
69
+ description: {
70
+ type: String,
71
+ default: '',
72
+ },
73
+ status: {
74
+ type: String,
75
+ enum: ALL_INTERNAL_INVOICE_STATUS_NAMES,
76
+ required: true,
77
+ },
78
+ payment_terms: {
79
+ type: String,
80
+ default: null,
81
+ },
82
+ payment_method: {
83
+ type: String,
84
+ default: null,
85
+ },
86
+ dqrc: {
87
+ type: String,
88
+ default: null,
89
+ },
90
+ issue_date: {
91
+ type: Schema.Types.Date,
92
+ required: true,
93
+ default: () => new Date(),
94
+ },
95
+ due_date: {
96
+ type: Schema.Types.Date,
97
+ default: null,
98
+ },
99
+ paid_at: {
100
+ type: Schema.Types.Date,
101
+ default: null,
102
+ },
103
+ createdAt: {
104
+ type: Schema.Types.Date,
105
+ required: true,
106
+ default: () => new Date(),
107
+ immutable: true,
108
+ },
109
+ updatedAt: {
110
+ type: Schema.Types.Date,
111
+ required: true,
112
+ default: () => new Date(),
113
+ },
114
+ }, {
115
+ timestamps: true,
116
+ versionKey: false,
117
+ minimize: false,
118
+ });
119
+ export const INTERNAL_INVOICES_COLLECTION_NAME = 'internal_invoices';
@@ -0,0 +1,78 @@
1
+ import { Schema } from 'mongoose';
2
+ import { ALL_INTERNAL_LEAD_SOURCES, ALL_INTERNAL_LEAD_STATUS, INTERNAL_LEAD_SOURCE_ENUM, INTERNAL_LEAD_STATUS_ENUM, } from '../../constants';
3
+ export const InternalLeadSchema = new Schema({
4
+ _id: {
5
+ type: Schema.Types.ObjectId,
6
+ required: true,
7
+ immutable: true,
8
+ },
9
+ submission_id: {
10
+ type: String,
11
+ required: true,
12
+ immutable: true,
13
+ },
14
+ form_type: {
15
+ type: String,
16
+ required: true,
17
+ },
18
+ full_name: {
19
+ type: String,
20
+ required: true,
21
+ },
22
+ email: {
23
+ type: String,
24
+ required: true,
25
+ },
26
+ phone_number: {
27
+ type: String,
28
+ required: true,
29
+ },
30
+ restaurant_name: {
31
+ type: String,
32
+ required: true,
33
+ },
34
+ restaurant_type: {
35
+ type: String,
36
+ required: false,
37
+ },
38
+ city: {
39
+ type: String,
40
+ required: false,
41
+ },
42
+ number_of_outlets: {
43
+ type: String,
44
+ required: false,
45
+ },
46
+ message: {
47
+ type: String,
48
+ required: false,
49
+ },
50
+ source: {
51
+ type: String,
52
+ enum: ALL_INTERNAL_LEAD_SOURCES,
53
+ required: true,
54
+ default: INTERNAL_LEAD_SOURCE_ENUM.WEBSITE,
55
+ },
56
+ status: {
57
+ type: String,
58
+ enum: ALL_INTERNAL_LEAD_STATUS,
59
+ required: true,
60
+ default: INTERNAL_LEAD_STATUS_ENUM.NEW,
61
+ },
62
+ createdAt: {
63
+ type: Date,
64
+ required: true,
65
+ immutable: true,
66
+ default: () => new Date(),
67
+ },
68
+ updatedAt: {
69
+ type: Date,
70
+ required: true,
71
+ default: () => new Date(),
72
+ },
73
+ }, {
74
+ timestamps: true,
75
+ versionKey: false,
76
+ minimize: false,
77
+ });
78
+ export const INTERNAL_LEADS_COLLECTION_NAME = 'internal_leads';
@@ -0,0 +1,85 @@
1
+ import { Schema } from 'mongoose';
2
+ import { ALL_INTERNAL_USER_PERMISSIONS, INTERNAL_USER_ROLES_ENUM } from '../../constants';
3
+ import { DefaultInternalOperationalRoles } from '../types/internal_operational_roles';
4
+ const InternalUserPermissionsSchema = { type: String, enum: ALL_INTERNAL_USER_PERMISSIONS };
5
+ const InternalRolesSchema = new Schema({
6
+ [INTERNAL_USER_ROLES_ENUM.SUPER_ADMIN]: {
7
+ type: [InternalUserPermissionsSchema],
8
+ default: DefaultInternalOperationalRoles[INTERNAL_USER_ROLES_ENUM.SUPER_ADMIN],
9
+ },
10
+ [INTERNAL_USER_ROLES_ENUM.HOD]: {
11
+ type: [InternalUserPermissionsSchema],
12
+ default: DefaultInternalOperationalRoles[INTERNAL_USER_ROLES_ENUM.HOD],
13
+ },
14
+ [INTERNAL_USER_ROLES_ENUM.SUPPORT_HEAD]: {
15
+ type: [InternalUserPermissionsSchema],
16
+ default: DefaultInternalOperationalRoles[INTERNAL_USER_ROLES_ENUM.SUPPORT_HEAD],
17
+ },
18
+ [INTERNAL_USER_ROLES_ENUM.SUPPORT_TEAM]: {
19
+ type: [InternalUserPermissionsSchema],
20
+ default: DefaultInternalOperationalRoles[INTERNAL_USER_ROLES_ENUM.SUPPORT_TEAM],
21
+ },
22
+ [INTERNAL_USER_ROLES_ENUM.SALES_HEAD]: {
23
+ type: [InternalUserPermissionsSchema],
24
+ default: DefaultInternalOperationalRoles[INTERNAL_USER_ROLES_ENUM.SALES_HEAD],
25
+ },
26
+ [INTERNAL_USER_ROLES_ENUM.SALES_TEAM]: {
27
+ type: [InternalUserPermissionsSchema],
28
+ default: DefaultInternalOperationalRoles[INTERNAL_USER_ROLES_ENUM.SALES_TEAM],
29
+ },
30
+ [INTERNAL_USER_ROLES_ENUM.MARKETING_HEAD]: {
31
+ type: [InternalUserPermissionsSchema],
32
+ default: DefaultInternalOperationalRoles[INTERNAL_USER_ROLES_ENUM.MARKETING_HEAD],
33
+ },
34
+ [INTERNAL_USER_ROLES_ENUM.MARKETING_TEAM]: {
35
+ type: [InternalUserPermissionsSchema],
36
+ default: DefaultInternalOperationalRoles[INTERNAL_USER_ROLES_ENUM.MARKETING_TEAM],
37
+ },
38
+ [INTERNAL_USER_ROLES_ENUM.HR_HEAD]: {
39
+ type: [InternalUserPermissionsSchema],
40
+ default: DefaultInternalOperationalRoles[INTERNAL_USER_ROLES_ENUM.HR_HEAD],
41
+ },
42
+ [INTERNAL_USER_ROLES_ENUM.HR_TEAM]: {
43
+ type: [InternalUserPermissionsSchema],
44
+ default: DefaultInternalOperationalRoles[INTERNAL_USER_ROLES_ENUM.HR_TEAM],
45
+ },
46
+ [INTERNAL_USER_ROLES_ENUM.DEVELOPER]: {
47
+ type: [InternalUserPermissionsSchema],
48
+ default: DefaultInternalOperationalRoles[INTERNAL_USER_ROLES_ENUM.DEVELOPER],
49
+ },
50
+ [INTERNAL_USER_ROLES_ENUM.FINANCE]: {
51
+ type: [InternalUserPermissionsSchema],
52
+ default: DefaultInternalOperationalRoles[INTERNAL_USER_ROLES_ENUM.FINANCE],
53
+ },
54
+ [INTERNAL_USER_ROLES_ENUM.VIEWER]: {
55
+ type: [InternalUserPermissionsSchema],
56
+ default: DefaultInternalOperationalRoles[INTERNAL_USER_ROLES_ENUM.VIEWER],
57
+ },
58
+ }, { _id: false, minimize: false });
59
+ export const InternalOperationalRolesSchema = new Schema({
60
+ _id: {
61
+ type: Schema.Types.ObjectId,
62
+ required: true,
63
+ immutable: true,
64
+ },
65
+ roles: {
66
+ type: InternalRolesSchema,
67
+ required: true,
68
+ },
69
+ createdAt: {
70
+ type: Schema.Types.Date,
71
+ required: true,
72
+ default: () => new Date(),
73
+ immutable: true,
74
+ },
75
+ updatedAt: {
76
+ type: Schema.Types.Date,
77
+ required: true,
78
+ default: () => new Date(),
79
+ },
80
+ }, {
81
+ timestamps: true,
82
+ versionKey: false,
83
+ minimize: false,
84
+ });
85
+ export const INTERNAL_OPERATIONAL_ROLES_COLLECTION_NAME = 'internal_operational_roles';