@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

MethodPathAuthDescription
GET/templatesFind all
GET/templates/:idFind by id
GET/templates/:id/content-types/:contentTypeGet content type
POST/templatesYesCreate
POST/templates/syncYesSync
PUT/templates/:idYesUpdate
DELETE/templates/:idYesDelete

Internals

Use-cases

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

Use-caseSignature
CreateTemplateUseCaseexecute(dto: CreateTemplateDto)
DeleteTemplateUseCaseexecute(id: string): Promise<void>
GetContentTypeUseCaseexecute(templateId: string, contentTypeKey: string): Promise<ContentTypeConfig>
GetTemplateUseCaseexecute(id: string)
ListTemplatesUseCaseexecute(category?: TemplateCategory)
SyncTemplatesUseCaseexecute()
UpdateTemplateUseCaseexecute(id: string, dto: UpdateTemplateDto)

Entities

Sequelize models owned by this module.

Template — table templates

FieldType
idstring
namestring
descriptionstring
categoryTemplateCategory
iconstring
previewImagestring
contentTypesRecord<string, ContentTypeConfig>
dashboardModulesDashboardModule[]
behaviorsContentBehavior[]
defaultSettingsTemplateDefaultSettings
isActiveboolean
sortOrdernumber
createdAtDate
updatedAtDate

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.