@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

MethodPathAuthDescription
GET/content/:typeList content by type
GET/content/:type/:idGet content by ID
GET/content/:type/:id/accessCheck content access for a customer
GET/content/:type/:id/seriesList event series occurrences
GET/content/:type/:id/stockCheck stock availability
GET/content/:type/slug/:slugGet content by slug
GET/content/:type/statsGet content statistics
POST/content/:typeYesCreate content
POST/content/:type/:id/assignYesAssign content to a customer
POST/content/:type/:id/assign-bulkYesBulk-assign content to all plan/tier subscribers
POST/content/:type/:id/seriesYesCreate event series from a parent event
POST/content/:type/bulk/deleteYesBulk delete content
POST/content/:type/bulk/statusYesBulk update content status
POST/content/:type/reorderYesReorder content items
PUT/content/:type/:idYesUpdate content
DELETE/content/:type/:idYesDelete content
DELETE/content/:type/:id/series/:childIdYesDelete a single series occurrence

Internals

Use-cases

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

Use-caseSignature
AssignContentUseCaseexecute(tenantId: string, contentId: string, data: AssignContentData): Promise<ContentResponseDto>
BulkAssignContentUseCaseexecute(tenantId: string, data: BulkAssignContentData): Promise<BulkAssignResult>
BulkDeleteContentUseCaseexecute(tenantId: string, ids: string[]): Promise<number>
BulkUpdateStatusUseCaseexecute(tenantId: string, ids: string[], isActive: boolean): Promise<number>
CheckContentAccessUseCaseexecute(tenantId: string, contentId: string, customerId: string): Promise<{ canAccess: boolean; reason?: string }>
CheckStockUseCaseexecute(tenantId: string, id: string, quantity: number = 1): Promise<StockCheckDto>
ConfirmPurchaseUseCaseexecute(tenantId: string, id: string, quantity: number = 1): Promise<boolean>
CreateContentUseCaseexecute(tenantId: string, dto: CreateContentDto): Promise<ContentResponseDto>
CreateEventSeriesUseCaseexecute(tenantId: string, parentContentId: string, dto: CreateEventSeriesDto): Promise<CreateEventSeriesResult>
DeleteContentUseCaseexecute(tenantId: string, id: string): Promise<void>
GetContentBySlugUseCaseexecute(tenantId: string, type: string, slug: string): Promise<ContentResponseDto>
GetContentStatsUseCaseexecute(tenantId: string, type?: string): Promise<ContentStatsDto>
GetContentUseCaseexecute(tenantId: string, id: string): Promise<ContentResponseDto>
ListContentUseCaseexecute(tenantId: string, options: ListContentOptions): Promise<ContentListResponseDto>
ListEventSeriesUseCaseexecute(tenantId: string, contentId: string, options?: { upcomingOnly?: boolean }): Promise<EventSeriesDetail>
ReleaseReservationUseCaseexecute(tenantId: string, id: string, quantity: number = 1): Promise<void>
ReorderContentUseCaseexecute(tenantId: string, type: string, items: { id: string; sortOrder: number }[]): Promise<void>
ReserveStockUseCaseexecute(tenantId: string, id: string, quantity: number = 1): Promise<boolean>
UpdateContentUseCaseexecute(tenantId: string, id: string, dto: UpdateContentDto): Promise<ContentResponseDto>

Entities

Sequelize models owned by this module.

Content — table content

FieldType
idstring
tenantIdstring
tenantTenant
typestring
slugstring
titlestring
descriptionstring | null
shortDescriptionstring | null
categorystring | null
tagsstring[]
featuredboolean
isActiveboolean
sortOrdernumber
imageContentMedia | null
galleryContentMedia[]
pricenumber | null
compareAtPricenumber | null
currencystring
trackInventoryboolean
quantitynumber
reservednumber
lowStockThresholdnumber
intentstring | null
behaviorsContentBehaviors
hasVariantsboolean
variantsContentVariant[]
assignedCustomerIdstring | null
seriesIdstring | null
dataRecord<string, unknown>
createdAtDate
updatedAtDate
publishedAtDate | 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 — token MEDIA_CLEANUP
  • ActiveSubscriptionRef, SubscriberRef, SubscriptionLookupPort — token SUBSCRIPTION_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.