@withpotter/template — 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
TemplateController /templates
| Method | Path | Auth | Description |
|---|---|---|---|
GET | /templates | — | Find all |
GET | /templates/:id | — | Find by id |
GET | /templates/:id/content-types/:contentType | — | Get content type |
POST | /templates | Yes | Create |
POST | /templates/sync | Yes | Sync |
PUT | /templates/:id | Yes | Update |
DELETE | /templates/:id | Yes | Delete |
Internals
Use-cases
Application operations. Each is a single-purpose class with one execute() method.
| Use-case | Signature |
|---|---|
CreateTemplateUseCase | execute(dto: CreateTemplateDto) |
DeleteTemplateUseCase | execute(id: string): Promise<void> |
GetContentTypeUseCase | execute(templateId: string, contentTypeKey: string): Promise<ContentTypeConfig> |
GetTemplateUseCase | execute(id: string) |
ListTemplatesUseCase | execute(category?: TemplateCategory) |
SyncTemplatesUseCase | execute() |
UpdateTemplateUseCase | execute(id: string, dto: UpdateTemplateDto) |
Entities
Sequelize models owned by this module.
Template — table templates
| Field | Type |
|---|---|
id | string |
name | string |
description | string |
category | TemplateCategory |
icon | string |
previewImage | string |
contentTypes | Record<string, ContentTypeConfig> |
dashboardModules | DashboardModule[] |
behaviors | ContentBehavior[] |
defaultSettings | TemplateDefaultSettings |
isActive | boolean |
sortOrder | number |
createdAt | Date |
updatedAt | Date |
Repositories
Data-access classes wrapping the entities.
TemplateRepository
findByCategory · findAllActive · getContentType · upsert · findByIdOrFail
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.