template

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTemplateService

func NewTemplateService(
	templateRepo port.TemplateRepository,
	versionRepo port.TemplateVersionRepository,
	tagRepo port.TemplateTagRepository,
	processResolver port.ProcessResolver,
) templateuc.TemplateUseCase

NewTemplateService creates a new template service.

func NewTemplateVersionService

NewTemplateVersionService creates a new template version service.

Types

type TemplateService

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

TemplateService implements template business logic.

func (*TemplateService) AddTag

func (s *TemplateService) AddTag(ctx context.Context, templateID, tagID string) error

AddTag adds a tag to a template.

func (*TemplateService) AssignDocumentType

AssignDocumentType assigns or unassigns a document type to a template.

func (*TemplateService) CloneTemplate

CloneTemplate creates a copy of an existing template from a specific version.

func (*TemplateService) CreateTemplate

CreateTemplate creates a new template with an initial draft version.

func (*TemplateService) DeleteTemplate

func (s *TemplateService) DeleteTemplate(ctx context.Context, id string) error

DeleteTemplate deletes a template and all its versions.

func (*TemplateService) FindByDocumentTypeCode

func (s *TemplateService) FindByDocumentTypeCode(ctx context.Context, tenantID, code string) ([]*entity.TemplateListItem, error)

FindByDocumentTypeCode finds templates by document type code across a tenant.

func (*TemplateService) GetTemplate

func (s *TemplateService) GetTemplate(ctx context.Context, id string) (*entity.Template, error)

GetTemplate retrieves a template by ID.

func (*TemplateService) GetTemplateWithAllVersions

func (s *TemplateService) GetTemplateWithAllVersions(ctx context.Context, id string) (*entity.TemplateWithAllVersions, error)

GetTemplateWithAllVersions retrieves a template with all its versions.

func (*TemplateService) GetTemplateWithDetails

func (s *TemplateService) GetTemplateWithDetails(ctx context.Context, id string) (*entity.TemplateWithDetails, error)

GetTemplateWithDetails retrieves a template with published version, tags, and folder.

func (*TemplateService) ListPublicLibrary

func (s *TemplateService) ListPublicLibrary(ctx context.Context, workspaceID string) ([]*entity.TemplateListItem, error)

ListPublicLibrary lists all public library templates.

func (*TemplateService) ListTemplates

func (s *TemplateService) ListTemplates(ctx context.Context, workspaceID string, filters port.TemplateFilters) ([]*entity.TemplateListItem, error)

ListTemplates lists all templates in a workspace with optional filters.

func (*TemplateService) ListTemplatesByFolder

func (s *TemplateService) ListTemplatesByFolder(ctx context.Context, folderID string) ([]*entity.TemplateListItem, error)

ListTemplatesByFolder lists all templates in a folder.

func (*TemplateService) RemoveTag

func (s *TemplateService) RemoveTag(ctx context.Context, templateID, tagID string) error

RemoveTag removes a tag from a template.

func (*TemplateService) SetProcessFields

SetProcessFields sets the process and processType on a template.

func (*TemplateService) UpdateTemplate

UpdateTemplate updates a template's metadata. Supports partial updates - only non-nil fields are updated.

type TemplateVersionService

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

TemplateVersionService implements template version business logic.

func (*TemplateVersionService) AddInjectable

AddInjectable adds an injectable to a version.

func (*TemplateVersionService) ArchiveVersion

func (s *TemplateVersionService) ArchiveVersion(ctx context.Context, id string, userID string) error

ArchiveVersion manually archives a published version.

func (*TemplateVersionService) CancelSchedule

func (s *TemplateVersionService) CancelSchedule(ctx context.Context, versionID string) error

CancelSchedule cancels any scheduled publication or archival.

func (*TemplateVersionService) CreateVersion

CreateVersion creates a new version for a template.

func (*TemplateVersionService) CreateVersionFromExisting

func (s *TemplateVersionService) CreateVersionFromExisting(ctx context.Context, sourceVersionID string, name string, description *string, createdBy *string) (*entity.TemplateVersion, error)

CreateVersionFromExisting creates a new version copying content from an existing version.

func (*TemplateVersionService) DeleteVersion

func (s *TemplateVersionService) DeleteVersion(ctx context.Context, id string) error

DeleteVersion deletes a draft version.

func (*TemplateVersionService) GetPublishedVersion

func (s *TemplateVersionService) GetPublishedVersion(ctx context.Context, templateID string) (*entity.TemplateVersionWithDetails, error)

GetPublishedVersion gets the currently published version for a template.

func (*TemplateVersionService) GetVersion

GetVersion retrieves a template version by ID.

func (*TemplateVersionService) GetVersionWithDetails

func (s *TemplateVersionService) GetVersionWithDetails(ctx context.Context, id string) (*entity.TemplateVersionWithDetails, error)

GetVersionWithDetails retrieves a version with all related data.

func (*TemplateVersionService) ListVersions

func (s *TemplateVersionService) ListVersions(ctx context.Context, templateID string) ([]*entity.TemplateVersion, error)

ListVersions lists all versions for a template.

func (*TemplateVersionService) ProcessScheduledArchivals

func (s *TemplateVersionService) ProcessScheduledArchivals(ctx context.Context) error

ProcessScheduledArchivals archives all published versions whose scheduled archive time has passed.

func (*TemplateVersionService) ProcessScheduledPublications

func (s *TemplateVersionService) ProcessScheduledPublications(ctx context.Context) error

ProcessScheduledPublications publishes all versions whose scheduled time has passed.

func (*TemplateVersionService) PromoteVersion

PromoteVersion promotes a published version from sandbox to production.

func (*TemplateVersionService) PublishVersion

func (s *TemplateVersionService) PublishVersion(ctx context.Context, id string, userID string) error

PublishVersion publishes a version (archives current published if exists).

func (*TemplateVersionService) RemoveInjectable

func (s *TemplateVersionService) RemoveInjectable(ctx context.Context, id string) error

RemoveInjectable removes an injectable from a version.

func (*TemplateVersionService) ScheduleArchive

ScheduleArchive schedules the current published version for future archival.

func (*TemplateVersionService) SchedulePublish

SchedulePublish schedules a version for future publication.

func (*TemplateVersionService) UpdateVersion

UpdateVersion updates a template version.

func (*TemplateVersionService) UpdateVersionContent

func (s *TemplateVersionService) UpdateVersionContent(ctx context.Context, versionID string, content json.RawMessage) error

UpdateVersionContent updates the content of a DRAFT version after validating format and injectables.

Directories

Path Synopsis
Package contentvalidator provides content structure validation for template versions.
Package contentvalidator provides content structure validation for template versions.

Jump to

Keyboard shortcuts

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