@managesome/eposmatic-toolkit 0.3.8 → 0.3.10
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/esm/constants/ANALYTICS.js +146 -0
- package/esm/constants/API_ERRORS.js +6 -0
- package/esm/constants/COMMON.js +369 -0
- package/esm/constants/DELIVERY.js +45 -0
- package/esm/constants/DIALER_ENUMS.js +11 -0
- package/esm/constants/ENUMS.js +1988 -0
- package/esm/constants/FBR_ENUMS.js +18 -0
- package/esm/constants/HUBRISE_ENUMS.js +179 -0
- package/esm/constants/INTERNAL_ENUMS.js +49 -0
- package/esm/constants/NOTIFICATIONS.js +6 -0
- package/esm/constants/ORDER.js +251 -0
- package/esm/constants/PRA_ENUMS.js +18 -0
- package/esm/constants/REPORT_WEBVIEW.js +28 -0
- package/esm/constants/RFQ_GO.js +83 -0
- package/esm/constants/SMARTPAY_ENUMS.js +55 -0
- package/esm/constants/SOCKET.js +149 -0
- package/esm/constants/SRB_ENUMS.js +13 -0
- package/esm/constants/SWITCHPAY.js +28 -0
- package/esm/constants/TENANT_ENUMS.js +90 -0
- package/esm/constants/TENANT_PURCHASE_ORDER.js +91 -0
- package/esm/constants/WALLET.js +51 -0
- package/esm/constants/WAREHOUSE_ANALYTICS.js +28 -0
- package/esm/constants/WAREHOUSE_ENUMS.js +420 -0
- package/esm/constants/WAREHOUSE_PURCHASE_ORDER.js +97 -0
- package/esm/constants/WEBVIEW.js +43 -0
- package/esm/constants/WORKER_ENDPOINTS.js +79 -0
- package/esm/constants/index.js +27 -0
- package/esm/constants/types.js +2 -0
- package/esm/helpers/fbr/generate-invoice.js +94 -0
- package/esm/helpers/fbr/index.js +1 -0
- package/esm/helpers/hubrise/hubrise-catalog.js +304 -0
- package/esm/helpers/hubrise/index.js +1 -0
- package/esm/helpers/index.js +9 -0
- package/esm/helpers/kpra/generate-invoice.js +26 -0
- package/esm/helpers/kpra/index.js +1 -0
- package/esm/helpers/order/generate-order.js +508 -0
- package/esm/helpers/order/generate-warehouse-internal-movement.js +71 -0
- package/esm/helpers/order/generate-warehouse-purchase-order-rfq.js +176 -0
- package/esm/helpers/order/generate-warehouse-purchase-order.js +187 -0
- package/esm/helpers/order/generate-warehouse-sale-order-rfq.js +176 -0
- package/esm/helpers/order/generate-warehouse-sale-order.js +149 -0
- package/esm/helpers/order/index.js +6 -0
- package/esm/helpers/pra/generate-invoice.js +94 -0
- package/esm/helpers/pra/index.js +1 -0
- package/esm/helpers/srb/generate-invoice.js +68 -0
- package/esm/helpers/srb/index.js +1 -0
- package/esm/helpers/store/all-orders-actions.js +17 -0
- package/esm/helpers/store/all-tenant-purchase-orders-actions.js +45 -0
- package/esm/helpers/store/all-warehouse-purchase-order-rfqs-actions.js +66 -0
- package/esm/helpers/store/all-warehouse-purchase-order-vendor-return-actions.js +50 -0
- package/esm/helpers/store/all-warehouse-purchase-orders-actions.js +49 -0
- package/esm/helpers/store/all-warehouse-sale-order-invoices-actions.js +132 -0
- package/esm/helpers/store/all-warehouse-sale-order-rfqs-actions.js +66 -0
- package/esm/helpers/store/all-warehouse-sale-orders-actions.js +72 -0
- package/esm/helpers/store/cart-actions.js +3563 -0
- package/esm/helpers/store/catalog-actions.js +379 -0
- package/esm/helpers/store/common-order-actions.js +937 -0
- package/esm/helpers/store/common-tenant-purchase-order-actions.js +440 -0
- package/esm/helpers/store/common-warehouse-internal-movement-actions.js +95 -0
- package/esm/helpers/store/common-warehouse-purchase-order-actions.js +530 -0
- package/esm/helpers/store/common-warehouse-purchase-order-receipt-actions.js +33 -0
- package/esm/helpers/store/common-warehouse-purchase-order-rfq-actions.js +523 -0
- package/esm/helpers/store/common-warehouse-purchase-order-vendor-return-actions.js +25 -0
- package/esm/helpers/store/common-warehouse-sale-order-actions.js +483 -0
- package/esm/helpers/store/common-warehouse-sale-order-invoice-actions.js +54 -0
- package/esm/helpers/store/common-warehouse-sale-order-rfq-actions.js +523 -0
- package/esm/helpers/store/index.js +26 -0
- package/esm/helpers/store/offline-ordering.js +251 -0
- package/esm/helpers/store/tenant-purchase-orders-cart-actions.js +379 -0
- package/esm/helpers/store/warehouse-purchase-order-rfq-cart-actions.js +360 -0
- package/esm/helpers/store/warehouse-purchase-orders-cart-actions.js +470 -0
- package/esm/helpers/store/warehouse-sale-order-rfq-cart-actions.js +359 -0
- package/esm/helpers/store/warehouse-sale-orders-cart-actions.js +456 -0
- package/esm/helpers/types/api-types.js +1 -0
- package/esm/helpers/types/cart-actions.js +1 -0
- package/esm/helpers/types/cart-helpers.js +1 -0
- package/esm/helpers/types/catalog.js +1 -0
- package/esm/helpers/types/common.js +1 -0
- package/esm/helpers/types/deliverect_menu.js +1 -0
- package/esm/helpers/types/email-templates.js +1 -0
- package/esm/helpers/types/fbr-generate-invoice.js +1 -0
- package/esm/helpers/types/halfhalf.js +1 -0
- package/esm/helpers/types/hubrise_catalog.js +1 -0
- package/esm/helpers/types/hubrise_customers.js +1 -0
- package/esm/helpers/types/hubrise_deliveries.js +1 -0
- package/esm/helpers/types/hubrise_location.js +1 -0
- package/esm/helpers/types/hubrise_orders.js +1 -0
- package/esm/helpers/types/index.js +33 -0
- package/esm/helpers/types/internal-leads.js +1 -0
- package/esm/helpers/types/inventory-catalog.js +1 -0
- package/esm/helpers/types/kpra-generate-invoice.js +1 -0
- package/esm/helpers/types/marketing.js +1 -0
- package/esm/helpers/types/order-engine.js +1 -0
- package/esm/helpers/types/pra-generate-invoice.js +1 -0
- package/esm/helpers/types/report-webview.js +1 -0
- package/esm/helpers/types/reports.js +1 -0
- package/esm/helpers/types/smartpay-apis.js +2 -0
- package/esm/helpers/types/specials.js +1 -0
- package/esm/helpers/types/split_bill.js +1 -0
- package/esm/helpers/types/srb-generate-invoice.js +1 -0
- package/esm/helpers/types/switchpay.js +1 -0
- package/esm/helpers/types/tenant-purchase-order-cart-actions.js +1 -0
- package/esm/helpers/types/warehouse-catalog.js +1 -0
- package/esm/helpers/types/warehouse-purchase-order-cart-actions.js +1 -0
- package/esm/helpers/types/warehouse-purchase-order-rfq-cart-actions.js +1 -0
- package/esm/helpers/types/warehouse-sale-order-cart-actions.js +1 -0
- package/esm/helpers/types/warehouse-sale-order-rfq-cart-actions.js +1 -0
- package/esm/helpers/types/workers.js +1 -0
- package/esm/helpers/utils/asaanbill-identifier-helpers.js +31 -0
- package/esm/helpers/utils/business-day-helpers.js +201 -0
- package/esm/helpers/utils/cart-helpers.js +156 -0
- package/esm/helpers/utils/catalog-conversion.js +129 -0
- package/esm/helpers/utils/code-redemption-helpers.js +452 -0
- package/esm/helpers/utils/color-helpers.js +31 -0
- package/esm/helpers/utils/common.js +368 -0
- package/esm/helpers/utils/crypt.js +40 -0
- package/esm/helpers/utils/customers-helpers.js +15 -0
- package/esm/helpers/utils/delivery-area-helpers.js +42 -0
- package/esm/helpers/utils/delivery-helpers.js +87 -0
- package/esm/helpers/utils/denominations-helpers.js +53 -0
- package/esm/helpers/utils/dinein.js +39 -0
- package/esm/helpers/utils/discount-helpers.js +55 -0
- package/esm/helpers/utils/email-helpers.js +111 -0
- package/esm/helpers/utils/error-helpers.js +14 -0
- package/esm/helpers/utils/expense.js +26 -0
- package/esm/helpers/utils/getFormFieldsDiff.js +15 -0
- package/esm/helpers/utils/gift-card-helpers.js +258 -0
- package/esm/helpers/utils/halfhalf-setup-helpers.js +779 -0
- package/esm/helpers/utils/hourly-comparison-report-helpers.js +851 -0
- package/esm/helpers/utils/hr-helpers.js +62 -0
- package/esm/helpers/utils/hubrise-utils.js +32 -0
- package/esm/helpers/utils/image-helpers.js +95 -0
- package/esm/helpers/utils/image-url-helpers.js +96 -0
- package/esm/helpers/utils/index.js +96 -0
- package/esm/helpers/utils/ingredients.js +26 -0
- package/esm/helpers/utils/internal-amount-helpers.js +49 -0
- package/esm/helpers/utils/inventory.js +123 -0
- package/esm/helpers/utils/inventory_entries.js +91 -0
- package/esm/helpers/utils/inventory_transactions.js +91 -0
- package/esm/helpers/utils/item-report-helpers.js +2603 -0
- package/esm/helpers/utils/items-comparison-report-helpers.js +1057 -0
- package/esm/helpers/utils/kds-helpers.js +43 -0
- package/esm/helpers/utils/location-helpers.js +13 -0
- package/esm/helpers/utils/menu-helpers.js +44 -0
- package/esm/helpers/utils/minified-catalog.js +428 -0
- package/esm/helpers/utils/offer-apply-helpers.js +613 -0
- package/esm/helpers/utils/offers-helpers.js +3351 -0
- package/esm/helpers/utils/operational-roles-helpers.js +33 -0
- package/esm/helpers/utils/order-engine.js +1409 -0
- package/esm/helpers/utils/order-history.js +208 -0
- package/esm/helpers/utils/payment-comparison-report-helpers.js +873 -0
- package/esm/helpers/utils/payment-helpers.js +302 -0
- package/esm/helpers/utils/pdf-generator.js +110 -0
- package/esm/helpers/utils/platform-catalog.js +306 -0
- package/esm/helpers/utils/platform-num.js +188 -0
- package/esm/helpers/utils/platform-specific-tenant-shifts.js +19 -0
- package/esm/helpers/utils/price-conversion.js +24 -0
- package/esm/helpers/utils/printer-helpers.js +319 -0
- package/esm/helpers/utils/public-holidays-helpers.js +8 -0
- package/esm/helpers/utils/ratings-comparison-report-helpers.js +1187 -0
- package/esm/helpers/utils/receipt-engine.js +1050 -0
- package/esm/helpers/utils/review-helpers.js +391 -0
- package/esm/helpers/utils/rider-tracking.js +12 -0
- package/esm/helpers/utils/riders-report-helpers.js +1590 -0
- package/esm/helpers/utils/sales-comparison-report-helpers.js +1259 -0
- package/esm/helpers/utils/sales-comparitive-report-helpers.js +939 -0
- package/esm/helpers/utils/sales-overview-report-helpers.js +1046 -0
- package/esm/helpers/utils/sales-summary-report-helpers.js +877 -0
- package/esm/helpers/utils/scan-code-helpers.js +31 -0
- package/esm/helpers/utils/selection-model.js +68 -0
- package/esm/helpers/utils/shift-window-helpers.js +148 -0
- package/esm/helpers/utils/simplified-catalog.js +107 -0
- package/esm/helpers/utils/simplified-halfhalf.js +101 -0
- package/esm/helpers/utils/simplified-specials.js +107 -0
- package/esm/helpers/utils/simplified-tenant.js +411 -0
- package/esm/helpers/utils/specials-helpers.js +727 -0
- package/esm/helpers/utils/tenant-calendar-helpers.js +67 -0
- package/esm/helpers/utils/tenant-cash-drawer-sessions-helpers.js +248 -0
- package/esm/helpers/utils/tenant-cash-drawers-helpers.js +31 -0
- package/esm/helpers/utils/tenant-cash-in-out-helpers.js +47 -0
- package/esm/helpers/utils/tenant-day-sessions-helpers.js +167 -0
- package/esm/helpers/utils/tenant-instore-shift-sessions-helpers.js +227 -0
- package/esm/helpers/utils/tenant-staff-helpers.js +19 -0
- package/esm/helpers/utils/tenant_cash_in_hand_transactions.js +31 -0
- package/esm/helpers/utils/time-helpers.js +142 -0
- package/esm/helpers/utils/void-items-report-helpers.js +529 -0
- package/esm/helpers/utils/void-order-items-helpers.js +32 -0
- package/esm/helpers/utils/voidations-summary-report-helpers.js +800 -0
- package/esm/helpers/utils/wallet-helpers.js +22 -0
- package/esm/helpers/utils/wallet-redemption-helpers.js +46 -0
- package/esm/helpers/utils/warehouse-catalog-conversion.js +117 -0
- package/esm/helpers/utils/warehouse-inventory.js +59 -0
- package/esm/helpers/utils/warehouse-purchase-order-engine.js +27 -0
- package/esm/helpers/utils/warehouse-purchase-order-receipt-engine.js +205 -0
- package/esm/helpers/utils/warehouse-purchase-order-x-report-helpers.js +1432 -0
- package/esm/helpers/utils/warehouse-sale-order-engine.js +27 -0
- package/esm/helpers/utils/warehouse-sale-order-receipt-engine.js +207 -0
- package/esm/helpers/utils/warehouse-sale-order-x-report-helpers.js +1 -0
- package/esm/helpers/utils/warehouse-sale-x-report-helpers.js +1434 -0
- package/esm/helpers/utils/warehouse-settings-helpers.js +37 -0
- package/esm/helpers/utils/warehouse-void-purchase-order-items-helpers.js +34 -0
- package/esm/helpers/utils/warehouse-void-purchase-order-items-report-helpers.js +18 -0
- package/esm/helpers/utils/warehouse-void-sale-order-items-helpers.js +34 -0
- package/esm/helpers/utils/warehouse-void-sale-order-items-report-helpers.js +18 -0
- package/esm/helpers/utils/warehouse_inventory_transactions.js +91 -0
- package/esm/helpers/utils/x-report-helpers.js +1850 -0
- package/esm/index.js +3 -0
- package/esm/schemas/index.js +2 -0
- package/esm/schemas/models/app_configs.js +36 -0
- package/esm/schemas/models/applied_order_discounts.js +103 -0
- package/esm/schemas/models/brands.js +56 -0
- package/esm/schemas/models/categories.js +74 -0
- package/esm/schemas/models/close_dates.js +63 -0
- package/esm/schemas/models/common-models.js +449 -0
- package/esm/schemas/models/courses.js +62 -0
- package/esm/schemas/models/customer_redemptions.js +82 -0
- package/esm/schemas/models/customers.js +269 -0
- package/esm/schemas/models/deliveries.js +137 -0
- package/esm/schemas/models/delivery_areas.js +97 -0
- package/esm/schemas/models/dinein_floors.js +55 -0
- package/esm/schemas/models/dinein_tables.js +97 -0
- package/esm/schemas/models/dinein_tables_fingerprints.js +96 -0
- package/esm/schemas/models/discounts.js +87 -0
- package/esm/schemas/models/expense_categories.js +61 -0
- package/esm/schemas/models/expense_details.js +130 -0
- package/esm/schemas/models/gift_cards.js +342 -0
- package/esm/schemas/models/halfhalf_setup.js +142 -0
- package/esm/schemas/models/index.js +111 -0
- package/esm/schemas/models/internal_customers.js +139 -0
- package/esm/schemas/models/internal_invoices.js +119 -0
- package/esm/schemas/models/internal_leads.js +78 -0
- package/esm/schemas/models/internal_operational_roles.js +85 -0
- package/esm/schemas/models/internal_staffs.js +65 -0
- package/esm/schemas/models/inventories.js +103 -0
- package/esm/schemas/models/inventory_categories.js +52 -0
- package/esm/schemas/models/inventory_transactions.js +143 -0
- package/esm/schemas/models/item_transactions.js +117 -0
- package/esm/schemas/models/items.js +341 -0
- package/esm/schemas/models/marketing_fingerprints.js +92 -0
- package/esm/schemas/models/menus.js +66 -0
- package/esm/schemas/models/messaging_devices.js +99 -0
- package/esm/schemas/models/modifier_extras.js +120 -0
- package/esm/schemas/models/offers.js +470 -0
- package/esm/schemas/models/offers_fingerprints.js +61 -0
- package/esm/schemas/models/operational_roles.js +155 -0
- package/esm/schemas/models/orders.js +1051 -0
- package/esm/schemas/models/printer_settings.js +245 -0
- package/esm/schemas/models/public_holidays.js +58 -0
- package/esm/schemas/models/reservations.js +127 -0
- package/esm/schemas/models/reviews.js +145 -0
- package/esm/schemas/models/rewards_usage.js +61 -0
- package/esm/schemas/models/riders.js +75 -0
- package/esm/schemas/models/specials.js +169 -0
- package/esm/schemas/models/staff_shifts.js +66 -0
- package/esm/schemas/models/tenant-activity-logs.js +126 -0
- package/esm/schemas/models/tenant_active_jobs.js +77 -0
- package/esm/schemas/models/tenant_calendar.js +89 -0
- package/esm/schemas/models/tenant_cash_drawer_sessions.js +208 -0
- package/esm/schemas/models/tenant_cash_drawers.js +60 -0
- package/esm/schemas/models/tenant_cash_in_hand_transactions.js +69 -0
- package/esm/schemas/models/tenant_cash_in_out.js +104 -0
- package/esm/schemas/models/tenant_clients.js +66 -0
- package/esm/schemas/models/tenant_day_sessions.js +166 -0
- package/esm/schemas/models/tenant_hr_attendance_records.js +87 -0
- package/esm/schemas/models/tenant_hr_biometric_enrollments.js +69 -0
- package/esm/schemas/models/tenant_hr_departments.js +42 -0
- package/esm/schemas/models/tenant_hr_documents.js +71 -0
- package/esm/schemas/models/tenant_hr_employees.js +172 -0
- package/esm/schemas/models/tenant_hr_leave_requests.js +80 -0
- package/esm/schemas/models/tenant_hr_payrolls.js +131 -0
- package/esm/schemas/models/tenant_hr_performance_reviews.js +58 -0
- package/esm/schemas/models/tenant_hr_policies.js +57 -0
- package/esm/schemas/models/tenant_hr_positions.js +48 -0
- package/esm/schemas/models/tenant_hr_shift_schedules.js +84 -0
- package/esm/schemas/models/tenant_hr_shifts.js +64 -0
- package/esm/schemas/models/tenant_instore_shift_sessions.js +204 -0
- package/esm/schemas/models/tenant_instore_shifts.js +63 -0
- package/esm/schemas/models/tenant_inventory_department_transactions.js +116 -0
- package/esm/schemas/models/tenant_inventory_department_utilities.js +85 -0
- package/esm/schemas/models/tenant_inventory_departments.js +55 -0
- package/esm/schemas/models/tenant_inventory_entries.js +131 -0
- package/esm/schemas/models/tenant_metadata.js +88 -0
- package/esm/schemas/models/tenant_order_item_instructions.js +66 -0
- package/esm/schemas/models/tenant_purchase_order_vendor_returns.js +80 -0
- package/esm/schemas/models/tenant_purchase_orders.js +158 -0
- package/esm/schemas/models/tenant_shifts.js +57 -0
- package/esm/schemas/models/tenant_staffs.js +129 -0
- package/esm/schemas/models/tenant_vendors.js +99 -0
- package/esm/schemas/models/tenants.js +811 -0
- package/esm/schemas/models/terminal_devices.js +63 -0
- package/esm/schemas/models/tokens.js +73 -0
- package/esm/schemas/models/track_order_numbers.js +42 -0
- package/esm/schemas/models/void_order_items.js +210 -0
- package/esm/schemas/models/vouchers.js +101 -0
- package/esm/schemas/models/wallet_transactions.js +128 -0
- package/esm/schemas/models/wallets.js +44 -0
- package/esm/schemas/models/warehouse-activity-logs.js +144 -0
- package/esm/schemas/models/warehouse_categories.js +83 -0
- package/esm/schemas/models/warehouse_clients.js +81 -0
- package/esm/schemas/models/warehouse_communications.js +226 -0
- package/esm/schemas/models/warehouse_internal_movements.js +463 -0
- package/esm/schemas/models/warehouse_inventory_entries.js +125 -0
- package/esm/schemas/models/warehouse_inventory_lot_serial_numbers.js +188 -0
- package/esm/schemas/models/warehouse_inventory_transactions.js +133 -0
- package/esm/schemas/models/warehouse_item_transactions.js +97 -0
- package/esm/schemas/models/warehouse_items.js +173 -0
- package/esm/schemas/models/warehouse_operational_roles.js +87 -0
- package/esm/schemas/models/warehouse_purchase_order_receipts.js +163 -0
- package/esm/schemas/models/warehouse_purchase_order_rfqs.js +339 -0
- package/esm/schemas/models/warehouse_purchase_order_vendor_returns.js +199 -0
- package/esm/schemas/models/warehouse_purchase_orders.js +334 -0
- package/esm/schemas/models/warehouse_sale_deliveries.js +155 -0
- package/esm/schemas/models/warehouse_sale_invoices.js +229 -0
- package/esm/schemas/models/warehouse_sale_order_rfqs.js +340 -0
- package/esm/schemas/models/warehouse_sale_orders.js +322 -0
- package/esm/schemas/models/warehouse_staffs.js +104 -0
- package/esm/schemas/models/warehouse_track_order_numbers.js +73 -0
- package/esm/schemas/models/warehouse_vendors.js +99 -0
- package/esm/schemas/models/warehouse_void_purchase_order_items.js +174 -0
- package/esm/schemas/models/warehouse_void_sale_order_items.js +174 -0
- package/esm/schemas/models/warehouses.js +253 -0
- package/esm/schemas/types/app_configs.js +1 -0
- package/esm/schemas/types/applied_order_discounts.js +1 -0
- package/esm/schemas/types/brands.js +1 -0
- package/esm/schemas/types/categories.js +1 -0
- package/esm/schemas/types/close_dates.js +1 -0
- package/esm/schemas/types/common.js +1 -0
- package/esm/schemas/types/courses.js +1 -0
- package/esm/schemas/types/customer_redemptions.js +1 -0
- package/esm/schemas/types/customers.js +1 -0
- package/esm/schemas/types/deliveries.js +1 -0
- package/esm/schemas/types/delivery_areas.js +1 -0
- package/esm/schemas/types/dinein_floors.js +1 -0
- package/esm/schemas/types/dinein_tables.js +1 -0
- package/esm/schemas/types/dinein_tables_fingerprints.js +1 -0
- package/esm/schemas/types/discounts.js +1 -0
- package/esm/schemas/types/expense_categories.js +1 -0
- package/esm/schemas/types/expense_details.js +1 -0
- package/esm/schemas/types/gift_cards.js +1 -0
- package/esm/schemas/types/halfhalf_setup.js +1 -0
- package/esm/schemas/types/index.js +113 -0
- package/esm/schemas/types/internal_customers.js +1 -0
- package/esm/schemas/types/internal_invoices.js +1 -0
- package/esm/schemas/types/internal_leads.js +1 -0
- package/esm/schemas/types/internal_operational_roles.js +16 -0
- package/esm/schemas/types/internal_staffs.js +1 -0
- package/esm/schemas/types/inventories.js +1 -0
- package/esm/schemas/types/inventory_categories.js +1 -0
- package/esm/schemas/types/inventory_department_transactions.js +1 -0
- package/esm/schemas/types/inventory_department_utilities.js +1 -0
- package/esm/schemas/types/inventory_departments.js +1 -0
- package/esm/schemas/types/inventory_transactions.js +1 -0
- package/esm/schemas/types/item_transactions.js +1 -0
- package/esm/schemas/types/items.js +1 -0
- package/esm/schemas/types/marketing_fingerprints.js +1 -0
- package/esm/schemas/types/menus.js +1 -0
- package/esm/schemas/types/messaging_devices.js +1 -0
- package/esm/schemas/types/modifier_extras.js +1 -0
- package/esm/schemas/types/multi_tenants.js +1 -0
- package/esm/schemas/types/offers.js +1 -0
- package/esm/schemas/types/offers_fingerprints.js +1 -0
- package/esm/schemas/types/operational_roles.js +15 -0
- package/esm/schemas/types/orders.js +1 -0
- package/esm/schemas/types/printer_settings.js +1 -0
- package/esm/schemas/types/public_holidays.js +1 -0
- package/esm/schemas/types/reservations.js +1 -0
- package/esm/schemas/types/reviews.js +1 -0
- package/esm/schemas/types/rewards_usage.js +1 -0
- package/esm/schemas/types/riders.js +1 -0
- package/esm/schemas/types/specials.js +1 -0
- package/esm/schemas/types/staff_shifts.js +1 -0
- package/esm/schemas/types/tenant-activity-logs.js +1 -0
- package/esm/schemas/types/tenant_active_jobs.js +1 -0
- package/esm/schemas/types/tenant_calendar.js +1 -0
- package/esm/schemas/types/tenant_cash_drawer_sessions.js +1 -0
- package/esm/schemas/types/tenant_cash_drawers.js +1 -0
- package/esm/schemas/types/tenant_cash_in_hand_transactions.js +1 -0
- package/esm/schemas/types/tenant_cash_in_out.js +1 -0
- package/esm/schemas/types/tenant_clients.js +1 -0
- package/esm/schemas/types/tenant_day_sessions.js +1 -0
- package/esm/schemas/types/tenant_hr_attendance_records.js +1 -0
- package/esm/schemas/types/tenant_hr_biometric_enrollments.js +1 -0
- package/esm/schemas/types/tenant_hr_departments.js +1 -0
- package/esm/schemas/types/tenant_hr_documents.js +1 -0
- package/esm/schemas/types/tenant_hr_employees.js +1 -0
- package/esm/schemas/types/tenant_hr_leave_requests.js +1 -0
- package/esm/schemas/types/tenant_hr_payrolls.js +1 -0
- package/esm/schemas/types/tenant_hr_performance_reviews.js +1 -0
- package/esm/schemas/types/tenant_hr_policies.js +1 -0
- package/esm/schemas/types/tenant_hr_positions.js +1 -0
- package/esm/schemas/types/tenant_hr_shift_schedules.js +1 -0
- package/esm/schemas/types/tenant_hr_shifts.js +1 -0
- package/esm/schemas/types/tenant_instore_shift_sessions.js +1 -0
- package/esm/schemas/types/tenant_instore_shifts.js +1 -0
- package/esm/schemas/types/tenant_inventory_entries.js +1 -0
- package/esm/schemas/types/tenant_metadata.js +1 -0
- package/esm/schemas/types/tenant_order_item_instructions.js +1 -0
- package/esm/schemas/types/tenant_purchase_order_vendor_returns.js +1 -0
- package/esm/schemas/types/tenant_purchase_orders.js +1 -0
- package/esm/schemas/types/tenant_shifts.js +1 -0
- package/esm/schemas/types/tenant_staffs.js +1 -0
- package/esm/schemas/types/tenant_vendors.js +1 -0
- package/esm/schemas/types/tenants.js +1 -0
- package/esm/schemas/types/terminal_devices.js +1 -0
- package/esm/schemas/types/tokens.js +1 -0
- package/esm/schemas/types/track_order_numbers.js +1 -0
- package/esm/schemas/types/void_order_items.js +1 -0
- package/esm/schemas/types/vouchers.js +1 -0
- package/esm/schemas/types/wallet_transactions.js +1 -0
- package/esm/schemas/types/wallets.js +1 -0
- package/esm/schemas/types/warehouse-activity-logs.js +1 -0
- package/esm/schemas/types/warehouse_categories.js +1 -0
- package/esm/schemas/types/warehouse_clients.js +1 -0
- package/esm/schemas/types/warehouse_communications.js +1 -0
- package/esm/schemas/types/warehouse_internal_movements.js +1 -0
- package/esm/schemas/types/warehouse_inventory_entries.js +1 -0
- package/esm/schemas/types/warehouse_inventory_lot_serial_numbers.js +1 -0
- package/esm/schemas/types/warehouse_inventory_transactions.js +1 -0
- package/esm/schemas/types/warehouse_item_transactions.js +1 -0
- package/esm/schemas/types/warehouse_items.js +1 -0
- package/esm/schemas/types/warehouse_operational_roles.js +15 -0
- package/esm/schemas/types/warehouse_purchase_order_receipts.js +18 -0
- package/esm/schemas/types/warehouse_purchase_order_rfqs.js +1 -0
- package/esm/schemas/types/warehouse_purchase_order_vendor_returns.js +1 -0
- package/esm/schemas/types/warehouse_purchase_orders.js +1 -0
- package/esm/schemas/types/warehouse_sale_deliveries.js +1 -0
- package/esm/schemas/types/warehouse_sale_invoices.js +1 -0
- package/esm/schemas/types/warehouse_sale_order_rfqs.js +1 -0
- package/esm/schemas/types/warehouse_sale_orders.js +1 -0
- package/esm/schemas/types/warehouse_staffs.js +1 -0
- package/esm/schemas/types/warehouse_track_order_numbers.js +1 -0
- package/esm/schemas/types/warehouse_vendors.js +1 -0
- package/esm/schemas/types/warehouse_void_purchase_order_items.js +1 -0
- package/esm/schemas/types/warehouse_void_sale_order_items.js +1 -0
- package/esm/schemas/types/warehouses.js +1 -0
- package/lib/helpers/types/api-types.d.ts +37 -0
- package/package.json +6 -3
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import { Schema } from 'mongoose';
|
|
2
|
+
import { ALL_PAYMENT_PROVIDERS } from '../../constants';
|
|
3
|
+
import { PartialPlatformNumSchema } from './common-models';
|
|
4
|
+
const CustomerCardsSchema = new Schema({
|
|
5
|
+
_id: {
|
|
6
|
+
type: String,
|
|
7
|
+
required: true,
|
|
8
|
+
immutable: true,
|
|
9
|
+
},
|
|
10
|
+
card_provider: {
|
|
11
|
+
type: String,
|
|
12
|
+
enum: ALL_PAYMENT_PROVIDERS,
|
|
13
|
+
required: true,
|
|
14
|
+
},
|
|
15
|
+
card_id: {
|
|
16
|
+
type: String,
|
|
17
|
+
required: true,
|
|
18
|
+
},
|
|
19
|
+
payment_provider_linked_customer_id: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: null,
|
|
22
|
+
},
|
|
23
|
+
card_number: {
|
|
24
|
+
type: String,
|
|
25
|
+
required: true,
|
|
26
|
+
},
|
|
27
|
+
card_type: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: '',
|
|
30
|
+
},
|
|
31
|
+
card_holder_name: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: '',
|
|
34
|
+
},
|
|
35
|
+
card_country_code: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: null,
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
const CustomerAddressDetailsSchema = new Schema({
|
|
41
|
+
city: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: '',
|
|
44
|
+
},
|
|
45
|
+
address_instructions: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: '',
|
|
48
|
+
},
|
|
49
|
+
state: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: '',
|
|
52
|
+
},
|
|
53
|
+
street: {
|
|
54
|
+
type: String,
|
|
55
|
+
default: '',
|
|
56
|
+
},
|
|
57
|
+
lat: {
|
|
58
|
+
type: Number,
|
|
59
|
+
default: 0,
|
|
60
|
+
},
|
|
61
|
+
lng: {
|
|
62
|
+
type: Number,
|
|
63
|
+
default: 0,
|
|
64
|
+
},
|
|
65
|
+
zip_code: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: '',
|
|
68
|
+
},
|
|
69
|
+
country_code: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: '',
|
|
72
|
+
},
|
|
73
|
+
place_id: {
|
|
74
|
+
type: String,
|
|
75
|
+
default: '',
|
|
76
|
+
},
|
|
77
|
+
distance_in_meters_from_store: {
|
|
78
|
+
type: Number,
|
|
79
|
+
default: 0,
|
|
80
|
+
},
|
|
81
|
+
}, {
|
|
82
|
+
_id: false,
|
|
83
|
+
minimize: false,
|
|
84
|
+
});
|
|
85
|
+
export const CustomersSchema = new Schema({
|
|
86
|
+
_id: {
|
|
87
|
+
type: Schema.Types.ObjectId,
|
|
88
|
+
required: true,
|
|
89
|
+
immutable: true,
|
|
90
|
+
},
|
|
91
|
+
phone_number: {
|
|
92
|
+
type: String,
|
|
93
|
+
required: true,
|
|
94
|
+
immutable: true,
|
|
95
|
+
},
|
|
96
|
+
brand_id: {
|
|
97
|
+
type: String,
|
|
98
|
+
required: true,
|
|
99
|
+
immutable: true,
|
|
100
|
+
ref: 'brands',
|
|
101
|
+
},
|
|
102
|
+
tenants: {
|
|
103
|
+
type: [String],
|
|
104
|
+
default: [],
|
|
105
|
+
},
|
|
106
|
+
uid: {
|
|
107
|
+
type: String,
|
|
108
|
+
default: null,
|
|
109
|
+
},
|
|
110
|
+
display_name: {
|
|
111
|
+
type: String,
|
|
112
|
+
default: null,
|
|
113
|
+
},
|
|
114
|
+
email: {
|
|
115
|
+
type: String,
|
|
116
|
+
default: null,
|
|
117
|
+
},
|
|
118
|
+
email_verified: {
|
|
119
|
+
type: Boolean,
|
|
120
|
+
default: false,
|
|
121
|
+
},
|
|
122
|
+
phone_number_verified: {
|
|
123
|
+
type: Boolean,
|
|
124
|
+
default: false,
|
|
125
|
+
},
|
|
126
|
+
image_url: {
|
|
127
|
+
type: String,
|
|
128
|
+
default: null,
|
|
129
|
+
},
|
|
130
|
+
active: {
|
|
131
|
+
type: Boolean,
|
|
132
|
+
default: true,
|
|
133
|
+
},
|
|
134
|
+
is_disabled: {
|
|
135
|
+
type: Boolean,
|
|
136
|
+
required: false,
|
|
137
|
+
},
|
|
138
|
+
gender: {
|
|
139
|
+
type: String,
|
|
140
|
+
default: null,
|
|
141
|
+
},
|
|
142
|
+
total_orders_per_platform_type: {
|
|
143
|
+
type: PartialPlatformNumSchema,
|
|
144
|
+
default: {},
|
|
145
|
+
},
|
|
146
|
+
total_spent_per_platform_type: {
|
|
147
|
+
type: PartialPlatformNumSchema,
|
|
148
|
+
default: {},
|
|
149
|
+
},
|
|
150
|
+
total_orders: {
|
|
151
|
+
type: Number,
|
|
152
|
+
default: 0,
|
|
153
|
+
},
|
|
154
|
+
total_spent: {
|
|
155
|
+
type: Number,
|
|
156
|
+
default: 0,
|
|
157
|
+
},
|
|
158
|
+
last_order_at: {
|
|
159
|
+
type: Schema.Types.Date,
|
|
160
|
+
default: null,
|
|
161
|
+
},
|
|
162
|
+
last_order_id: {
|
|
163
|
+
type: Schema.Types.ObjectId,
|
|
164
|
+
default: null,
|
|
165
|
+
},
|
|
166
|
+
loyalty_points: {
|
|
167
|
+
type: Number,
|
|
168
|
+
default: 0,
|
|
169
|
+
},
|
|
170
|
+
cashback_balance: {
|
|
171
|
+
type: Number,
|
|
172
|
+
default: 0,
|
|
173
|
+
},
|
|
174
|
+
gift_cards: {
|
|
175
|
+
type: Map,
|
|
176
|
+
of: Number,
|
|
177
|
+
default: {},
|
|
178
|
+
},
|
|
179
|
+
voucher_codes: {
|
|
180
|
+
type: Map,
|
|
181
|
+
of: Number,
|
|
182
|
+
default: {},
|
|
183
|
+
},
|
|
184
|
+
address_details: {
|
|
185
|
+
type: CustomerAddressDetailsSchema,
|
|
186
|
+
default: null,
|
|
187
|
+
},
|
|
188
|
+
other_addresses: {
|
|
189
|
+
type: [CustomerAddressDetailsSchema],
|
|
190
|
+
required: false,
|
|
191
|
+
},
|
|
192
|
+
cards: {
|
|
193
|
+
type: [CustomerCardsSchema],
|
|
194
|
+
default: [],
|
|
195
|
+
},
|
|
196
|
+
order_ids: {
|
|
197
|
+
type: [Schema.Types.ObjectId],
|
|
198
|
+
default: [],
|
|
199
|
+
},
|
|
200
|
+
createdAt: {
|
|
201
|
+
type: Schema.Types.Date,
|
|
202
|
+
required: true,
|
|
203
|
+
default: () => new Date(),
|
|
204
|
+
immutable: true,
|
|
205
|
+
},
|
|
206
|
+
updatedAt: {
|
|
207
|
+
type: Schema.Types.Date,
|
|
208
|
+
required: true,
|
|
209
|
+
default: () => new Date(),
|
|
210
|
+
},
|
|
211
|
+
}, {
|
|
212
|
+
timestamps: true,
|
|
213
|
+
versionKey: false,
|
|
214
|
+
minimize: false,
|
|
215
|
+
});
|
|
216
|
+
export const CUSTOMER_COLLECTION_NAME = 'customers';
|
|
217
|
+
/**
|
|
218
|
+
* Describes the indexes for `customers`. Values are Mongo key patterns that can
|
|
219
|
+
* be passed straight to `.hint()`.
|
|
220
|
+
* - `_id`: unique primary key.
|
|
221
|
+
* - `brand_id__phone_number`: per-brand customer lookups by phone number.
|
|
222
|
+
* - `brand_id__createdAt`: per-brand customer lookups newest first.
|
|
223
|
+
* - `brand_id__total_spent`: per-brand customer lookups by total spent.
|
|
224
|
+
* - `brand_id__total_orders`: per-brand customer lookups by total orders.
|
|
225
|
+
* - `brand_id__loyalty_points`: per-brand customer lookups by loyalty points.
|
|
226
|
+
* - `brand_id__cashback_balance`: per-brand customer lookups by cashback.
|
|
227
|
+
* - `brand_id__last_order_at`: per-brand customer lookups by last order time.
|
|
228
|
+
* - `brand_id__gift_cards`: per-brand customer lookups by gift cards.
|
|
229
|
+
* - `brand_id__voucher_codes`: per-brand customer lookups by voucher codes.
|
|
230
|
+
*/
|
|
231
|
+
export const CUSTOMER_COLLECTION_INDEXES = {
|
|
232
|
+
_id: { _id: 1 }, // Unique Index
|
|
233
|
+
brand_id__phone_number: {
|
|
234
|
+
brand_id: 1,
|
|
235
|
+
phone_number: 1,
|
|
236
|
+
}, // per-brand customer lookups by phone number
|
|
237
|
+
brand_id__createdAt: {
|
|
238
|
+
brand_id: 1,
|
|
239
|
+
createdAt: -1,
|
|
240
|
+
}, // per-brand customer lookups newest first
|
|
241
|
+
brand_id__total_spent: {
|
|
242
|
+
brand_id: 1,
|
|
243
|
+
total_spent: -1,
|
|
244
|
+
}, // per-brand customer lookups by total spent
|
|
245
|
+
brand_id__total_orders: {
|
|
246
|
+
brand_id: 1,
|
|
247
|
+
total_orders: -1,
|
|
248
|
+
}, // per-brand customer lookups by total orders
|
|
249
|
+
brand_id__loyalty_points: {
|
|
250
|
+
brand_id: 1,
|
|
251
|
+
loyalty_points: 1,
|
|
252
|
+
}, // per-brand customer lookups by loyalty points
|
|
253
|
+
brand_id__cashback_balance: {
|
|
254
|
+
brand_id: 1,
|
|
255
|
+
cashback_balance: 1,
|
|
256
|
+
}, // per-brand customer lookups by cashback
|
|
257
|
+
brand_id__last_order_at: {
|
|
258
|
+
brand_id: 1,
|
|
259
|
+
last_order_at: 1,
|
|
260
|
+
}, // per-brand customer lookups by last order time
|
|
261
|
+
brand_id__gift_cards: {
|
|
262
|
+
brand_id: 1,
|
|
263
|
+
gift_cards: 1,
|
|
264
|
+
}, // per-brand customer lookups by gift cards
|
|
265
|
+
brand_id__voucher_codes: {
|
|
266
|
+
brand_id: 1,
|
|
267
|
+
voucher_codes: 1,
|
|
268
|
+
}, // per-brand customer lookups by voucher codes
|
|
269
|
+
};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { Schema } from 'mongoose';
|
|
2
|
+
import { ALL_CURRENCY_SYMBOLS, ALL_DELIVERY_STATUS, CURRENCY_SYMBOL_ENUM, DELIVERY_STATUS_ENUM } from '../../constants';
|
|
3
|
+
export const DeliveriesSchema = new Schema({
|
|
4
|
+
_id: {
|
|
5
|
+
type: Schema.Types.ObjectId,
|
|
6
|
+
required: true,
|
|
7
|
+
immutable: true,
|
|
8
|
+
},
|
|
9
|
+
order_id: {
|
|
10
|
+
type: Schema.Types.ObjectId,
|
|
11
|
+
required: true,
|
|
12
|
+
immutable: true,
|
|
13
|
+
},
|
|
14
|
+
order_number: {
|
|
15
|
+
type: Number,
|
|
16
|
+
min: 0,
|
|
17
|
+
default: null,
|
|
18
|
+
},
|
|
19
|
+
rider_id: {
|
|
20
|
+
type: String,
|
|
21
|
+
required: true,
|
|
22
|
+
immutable: true,
|
|
23
|
+
},
|
|
24
|
+
tenant_id: {
|
|
25
|
+
type: String,
|
|
26
|
+
required: true,
|
|
27
|
+
},
|
|
28
|
+
rider_name: {
|
|
29
|
+
type: String,
|
|
30
|
+
required: true,
|
|
31
|
+
},
|
|
32
|
+
tenant_name: {
|
|
33
|
+
type: String,
|
|
34
|
+
required: true,
|
|
35
|
+
},
|
|
36
|
+
tenant_image_url: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: null,
|
|
39
|
+
},
|
|
40
|
+
tenant_coordinates: {
|
|
41
|
+
type: [Number, Number],
|
|
42
|
+
default: [0, 0],
|
|
43
|
+
},
|
|
44
|
+
tenant_currency_symbol: {
|
|
45
|
+
type: String,
|
|
46
|
+
enum: ALL_CURRENCY_SYMBOLS,
|
|
47
|
+
default: CURRENCY_SYMBOL_ENUM.$,
|
|
48
|
+
},
|
|
49
|
+
tenant_address: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: '',
|
|
52
|
+
},
|
|
53
|
+
tenant_phone_numbers: {
|
|
54
|
+
type: [String],
|
|
55
|
+
default: [],
|
|
56
|
+
},
|
|
57
|
+
status: {
|
|
58
|
+
type: String,
|
|
59
|
+
required: true,
|
|
60
|
+
enum: ALL_DELIVERY_STATUS,
|
|
61
|
+
default: DELIVERY_STATUS_ENUM.PENDING,
|
|
62
|
+
},
|
|
63
|
+
cancel_reason: {
|
|
64
|
+
type: String,
|
|
65
|
+
required: false,
|
|
66
|
+
},
|
|
67
|
+
polyline: {
|
|
68
|
+
type: [[Number, Number]],
|
|
69
|
+
required: true,
|
|
70
|
+
default: [],
|
|
71
|
+
},
|
|
72
|
+
distance_in_meters_from_store: {
|
|
73
|
+
type: Number,
|
|
74
|
+
default: 0,
|
|
75
|
+
},
|
|
76
|
+
rider_revenue: {
|
|
77
|
+
type: Number,
|
|
78
|
+
min: 0,
|
|
79
|
+
required: false,
|
|
80
|
+
},
|
|
81
|
+
pickup_food_image_url: {
|
|
82
|
+
type: String,
|
|
83
|
+
required: false,
|
|
84
|
+
},
|
|
85
|
+
dropoff_food_image_url: {
|
|
86
|
+
type: String,
|
|
87
|
+
required: false,
|
|
88
|
+
},
|
|
89
|
+
tracking_enabled: {
|
|
90
|
+
type: Boolean,
|
|
91
|
+
required: false,
|
|
92
|
+
},
|
|
93
|
+
createdAt_mins: {
|
|
94
|
+
type: Number,
|
|
95
|
+
required: true,
|
|
96
|
+
immutable: true,
|
|
97
|
+
default: () => {
|
|
98
|
+
const date = new Date();
|
|
99
|
+
return Math.floor(date.getHours() * 60 + date.getMinutes());
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
createdAt: {
|
|
103
|
+
type: Date,
|
|
104
|
+
required: true,
|
|
105
|
+
immutable: true,
|
|
106
|
+
default: () => new Date(),
|
|
107
|
+
},
|
|
108
|
+
updatedAt: {
|
|
109
|
+
type: Date,
|
|
110
|
+
required: true,
|
|
111
|
+
default: () => new Date(),
|
|
112
|
+
},
|
|
113
|
+
}, {
|
|
114
|
+
timestamps: true,
|
|
115
|
+
versionKey: false,
|
|
116
|
+
minimize: false,
|
|
117
|
+
});
|
|
118
|
+
export const DELIVERIES_COLLECTION_NAME = 'deliveries';
|
|
119
|
+
/**
|
|
120
|
+
* Describes the indexes for `deliveries`. Values are Mongo key patterns that can
|
|
121
|
+
* be passed straight to `.hint()`.
|
|
122
|
+
* - `_id`: unique primary key.
|
|
123
|
+
* - `rider_id__createdAt`: per-rider delivery lookups newest first.
|
|
124
|
+
* - `order_id__rider_id`: UNIQUE per (order_id, rider_id) — one delivery per
|
|
125
|
+
* order per rider.
|
|
126
|
+
*/
|
|
127
|
+
export const DELIVERIES_COLLECTION_INDEXES = {
|
|
128
|
+
_id: { _id: 1 }, // Unique Index
|
|
129
|
+
order_id__rider_id: {
|
|
130
|
+
order_id: 1,
|
|
131
|
+
rider_id: 1,
|
|
132
|
+
}, // UNIQUE per (order_id, rider_id) — one delivery per order per rider
|
|
133
|
+
rider_id__createdAt: {
|
|
134
|
+
rider_id: 1,
|
|
135
|
+
createdAt: -1,
|
|
136
|
+
}, // per-rider delivery lookups newest first
|
|
137
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Schema } from 'mongoose';
|
|
2
|
+
import { OrderFromPriceSchema } from './common-models';
|
|
3
|
+
const PolygonSchema = new Schema({
|
|
4
|
+
lat: {
|
|
5
|
+
type: Schema.Types.Number,
|
|
6
|
+
required: true,
|
|
7
|
+
},
|
|
8
|
+
lng: {
|
|
9
|
+
type: Schema.Types.Number,
|
|
10
|
+
required: true,
|
|
11
|
+
},
|
|
12
|
+
}, {
|
|
13
|
+
_id: false,
|
|
14
|
+
minimize: false,
|
|
15
|
+
});
|
|
16
|
+
export const DeliveryAreaSchema = new Schema({
|
|
17
|
+
_id: {
|
|
18
|
+
type: Schema.Types.ObjectId,
|
|
19
|
+
required: true,
|
|
20
|
+
immutable: true,
|
|
21
|
+
},
|
|
22
|
+
active: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
required: true,
|
|
25
|
+
default: true,
|
|
26
|
+
},
|
|
27
|
+
tenant_id: {
|
|
28
|
+
type: String,
|
|
29
|
+
required: true,
|
|
30
|
+
immutable: true,
|
|
31
|
+
ref: 'tenants',
|
|
32
|
+
},
|
|
33
|
+
name: {
|
|
34
|
+
type: String,
|
|
35
|
+
required: true,
|
|
36
|
+
},
|
|
37
|
+
formatted_address: {
|
|
38
|
+
type: String,
|
|
39
|
+
required: true,
|
|
40
|
+
},
|
|
41
|
+
city: {
|
|
42
|
+
type: String,
|
|
43
|
+
required: true,
|
|
44
|
+
},
|
|
45
|
+
state: {
|
|
46
|
+
type: String,
|
|
47
|
+
required: true,
|
|
48
|
+
},
|
|
49
|
+
country: {
|
|
50
|
+
type: String,
|
|
51
|
+
required: true,
|
|
52
|
+
},
|
|
53
|
+
postal_code: {
|
|
54
|
+
type: String,
|
|
55
|
+
required: true,
|
|
56
|
+
},
|
|
57
|
+
lat: {
|
|
58
|
+
type: Number,
|
|
59
|
+
required: true,
|
|
60
|
+
},
|
|
61
|
+
lng: {
|
|
62
|
+
type: Number,
|
|
63
|
+
required: true,
|
|
64
|
+
},
|
|
65
|
+
polygon: {
|
|
66
|
+
type: [PolygonSchema],
|
|
67
|
+
required: true, // min length 3
|
|
68
|
+
},
|
|
69
|
+
delivery_charges: {
|
|
70
|
+
type: OrderFromPriceSchema,
|
|
71
|
+
default: null,
|
|
72
|
+
},
|
|
73
|
+
min_order_value: {
|
|
74
|
+
type: OrderFromPriceSchema,
|
|
75
|
+
default: null,
|
|
76
|
+
},
|
|
77
|
+
delivery_free_over: {
|
|
78
|
+
type: OrderFromPriceSchema,
|
|
79
|
+
default: null,
|
|
80
|
+
},
|
|
81
|
+
createdAt: {
|
|
82
|
+
type: Schema.Types.Date,
|
|
83
|
+
required: true,
|
|
84
|
+
default: () => new Date(),
|
|
85
|
+
immutable: true,
|
|
86
|
+
},
|
|
87
|
+
updatedAt: {
|
|
88
|
+
type: Schema.Types.Date,
|
|
89
|
+
required: true,
|
|
90
|
+
default: () => new Date(),
|
|
91
|
+
},
|
|
92
|
+
}, {
|
|
93
|
+
timestamps: true,
|
|
94
|
+
versionKey: false,
|
|
95
|
+
minimize: false,
|
|
96
|
+
});
|
|
97
|
+
export const DELIVERY_AREAS_COLLECTION_NAME = 'delivery_areas';
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Schema } from 'mongoose';
|
|
2
|
+
export const DineInFloorsSchema = new Schema({
|
|
3
|
+
_id: {
|
|
4
|
+
type: Schema.Types.ObjectId,
|
|
5
|
+
required: true,
|
|
6
|
+
immutable: true,
|
|
7
|
+
},
|
|
8
|
+
tenant_id: {
|
|
9
|
+
type: String,
|
|
10
|
+
required: true,
|
|
11
|
+
immutable: true,
|
|
12
|
+
ref: 'tenants',
|
|
13
|
+
},
|
|
14
|
+
name: {
|
|
15
|
+
type: String,
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
sort_id: {
|
|
19
|
+
type: Number,
|
|
20
|
+
required: true,
|
|
21
|
+
},
|
|
22
|
+
active: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
required: true,
|
|
25
|
+
},
|
|
26
|
+
createdAt: {
|
|
27
|
+
type: Schema.Types.Date,
|
|
28
|
+
required: true,
|
|
29
|
+
default: () => new Date(),
|
|
30
|
+
immutable: true,
|
|
31
|
+
},
|
|
32
|
+
updatedAt: {
|
|
33
|
+
type: Schema.Types.Date,
|
|
34
|
+
required: true,
|
|
35
|
+
default: () => new Date(),
|
|
36
|
+
},
|
|
37
|
+
}, {
|
|
38
|
+
timestamps: true,
|
|
39
|
+
versionKey: false,
|
|
40
|
+
minimize: false,
|
|
41
|
+
});
|
|
42
|
+
export const DINEIN_FLOORS_COLLECTION_NAME = 'dinein_floors';
|
|
43
|
+
/**
|
|
44
|
+
* Describes the indexes for `dinein_floors`. Values are Mongo key patterns that
|
|
45
|
+
* can be passed straight to `.hint()`.
|
|
46
|
+
* - `_id`: unique primary key.
|
|
47
|
+
* - `tenant_id__active`: per-tenant floor lookups by active state.
|
|
48
|
+
*/
|
|
49
|
+
export const DINEIN_FLOORS_COLLECTION_INDEXES = {
|
|
50
|
+
_id: { _id: 1 }, // Unique Index
|
|
51
|
+
tenant_id__active: {
|
|
52
|
+
tenant_id: 1,
|
|
53
|
+
active: 1,
|
|
54
|
+
}, // per-tenant floor lookups by active state
|
|
55
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Schema } from 'mongoose';
|
|
2
|
+
import { ALL_TABLE_TYPES } from '../../constants';
|
|
3
|
+
export const DineinTablesSchema = new Schema({
|
|
4
|
+
_id: {
|
|
5
|
+
type: Schema.Types.ObjectId,
|
|
6
|
+
required: true,
|
|
7
|
+
immutable: true,
|
|
8
|
+
},
|
|
9
|
+
tenant_id: {
|
|
10
|
+
type: String,
|
|
11
|
+
required: true,
|
|
12
|
+
immutable: true,
|
|
13
|
+
ref: 'tenants',
|
|
14
|
+
},
|
|
15
|
+
dinein_floor_id: {
|
|
16
|
+
type: Schema.Types.ObjectId,
|
|
17
|
+
required: true,
|
|
18
|
+
immutable: true,
|
|
19
|
+
ref: 'dinein_floors',
|
|
20
|
+
},
|
|
21
|
+
order_id: {
|
|
22
|
+
type: Schema.Types.ObjectId,
|
|
23
|
+
// ref: 'orders', //NOTE: This is commented out because ref can be null
|
|
24
|
+
default: null,
|
|
25
|
+
},
|
|
26
|
+
name: {
|
|
27
|
+
type: String,
|
|
28
|
+
required: true,
|
|
29
|
+
},
|
|
30
|
+
num_of_seats: {
|
|
31
|
+
type: Number,
|
|
32
|
+
required: true,
|
|
33
|
+
},
|
|
34
|
+
table_type: {
|
|
35
|
+
type: String,
|
|
36
|
+
enum: ALL_TABLE_TYPES,
|
|
37
|
+
required: true,
|
|
38
|
+
},
|
|
39
|
+
scale: {
|
|
40
|
+
type: Number,
|
|
41
|
+
required: true,
|
|
42
|
+
},
|
|
43
|
+
angle: {
|
|
44
|
+
type: Number,
|
|
45
|
+
required: true,
|
|
46
|
+
},
|
|
47
|
+
position: {
|
|
48
|
+
type: [Number, Number],
|
|
49
|
+
required: true,
|
|
50
|
+
},
|
|
51
|
+
num_of_guests: {
|
|
52
|
+
type: Number,
|
|
53
|
+
required: true,
|
|
54
|
+
},
|
|
55
|
+
seated_at: {
|
|
56
|
+
type: Schema.Types.Date,
|
|
57
|
+
default: null,
|
|
58
|
+
},
|
|
59
|
+
order_placed_at: {
|
|
60
|
+
type: Schema.Types.Date,
|
|
61
|
+
default: null,
|
|
62
|
+
},
|
|
63
|
+
createdAt: {
|
|
64
|
+
type: Schema.Types.Date,
|
|
65
|
+
required: true,
|
|
66
|
+
default: () => new Date(),
|
|
67
|
+
immutable: true,
|
|
68
|
+
},
|
|
69
|
+
updatedAt: {
|
|
70
|
+
type: Schema.Types.Date,
|
|
71
|
+
required: true,
|
|
72
|
+
default: () => new Date(),
|
|
73
|
+
},
|
|
74
|
+
}, {
|
|
75
|
+
timestamps: true,
|
|
76
|
+
versionKey: false,
|
|
77
|
+
minimize: false,
|
|
78
|
+
});
|
|
79
|
+
export const DINEIN_TABLES_COLLECTION_NAME = 'dinein_tables';
|
|
80
|
+
/**
|
|
81
|
+
* Describes the indexes for `dinein_tables`. Values are Mongo key patterns that
|
|
82
|
+
* can be passed straight to `.hint()`.
|
|
83
|
+
* - `_id`: unique primary key.
|
|
84
|
+
* - `tenant_id__dinein_floor_id`: per-tenant table lookups by dine-in floor.
|
|
85
|
+
* - `tenant_id__order_id`: per-tenant table lookups by order.
|
|
86
|
+
*/
|
|
87
|
+
export const DINEIN_TABLES_COLLECTION_INDEXES = {
|
|
88
|
+
_id: { _id: 1 }, // Unique Index
|
|
89
|
+
tenant_id__dinein_floor_id: {
|
|
90
|
+
tenant_id: 1,
|
|
91
|
+
dinein_floor_id: 1,
|
|
92
|
+
}, // per-tenant table lookups by dine-in floor
|
|
93
|
+
tenant_id__order_id: {
|
|
94
|
+
tenant_id: 1,
|
|
95
|
+
order_id: 1,
|
|
96
|
+
}, // per-tenant table lookups by order
|
|
97
|
+
};
|