@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
| Method | Path | Auth | Description |
|---|---|---|---|
GET | /pages | Yes | List pages for the current tenant |
GET | /pages/:id | Yes | Get page by ID |
GET | /pages/slug/:slug | — | Get page by slug (public read) |
POST | /pages | Yes | Create a new page |
PUT | /pages/:id | Yes | Update a page |
PATCH | /pages/:id/publish | Yes | Publish a page |
PATCH | /pages/:id/unpublish | Yes | Unpublish a page (revert to draft) |
DELETE | /pages/:id | Yes | Delete a page (hard-delete; system pages refused) |
Internals
Use-cases
Application operations. Each is a single-purpose class with one execute() method.
| Use-case | Signature |
|---|---|
CreatePageUseCase | execute(tenantId: string, dto: CreatePageDto) |
DeletePageUseCase | execute(tenantId: string, id: string): Promise<void> |
GetPageBySlugUseCase | execute(tenantId: string, slug: string) |
GetPageUseCase | execute(tenantId: string, id: string) |
ListPagesUseCase | execute(tenantId: string, query: ListPagesQuery = {}): Promise<{ items: Page[]; total: number; page: number; limit: number }> |
PublishPageUseCase | execute(tenantId: string, id: string) |
UnpublishPageUseCase | execute(tenantId: string, id: string) |
UpdatePageUseCase | execute(tenantId: string, id: string, dto: UpdatePageDto) |
Entities
Sequelize models owned by this module.
Page — table pages
| Field | Type |
|---|---|
id | string |
tenantId | string |
tenant | Tenant |
slug | string |
title | string |
status | PageStatus |
publishedAt | Date | null |
seo | PageSeo |
draftSeo | PageSeo | null |
isSystem | boolean |
sections | PageSection[] |
id | string |
pageId | string |
page | Page |
tenantId | string |
tenant | Tenant |
blockType | string |
position | number |
status | PageSectionStatus |
data | Record<string, unknown> |
draftData | Record<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.