Get Hedhog updates in your inbox
New releases, fresh recipes, and breaking changes — no spam.
cms Submodule
component-categories
Catalog of categories used to group components in the component picker (e.g. "Hero", "Content", "Media").
Source path: libraries/cms/src/cms-component-category.controller.ts, cms-component-category.service.ts
Module file: cms.module.ts
Introduction
The Component Categories submodule manages `cms_component_category`, the small grouping catalog that every `cms_component` points to via `category_id`. Each entry has a `slug`, an optional `icon` (a free string, presumably an icon identifier rendered by the admin component picker), an `order`, an `is_active` flag, and a locale-translated name/description in `cms_component_category_locale`. This is the shallowest submodule in the package: it exists purely to organize the component catalog for editors browsing it, and carries no additional business logic beyond the create/update locale-upsert pattern shared by Layouts and Components.
`cms_component.category_id` references this table with `onDelete: RESTRICT`, so — exactly as with Layouts — `CmsComponentCategoryService.delete()` performs no pre-check of its own; deleting a category that still has components assigned to it fails as a raw foreign-key constraint error rather than a descriptive application exception. `GET /cms/component-categories` is also a full, non-paginated listing, always sorted by `order`.
All write endpoints are restricted to `admin`/`admin-cms`, matching Layouts and Components: only administrators curate the catalog structure, while `cms-editor` and `cms-publisher` have read-only visibility into it.
HTTP Endpoints
5 endpoints
Full listing of component categories (not paginated), sorted by order, localized to the request's locale.
Create a new component category and its per-locale name/description rows.
Body
| Field | Type | Required | Notes |
|---|---|---|---|
| slug | string | yes | — |
| icon | string | no | — |
| order | number | no | Default: 0 |
| is_active | boolean | no | Default: true |
| locale | Record<string, { name: string; description?: string }> | yes | e.g. { "en": { "name": "...", "description": "..." } } — upserts one locale row per key |
Get a single component category, localized to the request's locale.
- Params
- id (int)
Update a component category (same fields as create, all optional).
- Params
- id (int)
Hard-delete a component category. Not guarded at the service level — fails with a database foreign-key error if any component still references it (cms_component.category_id is RESTRICT).
- Params
- id (int)