@withpotter/content — 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
Content /content
| Method | Path | Auth | Description |
|---|---|---|---|
GET | /content/:type | — | List content by type |
GET | /content/:type/:id | — | Get content by ID |
GET | /content/:type/:id/access | — | Check content access for a customer |
GET | /content/:type/:id/series | — | List event series occurrences |
GET | /content/:type/:id/stock | — | Check stock availability |
GET | /content/:type/slug/:slug | — | Get content by slug |
GET | /content/:type/stats | — | Get content statistics |
POST | /content/:type | Yes | Create content |
POST | /content/:type/:id/assign | Yes | Assign content to a customer |
POST | /content/:type/:id/assign-bulk | Yes | Bulk-assign content to all plan/tier subscribers |
POST | /content/:type/:id/series | Yes | Create event series from a parent event |
POST | /content/:type/bulk/delete | Yes | Bulk delete content |
POST | /content/:type/bulk/status | Yes | Bulk update content status |
POST | /content/:type/reorder | Yes | Reorder content items |
PUT | /content/:type/:id | Yes | Update content |
DELETE | /content/:type/:id | Yes | Delete content |
DELETE | /content/:type/:id/series/:childId | Yes | Delete a single series occurrence |
Internals
Use-cases
Application operations. Each is a single-purpose class with one execute() method.
| Use-case | Signature |
|---|---|
AssignContentUseCase | execute(tenantId: string, contentId: string, data: AssignContentData): Promise<ContentResponseDto> |
BulkAssignContentUseCase | execute(tenantId: string, data: BulkAssignContentData): Promise<BulkAssignResult> |
BulkDeleteContentUseCase | execute(tenantId: string, ids: string[]): Promise<number> |
BulkUpdateStatusUseCase | execute(tenantId: string, ids: string[], isActive: boolean): Promise<number> |
CheckContentAccessUseCase | execute(tenantId: string, contentId: string, customerId: string): Promise<{ canAccess: boolean; reason?: string }> |
CheckStockUseCase | execute(tenantId: string, id: string, quantity: number = 1): Promise<StockCheckDto> |
ConfirmPurchaseUseCase | execute(tenantId: string, id: string, quantity: number = 1): Promise<boolean> |
CreateContentUseCase | execute(tenantId: string, dto: CreateContentDto): Promise<ContentResponseDto> |
CreateEventSeriesUseCase | execute(tenantId: string, parentContentId: string, dto: CreateEventSeriesDto): Promise<CreateEventSeriesResult> |
DeleteContentUseCase | execute(tenantId: string, id: string): Promise<void> |
GetContentBySlugUseCase | execute(tenantId: string, type: string, slug: string): Promise<ContentResponseDto> |
GetContentStatsUseCase | execute(tenantId: string, type?: string): Promise<ContentStatsDto> |
GetContentUseCase | execute(tenantId: string, id: string): Promise<ContentResponseDto> |
ListContentUseCase | execute(tenantId: string, options: ListContentOptions): Promise<ContentListResponseDto> |
ListEventSeriesUseCase | execute(tenantId: string, contentId: string, options?: { upcomingOnly?: boolean }): Promise<EventSeriesDetail> |
ReleaseReservationUseCase | execute(tenantId: string, id: string, quantity: number = 1): Promise<void> |
ReorderContentUseCase | execute(tenantId: string, type: string, items: { id: string; sortOrder: number }[]): Promise<void> |
ReserveStockUseCase | execute(tenantId: string, id: string, quantity: number = 1): Promise<boolean> |
UpdateContentUseCase | execute(tenantId: string, id: string, dto: UpdateContentDto): Promise<ContentResponseDto> |
Entities
Sequelize models owned by this module.
Content — table content
| Field | Type |
|---|---|
id | string |
tenantId | string |
tenant | Tenant |
type | string |
slug | string |
title | string |
description | string | null |
shortDescription | string | null |
category | string | null |
tags | string[] |
featured | boolean |
isActive | boolean |
sortOrder | number |
image | ContentMedia | null |
gallery | ContentMedia[] |
price | number | null |
compareAtPrice | number | null |
currency | string |
trackInventory | boolean |
quantity | number |
reserved | number |
lowStockThreshold | number |
intent | string | null |
behaviors | ContentBehaviors |
hasVariants | boolean |
variants | ContentVariant[] |
assignedCustomerId | string | null |
seriesId | string | null |
data | Record<string, unknown> |
createdAt | Date |
updatedAt | Date |
publishedAt | Date | null |
Repositories
Data-access classes wrapping the entities.
ContentRepository
findByIdForUpdate · findByTenantAndSlug · findByTenantAndSlugCaseInsensitive · findByTenantAndType · findWithFilters · findFeatured · findSubscribableByPlanId · findAssignedByCustomer · updateInventory · reserveStock · releaseStock · deductStock · sumActivePrice · findLowStock · findSeriesOccurrences · findUpcomingSeriesOccurrences · bulkUpdateStatus · bulkUpdateCategory
Services
ContentGatingService
Ports
DI contracts other modules bind adapters to.
MediaCleanupPort— tokenMEDIA_CLEANUPActiveSubscriptionRef,SubscriberRef,SubscriptionLookupPort— tokenSUBSCRIPTION_LOOKUP
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.