Skip to main content

Content Link Collections

Overview

A Content Link is a single link that bundles multiple pieces of content. Instead of sending one link per page, an administrator creates a content link bound to a set of criteria — categories, tags, or a hand-picked list — and shares one URL. Opening it presents every piece of content matching those criteria.

Each link carries its own token, which can be reissued when the original should no longer work. A preview endpoint lets the author confirm exactly what the link will show before distributing it.

Business Flow

  1. GET /api/content-links lists all links with filtering per QueryContentLinkDto.
  2. POST /api/content-links creates a link, specifying which content it should gather. The system generates a random token using crypto/rand, hex-encoded.
  3. GET /api/content-links/:id/preview-contents with page and limit parameters returns a paginated preview of what the link will resolve to, before it goes out.
  4. GET /api/content-links/:id returns details and PATCH /api/content-links/:id updates the criteria.
  5. POST /api/content-links/:id/regenerate-token issues a new token, invalidating the previous link immediately.
  6. DELETE /api/content-links/:id removes a link, responding with 204.
  7. End users opening the link are served by the publicmod module's public endpoint, GET /api/public/contents, which is rate limited to 10 requests per 60 seconds.

Key Files & Functions

Core code lives in internal/modules/contentlink/, comprising controller.go, service.go, and dto.go, registered on the authed.Group("/content-links") group.

MethodRouteHandlerPolicy (metadata)
GET/api/content-linkssvc.findAllHandlerreadAll line-oa
GET/api/content-links/:idsvc.findOneHandlerread line-oa
GET/api/content-links/:id/preview-contentssvc.getPreviewContentsHandlerread line-oa
POST/api/content-linkssvc.createHandlercreate line-oa
POST/api/content-links/:id/regenerate-tokensvc.regenerateTokenHandlercreate line-oa
PATCH/api/content-links/:idsvc.updateHandlerupdate line-oa
DELETE/api/content-links/:idsvc.removeHandlerdelete line-oa

Internally the module defines a userContext struct, ported from ContentLinkService.getUserContext(), holding the userID, lineOaID, and organizationID read from CLS.

Connections to Other Services

  • Access control — requests must pass global JwtAuth. The policy metadata is PolicyModuleLineOa and is not yet enforced; there is no ModuleGate.
  • Tablescontent_link, content_page, content_category, content_subcategory, line_oa
  • Context — reads userId, lineOaId, and organizationId from CLS.
  • Related modules — Content Page, Content Category, Content Subcategory, Public API, and Menu Builder, another public-token mini-site format.