Documentation
¶
Overview ¶
Package posttypesbasic is the official post + page content-type module.
It hosts the post-type registry (adopted from the composition root, which builds it from config), declares the post and page definitions to the kernel discovery index, and serves the post-type HTTP surface. It carries no database tables and no migrations: the registry is in-memory.
The /roles and /user_fields endpoints are served here only until the users module lands, which takes them over unchanged.
Index ¶
- Constants
- type Module
- func (m *Module) AdminManifest() kernel.AdminExtensionManifest
- func (m *Module) Init(_ kernel.Kernel) error
- func (m *Module) Name() string
- func (m *Module) Optional() []string
- func (m *Module) PostTypes() []kernel.PostTypeDef
- func (m *Module) RegisterPublicRoutes(router chi.Router)
- func (m *Module) RegisterRoutes(router chi.Router)
- func (m *Module) Requires() []string
- func (m *Module) Service() *posttype.Service
- func (m *Module) Shutdown() error
- func (m *Module) Version() string
- type Option
Constants ¶
const ( // Name is the registry key for this module. Name = "posttypes-basic" // Version is the module version reported via Module.Version. Version = "0.1.0" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module is the posttypes-basic kernel module.
func New ¶
New builds the module, adopting the composition root's wiring. The handler is built once here so routes serve the same instance the provider reads.
func (*Module) AdminManifest ¶
func (m *Module) AdminManifest() kernel.AdminExtensionManifest
AdminManifest declares this module's admin-shell extensions. Post types surface in the admin UI data-driven (content tabs and the editor dropdown read the post-types API), so the module declares no menu entries, settings sections, or editor extensions.
func (*Module) Init ¶
Init wires the module. The handler is already built by New; Init only validates the adopted service is present.
func (*Module) Optional ¶
Optional lists soft dependencies. None: role scoping degrades to allow-all without a resolver by design.
func (*Module) PostTypes ¶
func (m *Module) PostTypes() []kernel.PostTypeDef
PostTypes declares this module's content types to the kernel discovery index: post and page as protected, plus every custom type in the adopted registry unprotected. The media/comment placeholders stay out (see deferredSlugs).
func (*Module) RegisterPublicRoutes ¶
RegisterPublicRoutes mounts the anonymous post-type surface. Core passes the public router (no auth chain).
func (*Module) RegisterRoutes ¶
RegisterRoutes mounts the authenticated post-type surface. Core passes the protected router (auth pre-chained).
func (*Module) Requires ¶
Requires lists hard dependencies. This module has none: it serves every authenticated caller when no resolver is attached.
func (*Module) Service ¶
Service exposes the adopted registry for composition-root wiring (content adapter, importers, templates, role loading). It stays valid for the module's lifetime.
type Option ¶
type Option func(*Module)
Option configures a Module. The composition root supplies every option; direct construction without options yields a standalone module with the default registry.
func WithCapabilityResolver ¶
func WithCapabilityResolver(resolve kernel.CapabilityResolver) Option
WithCapabilityResolver attaches the authorizer for role-scoped surfaces. Without one every authenticated caller sees everything (legacy behavior).
func WithCommentsEnabled ¶
WithCommentsEnabled toggles the "comment" sentinel in list surfaces, mirroring the [comments] config block.
func WithRegistrationEnabled ¶
WithRegistrationEnabled adopts the registration gate consulted for the Commentator role in GetRoles. When unset it defaults to the comments flag, preserving the legacy coupling.
func WithRoles ¶
func WithRoles(roles api.RoleCapabilities) Option
WithRoles attaches the role registry for the roles endpoint. Without one the endpoint answers 404 roles_unavailable (fail closed).
func WithService ¶
WithService adopts a config-built registry (composition root). Without it the module seeds its own default registry.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package admin owns this module's admin-shell manifest: the declarative UI the single admin SPA renders for post types.
|
Package admin owns this module's admin-shell manifest: the declarative UI the single admin SPA renders for post types. |
|
Package testutil provides the kernel fixture module tests run against: an in-memory post-type registry with no external dependencies.
|
Package testutil provides the kernel fixture module tests run against: an in-memory post-type registry with no external dependencies. |