TorbatYar/frontend/scripts/update-hospitality-features.mjs
Mortezakoohjani 31a0a34945 feat(loyalty): add complete Loyalty Platform Frontend module
Scaffold frontend/modules/loyalty with types, API client, design system, feature pages, and thin App Router routes. Wire all screens to backend Loyalty service via BFF proxy. Add loyalty docs and update progress.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-27 10:46:45 +03:30

73 lines
3.6 KiB
JavaScript

import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
const FEATURES = path.join(path.dirname(fileURLToPath(import.meta.url)), "..", "modules", "hospitality", "features");
const FEATURE_MAP = [
["venues", "BranchesPage", "venues"],
["branches", "BranchListPage", "branches"],
["diningAreas", "DiningAreasPage", "diningAreas"],
["tables", "TablesPage", "tables"],
["posFloorPlans", "FloorMapPage", "posFloorPlans"],
["reservations", "ReservationsPage", "reservations"],
["waitlist", "QueuePage", "waitlist"],
["connectorRegistrationsCrm", "CustomersPage", "connectorRegistrationsCrm"],
["qrMenuSessions", "GuestsPage", "qrMenuSessions"],
["menus", "DigitalMenuPage", "menus"],
["menuCategories", "MenuCategoriesPage", "menuCategories"],
["menuItems", "MenuItemsPage", "menuItems"],
["modifierGroups", "ModifierGroupsPage", "modifierGroups"],
["modifierOptions", "ModifierOptionsPage", "modifierOptions"],
["availabilityWindows", "AvailabilityPage", "availabilityWindows"],
["menuMediaRefs", "MediaLibraryPage", "menuMediaRefs"],
["qrCodes", "QrMenuPage", "qrCodes"],
["qrOrderingSessions", "QrOrderingPage", "qrOrderingSessions"],
["carts", "CartPage", "carts"],
["cartLines", "CheckoutPage", "cartLines"],
["kitchenTickets", "KitchenDisplayPage", "kitchenTickets"],
["kitchenTicketItems", "KitchenQueuePage", "kitchenTicketItems"],
["kitchenTicketsPrep", "KitchenPrepPage", "kitchenTicketsPrep"],
["posTickets", "PosLitePage", "posTickets"],
["posPayments", "PosProPage", "posPayments"],
["posRegisters", "CashRegisterPage", "posRegisters"],
["posPaymentsList", "PaymentsPage", "posPaymentsList"],
["posDiscounts", "DiscountsPage", "posDiscounts"],
["posDiscountsCoupons", "CouponsPage", "posDiscountsCoupons"],
["featureTogglesPromo", "PromotionsPage", "featureTogglesPromo"],
["connectorDelivery", "DeliveryIntegrationPage", "connectorDelivery"],
["pickupOrders", "PickupOrdersPage", "pickupOrders"],
["onlineOrders", "OnlineOrdersPage", "onlineOrders"],
["orderTimeline", "OrderTimelinePage", "orderTimeline"],
["invoices", "InvoicesPage", "invoices"],
["receipts", "ReceiptsPage", "receipts"],
["analyticsReports", "ReportsPage", "analyticsReports"],
["analyticsSnapshots", "AnalyticsPage", "analyticsSnapshots"],
["inventoryOverview", "InventoryPage", "inventoryOverview"],
["connectorCrm", "CrmIntegrationPage", "connectorCrm"],
["connectorLoyalty", "LoyaltyIntegrationPage", "connectorLoyalty"],
["connectorCommunication", "CommunicationIntegrationPage", "connectorCommunication"],
["connectorWebsite", "WebsiteIntegrationPage", "connectorWebsite"],
["connectorDispatches", "MarketplaceIntegrationPage", "connectorDispatches"],
["settings", "SettingsPage", "settings"],
["permissions", "PermissionsPage", "permissions"],
["roles", "RolesPage", "roles"],
["events", "AuditLogsPage", "events"],
["notifications", "NotificationsPage", "notifications"],
["tenantBundles", "BundlesPage", "tenantBundles"],
];
for (const [featureFile, exportName, registryKey] of FEATURE_MAP) {
const content = `"use client";
import { createHospitalityListPage } from "@/modules/hospitality/components/HospitalityListCrudPage";
import { hospitalityResources } from "@/modules/hospitality/constants/resourceRegistry";
export const ${exportName} = createHospitalityListPage(hospitalityResources.${registryKey});
export default ${exportName};
`;
fs.writeFileSync(path.join(FEATURES, `${featureFile}.tsx`), content);
console.log("Updated", featureFile);
}