Documentation
¶
Overview ¶
Package cms provides a content management system plugin for AuthSome. It allows defining custom content types with configurable fields and managing content entries through the dashboard UI and REST API.
Index ¶
- Constants
- func ResolveComponentSchemaService(container forge.Container) (*service.ComponentSchemaService, error)
- func ResolveContentTypeService(container forge.Container) (*service.ContentTypeService, error)
- func ResolveEntryService(container forge.Container) (*service.ContentEntryService, error)
- func ResolveFieldService(container forge.Container) (*service.ContentFieldService, error)
- func ResolveRevisionService(container forge.Container) (*service.RevisionService, error)
- type APIConfig
- type Config
- type DashboardConfig
- type DashboardExtension
- func (e *DashboardExtension) DashboardWidgets() []ui.DashboardWidget
- func (e *DashboardExtension) ExtensionID() string
- func (e *DashboardExtension) HandleAddField(c forge.Context) error
- func (e *DashboardExtension) HandleCreateComponentSchema(c forge.Context) error
- func (e *DashboardExtension) HandleCreateContentType(c forge.Context) error
- func (e *DashboardExtension) HandleCreateEntry(c forge.Context) error
- func (e *DashboardExtension) HandleDeleteComponentSchema(c forge.Context) error
- func (e *DashboardExtension) HandleDeleteContentType(c forge.Context) error
- func (e *DashboardExtension) HandleDeleteEntry(c forge.Context) error
- func (e *DashboardExtension) HandleDeleteField(c forge.Context) error
- func (e *DashboardExtension) HandleUpdateComponentSchema(c forge.Context) error
- func (e *DashboardExtension) HandleUpdateDisplaySettings(c forge.Context) error
- func (e *DashboardExtension) HandleUpdateEntry(c forge.Context) error
- func (e *DashboardExtension) HandleUpdateFeatureSettings(c forge.Context) error
- func (e *DashboardExtension) HandleUpdateField(c forge.Context) error
- func (e *DashboardExtension) NavigationItems() []ui.NavigationItem
- func (e *DashboardExtension) Routes() []ui.Route
- func (e *DashboardExtension) ServeCMSOverview(c forge.Context) error
- func (e *DashboardExtension) ServeCMSSettings(c forge.Context) error
- func (e *DashboardExtension) ServeComponentSchemaDetail(c forge.Context) error
- func (e *DashboardExtension) ServeComponentSchemasList(c forge.Context) error
- func (e *DashboardExtension) ServeContentTypeDetail(c forge.Context) error
- func (e *DashboardExtension) ServeContentTypesList(c forge.Context) error
- func (e *DashboardExtension) ServeCreateComponentSchema(c forge.Context) error
- func (e *DashboardExtension) ServeCreateContentType(c forge.Context) error
- func (e *DashboardExtension) ServeCreateEntry(c forge.Context) error
- func (e *DashboardExtension) ServeEditEntry(c forge.Context) error
- func (e *DashboardExtension) ServeEntriesList(c forge.Context) error
- func (e *DashboardExtension) ServeEntryDetail(c forge.Context) error
- func (e *DashboardExtension) SetRegistry(registry *dashboard.ExtensionRegistry)
- func (e *DashboardExtension) SettingsPages() []ui.SettingsPage
- func (e *DashboardExtension) SettingsSections() []ui.SettingsSection
- type FeaturesConfig
- type LimitsConfig
- type Plugin
- func (p *Plugin) Config() *Config
- func (p *Plugin) DB() *bun.DB
- func (p *Plugin) DashboardExtension() ui.DashboardExtension
- func (p *Plugin) Dependencies() []string
- func (p *Plugin) Description() string
- func (p *Plugin) GetComponentSchemaService() *service.ComponentSchemaService
- func (p *Plugin) GetContentTypeService() *service.ContentTypeService
- func (p *Plugin) GetEntryService() *service.ContentEntryService
- func (p *Plugin) GetFieldService() *service.ContentFieldService
- func (p *Plugin) GetRevisionService() *service.RevisionService
- func (p *Plugin) GetServices() map[string]interface{}
- func (p *Plugin) ID() string
- func (p *Plugin) Init(auth core.Authsome) error
- func (p *Plugin) Logger() forge.Logger
- func (p *Plugin) Migrate() error
- func (p *Plugin) Name() string
- func (p *Plugin) Priority() int
- func (p *Plugin) RegisterHooks(hookRegistry *hooks.HookRegistry) error
- func (p *Plugin) RegisterRoles(roleRegistry rbac.RoleRegistryInterface) error
- func (p *Plugin) RegisterRoutes(router forge.Router) error
- func (p *Plugin) RegisterServiceDecorators(services *registry.ServiceRegistry) error
- func (p *Plugin) RegisterServices(container forge.Container) error
- func (p *Plugin) Version() string
- type PluginOption
- func WithDefaultConfig(cfg *Config) PluginOption
- func WithEnableDrafts(enabled bool) PluginOption
- func WithEnableRelations(enabled bool) PluginOption
- func WithEnableRevisions(enabled bool) PluginOption
- func WithEnableScheduling(enabled bool) PluginOption
- func WithEnableSearch(enabled bool) PluginOption
- func WithMaxContentTypes(max int) PluginOption
- func WithMaxFieldsPerType(max int) PluginOption
- func WithMaxRevisionsPerEntry(max int) PluginOption
- func WithPublicAPI(enabled bool) PluginOption
- type RevisionsConfig
- type SearchConfig
Constants ¶
const ( ServiceNamePlugin = "cms.plugin" ServiceNameContentTypeService = "cms.content_type_service" ServiceNameFieldService = "cms.field_service" ServiceNameEntryService = "cms.entry_service" ServiceNameRevisionService = "cms.revision_service" ServiceNameComponentSchemaService = "cms.component_schema_service" )
Service name constants for DI container registration
const ( // PluginID is the unique identifier for the CMS plugin PluginID = "cms" // PluginName is the human-readable name PluginName = "Content Management System" // PluginVersion is the current version PluginVersion = "1.0.0" // PluginDescription describes the plugin PluginDescription = "Headless CMS with custom content types, dynamic forms, and full query language support" )
Variables ¶
This section is empty.
Functions ¶
func ResolveComponentSchemaService ¶
func ResolveComponentSchemaService(container forge.Container) (*service.ComponentSchemaService, error)
ResolveComponentSchemaService resolves the component schema service from the container
func ResolveContentTypeService ¶
func ResolveContentTypeService(container forge.Container) (*service.ContentTypeService, error)
ResolveContentTypeService resolves the content type service from the container
func ResolveEntryService ¶
func ResolveEntryService(container forge.Container) (*service.ContentEntryService, error)
ResolveEntryService resolves the content entry service from the container
func ResolveFieldService ¶
func ResolveFieldService(container forge.Container) (*service.ContentFieldService, error)
ResolveFieldService resolves the content field service from the container
func ResolveRevisionService ¶
func ResolveRevisionService(container forge.Container) (*service.RevisionService, error)
ResolveRevisionService resolves the revision service from the container
Types ¶
type APIConfig ¶
type APIConfig struct {
// EnablePublicAPI allows unauthenticated read access to published content
// Default: false
EnablePublicAPI bool `json:"enablePublicAPI" yaml:"enablePublicAPI"`
// DefaultPageSize is the default page size for list endpoints
// Default: 20
DefaultPageSize int `json:"defaultPageSize" yaml:"defaultPageSize"`
// MaxPageSize is the maximum page size for list endpoints
// Default: 100
MaxPageSize int `json:"maxPageSize" yaml:"maxPageSize"`
// RateLimitPerMinute is the rate limit for API requests per minute
// 0 means no rate limiting
// Default: 0
RateLimitPerMinute int `json:"rateLimitPerMinute" yaml:"rateLimitPerMinute"`
// EnableGraphQL enables GraphQL API endpoint
// Default: false
EnableGraphQL bool `json:"enableGraphql" yaml:"enableGraphql"`
}
APIConfig holds API settings
type Config ¶
type Config struct {
// Features
Features FeaturesConfig `json:"features" yaml:"features"`
// Limits
Limits LimitsConfig `json:"limits" yaml:"limits"`
// Revisions
Revisions RevisionsConfig `json:"revisions" yaml:"revisions"`
// Search
Search SearchConfig `json:"search" yaml:"search"`
// API
API APIConfig `json:"api" yaml:"api"`
// Dashboard
Dashboard DashboardConfig `json:"dashboard" yaml:"dashboard"`
}
Config holds the CMS plugin configuration
type DashboardConfig ¶
type DashboardConfig struct {
// EnableFieldDragDrop enables drag and drop field reordering
// Default: true
EnableFieldDragDrop bool `json:"enableFieldDragDrop" yaml:"enableFieldDragDrop"`
// EnableBulkOperations enables bulk operations on entries
// Default: true
EnableBulkOperations bool `json:"enableBulkOperations" yaml:"enableBulkOperations"`
// EnableImportExport enables import/export functionality
// Default: false
EnableImportExport bool `json:"enableImportExport" yaml:"enableImportExport"`
// EntriesPerPage is the default number of entries per page in the dashboard
// Default: 25
EntriesPerPage int `json:"entriesPerPage" yaml:"entriesPerPage"`
// ShowRevisionHistory shows revision history in entry detail
// Default: true
ShowRevisionHistory bool `json:"showRevisionHistory" yaml:"showRevisionHistory"`
// ShowRelatedEntries shows related entries in entry detail
// Default: true
ShowRelatedEntries bool `json:"showRelatedEntries" yaml:"showRelatedEntries"`
}
DashboardConfig holds dashboard-specific settings
type DashboardExtension ¶
type DashboardExtension struct {
// contains filtered or unexported fields
}
DashboardExtension implements ui.DashboardExtension for the CMS plugin
func NewDashboardExtension ¶
func NewDashboardExtension(plugin *Plugin) *DashboardExtension
NewDashboardExtension creates a new dashboard extension
func (*DashboardExtension) DashboardWidgets ¶
func (e *DashboardExtension) DashboardWidgets() []ui.DashboardWidget
DashboardWidgets returns dashboard widgets
func (*DashboardExtension) ExtensionID ¶
func (e *DashboardExtension) ExtensionID() string
ExtensionID returns the unique identifier for this extension
func (*DashboardExtension) HandleAddField ¶
func (e *DashboardExtension) HandleAddField(c forge.Context) error
HandleAddField handles adding a new field to a content type
func (*DashboardExtension) HandleCreateComponentSchema ¶
func (e *DashboardExtension) HandleCreateComponentSchema(c forge.Context) error
func (*DashboardExtension) HandleCreateContentType ¶
func (e *DashboardExtension) HandleCreateContentType(c forge.Context) error
func (*DashboardExtension) HandleCreateEntry ¶
func (e *DashboardExtension) HandleCreateEntry(c forge.Context) error
func (*DashboardExtension) HandleDeleteComponentSchema ¶
func (e *DashboardExtension) HandleDeleteComponentSchema(c forge.Context) error
func (*DashboardExtension) HandleDeleteContentType ¶
func (e *DashboardExtension) HandleDeleteContentType(c forge.Context) error
HandleDeleteContentType handles deleting a content type
func (*DashboardExtension) HandleDeleteEntry ¶
func (e *DashboardExtension) HandleDeleteEntry(c forge.Context) error
HandleDeleteEntry handles deleting a content entry
func (*DashboardExtension) HandleDeleteField ¶
func (e *DashboardExtension) HandleDeleteField(c forge.Context) error
HandleDeleteField handles deleting a field from a content type
func (*DashboardExtension) HandleUpdateComponentSchema ¶
func (e *DashboardExtension) HandleUpdateComponentSchema(c forge.Context) error
func (*DashboardExtension) HandleUpdateDisplaySettings ¶ added in v0.0.6
func (e *DashboardExtension) HandleUpdateDisplaySettings(c forge.Context) error
HandleUpdateDisplaySettings handles updating content type display settings
func (*DashboardExtension) HandleUpdateEntry ¶
func (e *DashboardExtension) HandleUpdateEntry(c forge.Context) error
func (*DashboardExtension) HandleUpdateFeatureSettings ¶ added in v0.0.6
func (e *DashboardExtension) HandleUpdateFeatureSettings(c forge.Context) error
HandleUpdateFeatureSettings handles updating content type feature settings
func (*DashboardExtension) HandleUpdateField ¶
func (e *DashboardExtension) HandleUpdateField(c forge.Context) error
HandleUpdateField handles updating a field in a content type
func (*DashboardExtension) NavigationItems ¶
func (e *DashboardExtension) NavigationItems() []ui.NavigationItem
NavigationItems returns navigation items for the dashboard
func (*DashboardExtension) Routes ¶
func (e *DashboardExtension) Routes() []ui.Route
Routes returns dashboard routes
func (*DashboardExtension) ServeCMSOverview ¶
func (e *DashboardExtension) ServeCMSOverview(c forge.Context) error
func (*DashboardExtension) ServeCMSSettings ¶
func (e *DashboardExtension) ServeCMSSettings(c forge.Context) error
func (*DashboardExtension) ServeComponentSchemaDetail ¶
func (e *DashboardExtension) ServeComponentSchemaDetail(c forge.Context) error
func (*DashboardExtension) ServeComponentSchemasList ¶
func (e *DashboardExtension) ServeComponentSchemasList(c forge.Context) error
func (*DashboardExtension) ServeContentTypeDetail ¶
func (e *DashboardExtension) ServeContentTypeDetail(c forge.Context) error
func (*DashboardExtension) ServeContentTypesList ¶
func (e *DashboardExtension) ServeContentTypesList(c forge.Context) error
func (*DashboardExtension) ServeCreateComponentSchema ¶
func (e *DashboardExtension) ServeCreateComponentSchema(c forge.Context) error
func (*DashboardExtension) ServeCreateContentType ¶
func (e *DashboardExtension) ServeCreateContentType(c forge.Context) error
func (*DashboardExtension) ServeCreateEntry ¶
func (e *DashboardExtension) ServeCreateEntry(c forge.Context) error
func (*DashboardExtension) ServeEditEntry ¶
func (e *DashboardExtension) ServeEditEntry(c forge.Context) error
func (*DashboardExtension) ServeEntriesList ¶
func (e *DashboardExtension) ServeEntriesList(c forge.Context) error
func (*DashboardExtension) ServeEntryDetail ¶
func (e *DashboardExtension) ServeEntryDetail(c forge.Context) error
func (*DashboardExtension) SetRegistry ¶
func (e *DashboardExtension) SetRegistry(registry *dashboard.ExtensionRegistry)
SetRegistry sets the extension registry reference
func (*DashboardExtension) SettingsPages ¶
func (e *DashboardExtension) SettingsPages() []ui.SettingsPage
SettingsPages returns settings pages
func (*DashboardExtension) SettingsSections ¶
func (e *DashboardExtension) SettingsSections() []ui.SettingsSection
SettingsSections returns settings sections (deprecated)
type FeaturesConfig ¶
type FeaturesConfig struct {
// EnableRevisions enables content versioning
// Default: true
EnableRevisions bool `json:"enableRevisions" yaml:"enableRevisions"`
// EnableDrafts enables draft/publish workflow
// Default: true
EnableDrafts bool `json:"enableDrafts" yaml:"enableDrafts"`
// EnableScheduling enables scheduled publishing
// Default: true
EnableScheduling bool `json:"enableScheduling" yaml:"enableScheduling"`
// EnableSearch enables full-text search
// Default: false (requires PostgreSQL full-text search setup)
EnableSearch bool `json:"enableSearch" yaml:"enableSearch"`
// EnableRelations enables relations between content types
// Default: true
EnableRelations bool `json:"enableRelations" yaml:"enableRelations"`
// EnableLocalization enables content localization
// Default: false
EnableLocalization bool `json:"enableLocalization" yaml:"enableLocalization"`
// EnableSoftDelete enables soft delete for entries
// Default: true
EnableSoftDelete bool `json:"enableSoftDelete" yaml:"enableSoftDelete"`
}
FeaturesConfig holds feature toggles
type LimitsConfig ¶
type LimitsConfig struct {
// MaxContentTypes is the maximum number of content types per app/environment
// 0 means unlimited
// Default: 100
MaxContentTypes int `json:"maxContentTypes" yaml:"maxContentTypes"`
// MaxFieldsPerType is the maximum number of fields per content type
// Default: 50
MaxFieldsPerType int `json:"maxFieldsPerType" yaml:"maxFieldsPerType"`
// MaxEntriesPerType is the maximum number of entries per content type
// 0 means unlimited (can be overridden per content type)
// Default: 0
MaxEntriesPerType int `json:"maxEntriesPerType" yaml:"maxEntriesPerType"`
// MaxEntryDataSize is the maximum size of entry data in bytes
// Default: 1MB
MaxEntryDataSize int64 `json:"maxEntryDataSize" yaml:"maxEntryDataSize"`
// MaxRelationsPerEntry is the maximum number of relations per entry
// Default: 100
MaxRelationsPerEntry int `json:"maxRelationsPerEntry" yaml:"maxRelationsPerEntry"`
// MaxComponentSchemas is the maximum number of component schemas per app/environment
// 0 means unlimited
// Default: 100
MaxComponentSchemas int `json:"maxComponentSchemas" yaml:"maxComponentSchemas"`
}
LimitsConfig holds resource limits
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin implements the CMS plugin for AuthSome
func NewPlugin ¶
func NewPlugin(opts ...PluginOption) *Plugin
NewPlugin creates a new CMS plugin instance
func ResolveCMSPlugin ¶
ResolveCMSPlugin resolves the CMS plugin from the container
func (*Plugin) DashboardExtension ¶
func (p *Plugin) DashboardExtension() ui.DashboardExtension
DashboardExtension returns the dashboard extension for the plugin
func (*Plugin) Dependencies ¶
Dependencies returns the plugin dependencies
func (*Plugin) Description ¶
Description returns the plugin description
func (*Plugin) GetComponentSchemaService ¶
func (p *Plugin) GetComponentSchemaService() *service.ComponentSchemaService
GetComponentSchemaService returns the component schema service directly
func (*Plugin) GetContentTypeService ¶
func (p *Plugin) GetContentTypeService() *service.ContentTypeService
GetContentTypeService returns the content type service directly
func (*Plugin) GetEntryService ¶
func (p *Plugin) GetEntryService() *service.ContentEntryService
GetEntryService returns the content entry service directly
func (*Plugin) GetFieldService ¶
func (p *Plugin) GetFieldService() *service.ContentFieldService
GetFieldService returns the content field service directly
func (*Plugin) GetRevisionService ¶
func (p *Plugin) GetRevisionService() *service.RevisionService
GetRevisionService returns the revision service directly
func (*Plugin) GetServices ¶
GetServices returns a map of all available services for inspection
func (*Plugin) RegisterHooks ¶
func (p *Plugin) RegisterHooks(hookRegistry *hooks.HookRegistry) error
RegisterHooks registers the plugin's hooks
func (*Plugin) RegisterRoles ¶
func (p *Plugin) RegisterRoles(roleRegistry rbac.RoleRegistryInterface) error
RegisterRoles registers RBAC roles for the plugin
func (*Plugin) RegisterRoutes ¶
RegisterRoutes registers the plugin's HTTP routes
func (*Plugin) RegisterServiceDecorators ¶
func (p *Plugin) RegisterServiceDecorators(services *registry.ServiceRegistry) error
RegisterServiceDecorators allows the plugin to decorate core services
func (*Plugin) RegisterServices ¶
RegisterServices registers all CMS services in the DI container
type PluginOption ¶
type PluginOption func(*Plugin)
PluginOption is a functional option for configuring the plugin
func WithDefaultConfig ¶
func WithDefaultConfig(cfg *Config) PluginOption
WithDefaultConfig sets the default configuration
func WithEnableDrafts ¶
func WithEnableDrafts(enabled bool) PluginOption
WithEnableDrafts enables/disables draft workflow
func WithEnableRelations ¶
func WithEnableRelations(enabled bool) PluginOption
WithEnableRelations enables/disables content relations
func WithEnableRevisions ¶
func WithEnableRevisions(enabled bool) PluginOption
WithEnableRevisions enables/disables revision tracking
func WithEnableScheduling ¶
func WithEnableScheduling(enabled bool) PluginOption
WithEnableScheduling enables/disables scheduled publishing
func WithEnableSearch ¶
func WithEnableSearch(enabled bool) PluginOption
WithEnableSearch enables/disables full-text search
func WithMaxContentTypes ¶
func WithMaxContentTypes(max int) PluginOption
WithMaxContentTypes sets the maximum number of content types
func WithMaxFieldsPerType ¶
func WithMaxFieldsPerType(max int) PluginOption
WithMaxFieldsPerType sets the maximum fields per content type
func WithMaxRevisionsPerEntry ¶
func WithMaxRevisionsPerEntry(max int) PluginOption
WithMaxRevisionsPerEntry sets the maximum revisions per entry
func WithPublicAPI ¶
func WithPublicAPI(enabled bool) PluginOption
WithPublicAPI enables/disables public API access
type RevisionsConfig ¶
type RevisionsConfig struct {
// MaxRevisionsPerEntry is the maximum number of revisions to keep per entry
// When exceeded, oldest revisions are automatically deleted
// Default: 50
MaxRevisionsPerEntry int `json:"maxRevisionsPerEntry" yaml:"maxRevisionsPerEntry"`
// RetentionDays is how long to keep old revisions in days
// Revisions older than this are eligible for cleanup
// Default: 90
RetentionDays int `json:"retentionDays" yaml:"retentionDays"`
// AutoCleanup enables automatic cleanup of old revisions
// Default: true
AutoCleanup bool `json:"autoCleanup" yaml:"autoCleanup"`
// CleanupInterval is how often to run revision cleanup
// Default: 24 hours
CleanupInterval time.Duration `json:"cleanupInterval" yaml:"cleanupInterval"`
}
RevisionsConfig holds revision settings
type SearchConfig ¶
type SearchConfig struct {
// Language is the PostgreSQL text search configuration
// Default: "english"
Language string `json:"language" yaml:"language"`
// MinSearchLength is the minimum query length for search
// Default: 2
MinSearchLength int `json:"minSearchLength" yaml:"minSearchLength"`
// MaxSearchResults is the maximum number of search results
// Default: 100
MaxSearchResults int `json:"maxSearchResults" yaml:"maxSearchResults"`
// EnableHighlighting enables search result highlighting
// Default: true
EnableHighlighting bool `json:"enableHighlighting" yaml:"enableHighlighting"`
}
SearchConfig holds search settings
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package core provides core types and utilities for the CMS plugin.
|
Package core provides core types and utilities for the CMS plugin. |
|
Package handlers provides HTTP handlers for the CMS plugin.
|
Package handlers provides HTTP handlers for the CMS plugin. |
|
Package pages provides gomponent-based page templates for the CMS dashboard.
|
Package pages provides gomponent-based page templates for the CMS dashboard. |
|
Package query provides a query language parser and builder for the CMS plugin.
|
Package query provides a query language parser and builder for the CMS plugin. |
|
Package repository implements the data access layer for the CMS plugin.
|
Package repository implements the data access layer for the CMS plugin. |
|
Package schema defines the database schema for the CMS plugin.
|
Package schema defines the database schema for the CMS plugin. |
|
Package service implements the business logic layer for the CMS plugin.
|
Package service implements the business logic layer for the CMS plugin. |