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>
49 lines
2.0 KiB
Markdown
49 lines
2.0 KiB
Markdown
# TorbatYar Beauty Business Module
|
|
|
|
**Status:** Migrated (first business module in `modules/`)
|
|
**Route prefix:** `/beauty` (unchanged — routes stay in `app/beauty/`)
|
|
|
|
## Structure
|
|
|
|
```
|
|
modules/beauty/
|
|
├── components/ # Portal shells, layouts (BeautyPortalShell, createPortalLayout, …)
|
|
├── pages/ # Portal page bundles (customer, owner, admin, public, …)
|
|
├── features/owner/ # Owner CRUD screens (organizations, customers, catalog, …)
|
|
├── design-system/ # BeautyStatusChip, BeautyCards, BeautyTablePage, tokens
|
|
├── hooks/ # useBeautyLookups
|
|
├── services/ # beauty-business-api.ts
|
|
├── constants/ # portals.ts (nav config)
|
|
├── types/ # Re-exported API types
|
|
├── forms/ # (reserved — owner forms live in features/owner for now)
|
|
├── tables/ # (reserved — BeautyTablePage in design-system/)
|
|
├── calendar/ # (reserved)
|
|
├── charts/ # (reserved)
|
|
└── utils/ # (reserved)
|
|
```
|
|
|
|
## Import convention
|
|
|
|
```typescript
|
|
import { beautyBusinessApi } from "@/modules/beauty/services/beauty-business-api";
|
|
import { CustomerDashboard } from "@/modules/beauty/pages/customer";
|
|
import { createPortalLayout } from "@/modules/beauty/components/createPortalLayout";
|
|
import { useBeautyLookups } from "@/modules/beauty/hooks/useBeautyLookups";
|
|
```
|
|
|
|
Legacy shims (deprecated):
|
|
|
|
- `@/lib/beauty-business-api`
|
|
- `@/lib/beauty-portals`
|
|
- `@/hooks/useBeautyLookups`
|
|
|
|
## Boundaries
|
|
|
|
- Must not import `@/modules/healthcare/*`, `@/modules/accounting/*`, or legacy healthcare/accounting components.
|
|
- May import `@/components/ds`, `@/hooks/useMe`, `@/hooks/useTenantId`, `@/lib/auth`, `@/lib/utils`.
|
|
|
|
## Related docs
|
|
|
|
- [../../docs/beauty-migration-report.md](../../docs/beauty-migration-report.md)
|
|
- [../../docs/frontend-architecture.md](../../docs/frontend-architecture.md)
|