contentcmd

package
v0.60.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FeatureGates

type FeatureGates struct {
	// VersioningEnabled should return true when the content versioning workflows are enabled.
	VersioningEnabled func() bool
	// SchedulingEnabled should return true when content scheduling features are enabled.
	SchedulingEnabled func() bool
}

FeatureGates exposes runtime feature toggles required by content command handlers. Callers can supply closures that read from cms.Config to keep the handlers decoupled from configuration packages while still honouring feature flags.

type PublishContentCommand

type PublishContentCommand struct {
	ContentID   uuid.UUID  `json:"content_id"`
	Version     int        `json:"version"`
	PublishedBy *uuid.UUID `json:"published_by,omitempty"`
	PublishedAt *time.Time `json:"published_at,omitempty"`
}

PublishContentCommand requests publication of a specific content draft version.

func (PublishContentCommand) Type

Type implements command.Message.

func (PublishContentCommand) Validate

func (m PublishContentCommand) Validate() error

Validate ensures the message carries the required fields before reaching handlers.

type PublishContentHandler

type PublishContentHandler struct {
	// contains filtered or unexported fields
}

PublishContentHandler publishes drafts via the content service.

func NewPublishContentHandler

func NewPublishContentHandler(service content.Service, logger interfaces.Logger, gates FeatureGates, opts ...PublishContentOption) *PublishContentHandler

NewPublishContentHandler constructs a handler wired to the provided content service.

func (*PublishContentHandler) Execute

Execute satisfies command.Commander[PublishContentCommand].Execute.

type PublishContentOption added in v0.3.0

type PublishContentOption func(*PublishContentHandler)

PublishContentOption customises the publish handler.

func PublishContentWithTimeout added in v0.3.0

func PublishContentWithTimeout(timeout time.Duration) PublishContentOption

PublishContentWithTimeout overrides the default execution timeout.

type RestoreContentOption added in v0.3.0

type RestoreContentOption func(*RestoreContentVersionHandler)

RestoreContentOption customises the restore handler.

func RestoreContentWithTimeout added in v0.3.0

func RestoreContentWithTimeout(timeout time.Duration) RestoreContentOption

RestoreContentWithTimeout overrides the default execution timeout.

type RestoreContentVersionCommand

type RestoreContentVersionCommand struct {
	ContentID  uuid.UUID `json:"content_id"`
	Version    int       `json:"version"`
	RestoredBy uuid.UUID `json:"restored_by"`
}

RestoreContentVersionCommand requests that a historical version be restored as a draft.

func (RestoreContentVersionCommand) Type

Type implements command.Message.

func (RestoreContentVersionCommand) Validate

func (m RestoreContentVersionCommand) Validate() error

Validate ensures the command carries the required identifiers.

type RestoreContentVersionHandler

type RestoreContentVersionHandler struct {
	// contains filtered or unexported fields
}

RestoreContentVersionHandler restores historical content versions via the content service.

func NewRestoreContentVersionHandler

func NewRestoreContentVersionHandler(service content.Service, logger interfaces.Logger, gates FeatureGates, opts ...RestoreContentOption) *RestoreContentVersionHandler

NewRestoreContentVersionHandler constructs a handler wired to the provided content service.

func (*RestoreContentVersionHandler) Execute

Execute satisfies command.Commander[RestoreContentVersionCommand].

type ScheduleContentCommand

type ScheduleContentCommand struct {
	ContentID   uuid.UUID  `json:"content_id"`
	PublishAt   *time.Time `json:"publish_at,omitempty"`
	UnpublishAt *time.Time `json:"unpublish_at,omitempty"`
	ScheduledBy uuid.UUID  `json:"scheduled_by,omitempty"`
}

ScheduleContentCommand updates publish/unpublish windows for a content entry.

func (ScheduleContentCommand) Type

Type implements command.Message.

func (ScheduleContentCommand) Validate

func (m ScheduleContentCommand) Validate() error

Validate ensures required fields and basic payload consistency.

type ScheduleContentHandler

type ScheduleContentHandler struct {
	// contains filtered or unexported fields
}

ScheduleContentHandler coordinates scheduling changes via the content service.

func NewScheduleContentHandler

func NewScheduleContentHandler(service content.Service, logger interfaces.Logger, gates FeatureGates, opts ...ScheduleContentOption) *ScheduleContentHandler

NewScheduleContentHandler constructs a handler wired to the provided content service.

func (*ScheduleContentHandler) Execute

Execute satisfies command.Commander[ScheduleContentCommand].

type ScheduleContentOption added in v0.3.0

type ScheduleContentOption func(*ScheduleContentHandler)

ScheduleContentOption customises the schedule handler.

func ScheduleContentWithTimeout added in v0.3.0

func ScheduleContentWithTimeout(timeout time.Duration) ScheduleContentOption

ScheduleContentWithTimeout overrides the default execution timeout.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址