@withpotter/automation — 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

AutomationController /automations

MethodPathAuthDescription
GET/automationsYesList automations
GET/automations/:idYesGet automation
POST/automationsYesCreate automation
PATCH/automations/:id/statusYesSet status
DELETE/automations/:idYesDelete automation

Internals

Use-cases

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

Use-caseSignature
CreateAutomationUseCaseexecute(tenantId: string, data: Omit<CreateAutomationData, 'tenantId'>): Promise<Automation>
DeleteAutomationUseCaseexecute(tenantId: string, id: string): Promise<void>
GetAutomationUseCaseexecute(tenantId: string, id: string): Promise<Automation>
ListAutomationsUseCaseexecute(tenantId: string): Promise<Automation[]>
ToggleAutomationStatusUseCaseexecute(tenantId: string, id: string, status: AutomationStatus): Promise<Automation>

Entities

Sequelize models owned by this module.

Automation — table automations

FieldType
idstring
tenantIdstring
tenantTenant
namestring
triggerAutomationTrigger
statusAutomationStatus
actionsAutomationAction[]
enrolledCountnumber
completedCountnumber
revenueAttributednumber
createdAtDate
updatedAtDate

Repositories

Data-access classes wrapping the entities.

AutomationRepository

create · findAll · findById · setStatus · delete

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.