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

Pages /pages

MethodPathAuthDescription
GET/pagesYesList pages for the current tenant
GET/pages/:idYesGet page by ID
GET/pages/slug/:slugGet page by slug (public read)
POST/pagesYesCreate a new page
PUT/pages/:idYesUpdate a page
PATCH/pages/:id/publishYesPublish a page
PATCH/pages/:id/unpublishYesUnpublish a page (revert to draft)
DELETE/pages/:idYesDelete a page (hard-delete; system pages refused)

Internals

Use-cases

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

Use-caseSignature
CreatePageUseCaseexecute(tenantId: string, dto: CreatePageDto)
DeletePageUseCaseexecute(tenantId: string, id: string): Promise<void>
GetPageBySlugUseCaseexecute(tenantId: string, slug: string)
GetPageUseCaseexecute(tenantId: string, id: string)
ListPagesUseCaseexecute(tenantId: string, query: ListPagesQuery = {}): Promise<{ items: Page[]; total: number; page: number; limit: number }>
PublishPageUseCaseexecute(tenantId: string, id: string)
UnpublishPageUseCaseexecute(tenantId: string, id: string)
UpdatePageUseCaseexecute(tenantId: string, id: string, dto: UpdatePageDto)

Entities

Sequelize models owned by this module.

Page — table pages

FieldType
idstring
tenantIdstring
tenantTenant
slugstring
titlestring
statusPageStatus
publishedAtDate | null
seoPageSeo
draftSeoPageSeo | null
isSystemboolean
sectionsPageSection[]
idstring
pageIdstring
pagePage
tenantIdstring
tenantTenant
blockTypestring
positionnumber
statusPageSectionStatus
dataRecord<string, unknown>
draftDataRecord<string, unknown> | null

Repositories

Data-access classes wrapping the entities.

PageRepository

createForTenant · findByTenant · findByTenantOrFail · updateForTenant · deleteForTenant · findByTenantAndSlug · findAllByTenant · existsForTenant

PageSectionRepository

findByPage · updatePositions

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.