@withpotter/shipping — 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
Shipping /shipping
| Method | Path | Auth | Description |
|---|---|---|---|
GET | /shipping/zones | Yes | Handle list zones |
GET | /shipping/zones/:id | Yes | Handle get zone |
POST | /shipping/calculate | — | Calculate |
POST | /shipping/zones | Yes | Handle create zone |
POST | /shipping/zones/:zoneId/rates | Yes | Handle create rate |
PATCH | /shipping/zones/:id | Yes | Handle update zone |
PATCH | /shipping/zones/:zoneId/rates/:rateId | Yes | Handle update rate |
DELETE | /shipping/zones/:id | Yes | Handle delete zone |
DELETE | /shipping/zones/:zoneId/rates/:rateId | Yes | Handle delete rate |
Internals
Use-cases
Application operations. Each is a single-purpose class with one execute() method.
| Use-case | Signature |
|---|---|
CalculateShippingUseCase | execute(tenantId: string, dto: CalculateShippingDto): Promise<CalculatedShippingOptionDto[]> |
CreateShippingRateUseCase | execute(tenantId: string, zoneId: string, dto: CreateShippingRateDto): Promise<ShippingRateResponseDto> |
CreateShippingZoneUseCase | execute(tenantId: string, dto: CreateShippingZoneDto): Promise<ShippingZoneResponseDto> |
DeleteShippingRateUseCase | execute(tenantId: string, zoneId: string, rateId: string): Promise<void> |
DeleteShippingZoneUseCase | execute(tenantId: string, zoneId: string): Promise<void> |
GetShippingZoneUseCase | execute(tenantId: string, zoneId: string): Promise<ShippingZoneResponseDto> |
ListShippingZonesUseCase | execute(tenantId: string): Promise<ShippingZoneResponseDto[]> |
ResolveShippingRateUseCase | execute(tenantId: string, rateId: string, subtotal: number): Promise<{ price: number; rateName: string; zoneName: string } | null> |
UpdateShippingRateUseCase | execute(tenantId: string, zoneId: string, rateId: string, dto: UpdateShippingRateDto): Promise<ShippingRateResponseDto> |
UpdateShippingZoneUseCase | execute(tenantId: string, zoneId: string, dto: UpdateShippingZoneDto): Promise<ShippingZoneResponseDto> |
Entities
Sequelize models owned by this module.
ShippingRate — table shipping_rates
| Field | Type |
|---|---|
id | string |
shippingZoneId | string |
zone | ShippingZone |
name | string |
description | string | null |
rateType | ShippingRateType |
price | number |
estimatedDays | string | null |
conditions | RateConditions | null |
sortOrder | number |
isActive | boolean |
createdAt | Date |
updatedAt | Date |
ShippingZone — table shipping_zones
| Field | Type |
|---|---|
id | string |
tenantId | string |
tenant | Tenant |
name | string |
description | string | null |
regions | ZoneRegion |
status | ShippingZoneStatus |
sortOrder | number |
freeShippingThreshold | number | null |
rates | ShippingRate[] |
createdAt | Date |
updatedAt | Date |
ShippingZone — table shipping_zones
| Field | Type |
|---|---|
id | string |
tenantId | string |
tenant | Tenant |
name | string |
description | string | null |
regions | ZoneRegion |
status | ShippingZoneStatus |
sortOrder | number |
freeShippingThreshold | number | null |
rates | ShippingRate[] |
createdAt | Date |
updatedAt | Date |
id | string |
shippingZoneId | string |
zone | ShippingZone |
name | string |
description | string | null |
rateType | ShippingRateType |
price | number |
estimatedDays | string | null |
conditions | RateConditions | null |
sortOrder | number |
isActive | boolean |
createdAt | Date |
updatedAt | Date |
Repositories
Data-access classes wrapping the entities.
ShippingRepository
findZonesByTenant · findActiveZonesByTenant · findZoneById · createZone · updateZone · deleteZone · findRateById · createRate · updateRate · deleteRate · findMatchingZones
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.