@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
| Method | Path | Auth | Description |
|---|---|---|---|
GET | /automations | Yes | List automations |
GET | /automations/:id | Yes | Get automation |
POST | /automations | Yes | Create automation |
PATCH | /automations/:id/status | Yes | Set status |
DELETE | /automations/:id | Yes | Delete automation |
Internals
Use-cases
Application operations. Each is a single-purpose class with one execute() method.
| Use-case | Signature |
|---|---|
CreateAutomationUseCase | execute(tenantId: string, data: Omit<CreateAutomationData, 'tenantId'>): Promise<Automation> |
DeleteAutomationUseCase | execute(tenantId: string, id: string): Promise<void> |
GetAutomationUseCase | execute(tenantId: string, id: string): Promise<Automation> |
ListAutomationsUseCase | execute(tenantId: string): Promise<Automation[]> |
ToggleAutomationStatusUseCase | execute(tenantId: string, id: string, status: AutomationStatus): Promise<Automation> |
Entities
Sequelize models owned by this module.
Automation — table automations
| Field | Type |
|---|---|
id | string |
tenantId | string |
tenant | Tenant |
name | string |
trigger | AutomationTrigger |
status | AutomationStatus |
actions | AutomationAction[] |
enrolledCount | number |
completedCount | number |
revenueAttributed | number |
createdAt | Date |
updatedAt | Date |
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.