Dev #18
@@ -49,7 +49,7 @@ it's stored for a future pricing-rule integration.
|
||||
|
||||
| Function reference | Endpoint | Status |
|
||||
|---|---|---|
|
||||
| `assignAreaToRegion(areaId, regionId)` | — | Blocked — no `Area` entity exists (see [00_existing_gaps.md](./00_existing_gaps.md#9-no-area-entity-between-region-and-route)) |
|
||||
| `assignAreaToRegion(areaId, regionId)` | — | Blocked — no `Area` entity exists (see [00_existing_gaps.md](./00_existing_gaps.md#9-no-area-entity-between-region-and-route)). Stand-in: `PUT /api/routes/{id}/region` assigns/reassigns an existing route directly to a region (see [11_route_sales_management.md](./11_route_sales_management.md)). |
|
||||
| `setRegionalTarget(regionId, period, targetValue)` | `PUT /api/regions/{id}/targets/{period}` | Implemented |
|
||||
| `setRegionalBudget(regionId, period, budgetAmount)` | `PUT /api/regions/{id}/budgets/{period}` | Implemented |
|
||||
| `mapAgencyToRegion(agencyId, regionId)` | `POST /api/regions/{id}/agencies` | Implemented |
|
||||
@@ -95,6 +95,6 @@ in `RegionController.cs` and `RegionService.cs`.
|
||||
(`regions.setTarget/setBudget/mapAgency/setTaxRule/hierarchy/dashboard`), and a new
|
||||
`RegionManageSheet` dialog (`distribution_fe/app/(dashboard)/network/regions/_components/region-manage-sheet.tsx`)
|
||||
wired into the regions table's row actions.
|
||||
- Outstanding: an EF Core migration for the four new tables still needs to be generated and
|
||||
applied (blocked locally by the running dev server locking the build output) — no schema exists
|
||||
in the database yet even though the code is complete.
|
||||
- The EF Core migration `20260831050805_AddRegionManagement` has been generated and applied to the
|
||||
shared database — `RegionalTargets`, `RegionalBudgets`, `RegionAgencyMaps`, and `RegionalTaxRules`
|
||||
all exist.
|
||||
|
||||
@@ -116,7 +116,7 @@ here — see `SRS_User_Management_Module.pdf`.
|
||||
| Function | What it does | Status |
|
||||
|---|---|---|
|
||||
| `createRegion(name, boundaries)` | Creates a new region record. | Partially implemented — `RegionController` supports create with `Name` only, no `boundaries` field. |
|
||||
| `assignAreaToRegion(areaId, regionId)` | Links an existing area under a region. | Not implemented — no `Area` entity exists in the schema (see [00_existing_gaps.md](./00_existing_gaps.md#9-no-area-entity-between-region-and-route)). |
|
||||
| `assignAreaToRegion(areaId, regionId)` | Links an existing area under a region. | Not implemented — no `Area` entity exists in the schema (see [00_existing_gaps.md](./00_existing_gaps.md#9-no-area-entity-between-region-and-route)). As a stand-in, a route (the next tier down) can be assigned/reassigned to a region directly via `PUT /api/routes/{id}/region`. |
|
||||
| `setRegionalTarget(regionId, period, targetValue)` | Sets the sales target for a region for a given period. | Implemented — `PUT /api/regions/{id}/targets/{period}`, backed by the `RegionalTarget` entity. Restricted to `RegionalManager`+ with region scope, or `RegionalAgency` across any region. |
|
||||
| `setRegionalBudget(regionId, period, budgetAmount)` | Allocates budget at the regional level. | Implemented — `PUT /api/regions/{id}/budgets/{period}`, backed by the `RegionalBudget` entity. Same access rule as `setRegionalTarget`. |
|
||||
| `mapAgencyToRegion(agencyId, regionId)` | Assigns a Regional Agency's contract scope to a region. | Implemented — `POST /api/regions/{id}/agencies`, backed by the `RegionAgencyMap` entity. `RegionalAgency` is still a `Role`, not a distinct agency entity — `agencyId` is the `Guid` of an existing `User` holding that role (consistent with `Claim.FK_AgencyUserId`, §18); the endpoint rejects a user who doesn't hold the role. |
|
||||
@@ -128,7 +128,7 @@ here — see `SRS_User_Management_Module.pdf`.
|
||||
|
||||
| Function | What it does | Status |
|
||||
|---|---|---|
|
||||
| `createRoute(name, areaId)` | Creates a new sales visit route within an area. | Partially implemented — `RouteController` supports create, but by `RegionId` not `areaId` (no `Area` entity exists). |
|
||||
| `createRoute(name, areaId)` | Creates a new sales visit route within an area. | Partially implemented — `RouteController` supports create, but by `RegionId` not `areaId` (no `Area` entity exists). A route's region can also be changed after creation via `PUT /api/routes/{id}/region`. |
|
||||
| `assignOutletsToRoute(routeId, outletIds[])` | Maps a set of stores to a route. | Partially implemented — a `Store` has a single `FK_RouteId`, set via `StoreController` create/update; no bulk-assign endpoint. |
|
||||
| `assignRouteToSalesRep(routeId, salesRepId)` | Assigns ownership of a route to an SR. | Not implemented — only `UserRouteScope` exists (scope grant), not a single-owner assignment. |
|
||||
| `optimizeRouteSequence(routeId)` | Reorders the visit sequence for efficiency (distance/priority-based). | Not implemented. |
|
||||
|
||||
@@ -584,10 +584,6 @@ All four of these endpoints return `404` if the region doesn't exist, the caller
|
||||
required region scope, or (for agency mapping) the target user doesn't hold the `RegionalAgency`
|
||||
role — the response body carries no distinction between "not found" and "forbidden".
|
||||
|
||||
No EF Core migration for `RegionalTarget`/`RegionalBudget`/`RegionAgencyMap`/`RegionalTaxRule` has
|
||||
been applied yet — these endpoints will 500 against a database that hasn't run the pending
|
||||
migration.
|
||||
|
||||
---
|
||||
|
||||
### 6.6 Routes
|
||||
@@ -600,6 +596,7 @@ migration.
|
||||
| `GET` | `/api/routes/{id}` | `routes.view` | Get route by ID |
|
||||
| `POST` | `/api/routes` | `routes.create` | Create route |
|
||||
| `PUT` | `/api/routes/{id}` | `routes.update` | Update route |
|
||||
| `PUT` | `/api/routes/{id}/region` | `routes.update` | Assign/reassign the route to a region |
|
||||
| `DELETE` | `/api/routes/{id}` | `routes.delete` | Delete route |
|
||||
|
||||
**Create/Update request:**
|
||||
@@ -627,6 +624,14 @@ migration.
|
||||
}
|
||||
```
|
||||
|
||||
**Assign to region request:**
|
||||
```json
|
||||
// PUT /api/routes/{id}/region
|
||||
{ "regionId": "guid" }
|
||||
```
|
||||
Returns the same `RouteResponse` shape as above. `404` if the route or the target region doesn't
|
||||
exist (or either is inactive).
|
||||
|
||||
---
|
||||
|
||||
### 6.7 Vehicles
|
||||
|
||||
Reference in New Issue
Block a user