@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 /

MethodPathAuthDescription
GET/locationsYesList
GET/locations/hierarchyYesTenant hierarchy
GET/public/locations/hierarchyHierarchy
POST/locationsYesCreate
POST/locations/bulkYesBulk create
PATCH/locations/:idYesUpdate
DELETE/locations/:idYesDelete

Internals

Use-cases

Application operations. Each is a single-purpose class with one execute() method.

Use-caseSignature
BulkCreateLocationsUseCaseexecute(tenantId: string, dto: BulkCreateLocationDto)
CreateLocationUseCaseexecute(tenantId: string, dto: CreateLocationDto)
DeleteLocationUseCaseexecute(tenantId: string, id: string)
GetLocationHierarchyUseCaseexecute(tenantId: string): Promise<CountryWithStates[]>
ListLocationsUseCaseexecute(tenantId: string)
UpdateLocationUseCaseexecute(tenantId: string, id: string, dto: UpdateLocationDto)

Entities

Sequelize models owned by this module.

LocationCatalog — table location_catalog

FieldType
idstring
tenantIdstring
tenantTenant
countrystring
statestring
citystring
isActiveboolean
sortOrdernumber
createdAtDate
updatedAtDate

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.