# Task D.5.5.1: Force Rename Enquiry Domain Opportunity ## Objective Rename the sales execution domain from `Enquiry` to `Opportunity` across active application code for the development-only reset phase of D.5.5.1. ## Review Completed - `AGENTS.md` - `plans/task-d.5.5.1.md` - `plans/task-d.5.5.md` - `docs/adr/0018-lead-enquiry-domain-separation.md` - `docs/implementation/task-d55-opportunity-sales-workspace-refinement.md` - `docs/security/crm-authorization-boundaries.md` - `src/db/schema.ts` - `src/config/nav-config.ts` - current CRM route and feature structure ## What Changed - Renamed active CRM feature module from `src/features/crm/enquiries` to: - [src/features/crm/opportunities](/C:/Users/mtpphtaps/Documents/gitea/alla-allaos-fullstack/src/features/crm/opportunities) - Renamed API route base from `src/app/api/crm/enquiries` to: - [src/app/api/crm/opportunities](/C:/Users/mtpphtaps/Documents/gitea/alla-allaos-fullstack/src/app/api/crm/opportunities) - Renamed dashboard route base from `src/app/dashboard/crm/enquiries` to: - [src/app/dashboard/crm/opportunities](/C:/Users/mtpphtaps/Documents/gitea/alla-allaos-fullstack/src/app/dashboard/crm/opportunities) - Renamed opportunity-facing component files, including: - `opportunity-detail.tsx` - `opportunities-table.tsx` - `opportunity-form-sheet.tsx` - `opportunity-followups-tab.tsx` - `opportunity-assignment-dialog.tsx` - `opportunity-outcome-card.tsx` - `opportunity-status-badge.tsx` - Renamed schema file: - `opportunity.schema.ts` - Replaced active application imports, symbols, route strings, and permission identifiers in `src/` from `enquiry` terminology to `opportunity` terminology. - Updated active CRM permission namespace usage in code from `crmEnquiry*` to `crmOpportunity*`. - Updated active sales route URLs from `/dashboard/crm/enquiries` to `/dashboard/crm/opportunities`. - Updated active API URLs from `/api/crm/enquiries` to `/api/crm/opportunities`. - Renamed active report routes from `/dashboard/crm/reports/enquiry-aging` and `/api/crm/reports/enquiry-aging` to `/dashboard/crm/reports/opportunity-aging` and `/api/crm/reports/opportunity-aging`. - Updated active governance references in project foundations, UI/UX rules, and CRM access inventory to point at the `opportunity` domain. - Fixed the corrupted Thai branch label in `src/db/seeds/foundation.seed.ts` and normalized touched config/seed files to UTF-8. ## Key Rename Direction - `Enquiry` -> `Opportunity` - `enquiry` -> `opportunity` - `crm_enquiries` -> `crm_opportunities` - `crm_enquiry` -> `crm_opportunity` - `crm.enquiry.*` -> `crm.opportunity.*` ## Development Reset Implication This task is implemented under the development-only breaking-change assumption from the task contract: - database reset is expected - migration history compatibility is not preserved - seed/config/document-sequence data must be regenerated around the new opportunity domain ## Verification - `npm exec tsc --noEmit` ## Known Follow-up Areas - Historical docs under `docs/**` still contain legacy enquiry references where they describe earlier phases or legacy architecture. - Database reset, migration regeneration, and seed verification still need to be executed explicitly in the development environment before treating the rename as operationally complete.