@withpotter/location — module reference
HTTP routes this module mounts, plus its internal use-cases, entities, and repositories. The exhaustive request/response contract is the engine’s OpenAPI document at /docs; the layered structure below follows the package internal architecture.
HTTP routes
Locations /
| Method | Path | Auth | Description |
|---|---|---|---|
GET | /locations | Yes | List |
GET | /locations/hierarchy | Yes | Tenant hierarchy |
GET | /public/locations/hierarchy | — | Hierarchy |
POST | /locations | Yes | Create |
POST | /locations/bulk | Yes | Bulk create |
PATCH | /locations/:id | Yes | Update |
DELETE | /locations/:id | Yes | Delete |
Internals
Use-cases
Application operations. Each is a single-purpose class with one execute() method.
| Use-case | Signature |
|---|---|
BulkCreateLocationsUseCase | execute(tenantId: string, dto: BulkCreateLocationDto) |
CreateLocationUseCase | execute(tenantId: string, dto: CreateLocationDto) |
DeleteLocationUseCase | execute(tenantId: string, id: string) |
GetLocationHierarchyUseCase | execute(tenantId: string): Promise<CountryWithStates[]> |
ListLocationsUseCase | execute(tenantId: string) |
UpdateLocationUseCase | execute(tenantId: string, id: string, dto: UpdateLocationDto) |
Entities
Sequelize models owned by this module.
LocationCatalog — table location_catalog
| Field | Type |
|---|---|
id | string |
tenantId | string |
tenant | Tenant |
country | string |
state | string |
city | string |
isActive | boolean |
sortOrder | number |
createdAt | Date |
updatedAt | Date |
Repositories
Data-access classes wrapping the entities.
LocationRepository
listActiveByTenant · listByTenant · findByIdAndTenant · createForTenant · updateForTenant · deleteForTenant
Generated from the module’s source. Routes are relative to the engine root
(default http://localhost:3001). For full request/response schemas use the live
OpenAPI document.