TorbatYar/frontend/scripts/recreate-owner-routes.mjs
Mortezakoohjani 6f4a484051 Migrate Beauty, Healthcare, and Accounting frontend to modular src/modules architecture.
Move business logic out of App Router into module packages, add boundary validation scripts, and keep all routes as thin re-exports without changing URLs or API behavior.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-26 22:28:27 +03:30

41 lines
1.9 KiB
JavaScript

#!/usr/bin/env node
/** Recreate thin app/beauty/(owner) route pages after feature migration. */
import { writeFileSync, mkdirSync } from "node:fs";
import { join, dirname } from "node:path";
import { fileURLToPath } from "node:url";
const ROOT = join(fileURLToPath(new URL(".", import.meta.url)), "..");
const ROUTES = [
["app/beauty/(owner)/organizations/page.tsx", "organizations"],
["app/beauty/(owner)/customers/page.tsx", "customers"],
["app/beauty/(owner)/branches/page.tsx", "branches"],
["app/beauty/(owner)/appointments/page.tsx", "appointments"],
["app/beauty/(owner)/catalog/services/page.tsx", "catalog-services"],
["app/beauty/(owner)/catalog/categories/page.tsx", "catalog-categories"],
["app/beauty/(owner)/staff/page.tsx", "staff"],
["app/beauty/(owner)/staff/commissions/page.tsx", "staff-commissions"],
["app/beauty/(owner)/packages/page.tsx", "packages"],
["app/beauty/(owner)/packages/memberships/page.tsx", "packages-memberships"],
["app/beauty/(owner)/salon/policies/page.tsx", "salon-policies"],
["app/beauty/(owner)/salon/stations/page.tsx", "salon-stations"],
["app/beauty/(owner)/salon/rooms/page.tsx", "salon-rooms"],
["app/beauty/(owner)/booking/waiting-list/page.tsx", "booking-waiting-list"],
["app/beauty/(owner)/booking/schedules/page.tsx", "booking-schedules"],
["app/beauty/(owner)/marketing/campaigns/page.tsx", "marketing-campaigns"],
["app/beauty/(owner)/marketing/integrations/page.tsx", "marketing-integrations"],
["app/beauty/(owner)/settings/page.tsx", "settings"],
];
for (const [routePath, featureFile] of ROUTES) {
const full = join(ROOT, routePath);
mkdirSync(dirname(full), { recursive: true });
writeFileSync(
full,
`export { default } from "@/modules/beauty/features/owner/${featureFile}";\n`,
"utf8"
);
}
console.log(`Recreated ${ROUTES.length} owner route pages.`);