Documentation
¶
Index ¶
- func NewTemplateService(templateRepo port.TemplateRepository, ...) templateuc.TemplateUseCase
- func NewTemplateVersionService(versionRepo port.TemplateVersionRepository, ...) templateuc.TemplateVersionUseCase
- type TemplateService
- func (s *TemplateService) AddTag(ctx context.Context, templateID, tagID string) error
- func (s *TemplateService) AssignDocumentType(ctx context.Context, cmd templateuc.AssignDocumentTypeCommand) (*templateuc.AssignDocumentTypeResult, error)
- func (s *TemplateService) CloneTemplate(ctx context.Context, cmd templateuc.CloneTemplateCommand) (*entity.Template, *entity.TemplateVersion, error)
- func (s *TemplateService) CreateTemplate(ctx context.Context, cmd templateuc.CreateTemplateCommand) (*entity.Template, *entity.TemplateVersion, error)
- func (s *TemplateService) DeleteTemplate(ctx context.Context, id string) error
- func (s *TemplateService) FindByDocumentTypeCode(ctx context.Context, tenantID, code string) ([]*entity.TemplateListItem, error)
- func (s *TemplateService) GetTemplate(ctx context.Context, id string) (*entity.Template, error)
- func (s *TemplateService) GetTemplateWithAllVersions(ctx context.Context, id string) (*entity.TemplateWithAllVersions, error)
- func (s *TemplateService) GetTemplateWithDetails(ctx context.Context, id string) (*entity.TemplateWithDetails, error)
- func (s *TemplateService) ListPublicLibrary(ctx context.Context, workspaceID string) ([]*entity.TemplateListItem, error)
- func (s *TemplateService) ListTemplates(ctx context.Context, workspaceID string, filters port.TemplateFilters) ([]*entity.TemplateListItem, error)
- func (s *TemplateService) ListTemplatesByFolder(ctx context.Context, folderID string) ([]*entity.TemplateListItem, error)
- func (s *TemplateService) RemoveTag(ctx context.Context, templateID, tagID string) error
- func (s *TemplateService) SetProcessFields(ctx context.Context, cmd templateuc.SetProcessFieldsCommand) (*entity.Template, error)
- func (s *TemplateService) UpdateTemplate(ctx context.Context, cmd templateuc.UpdateTemplateCommand) (*entity.Template, error)
- type TemplateVersionService
- func (s *TemplateVersionService) AddInjectable(ctx context.Context, cmd templateuc.AddVersionInjectableCommand) (*entity.TemplateVersionInjectable, error)
- func (s *TemplateVersionService) ArchiveVersion(ctx context.Context, id string, userID string) error
- func (s *TemplateVersionService) CancelSchedule(ctx context.Context, versionID string) error
- func (s *TemplateVersionService) CreateVersion(ctx context.Context, cmd templateuc.CreateVersionCommand) (*entity.TemplateVersion, error)
- func (s *TemplateVersionService) CreateVersionFromExisting(ctx context.Context, sourceVersionID string, name string, description *string, ...) (*entity.TemplateVersion, error)
- func (s *TemplateVersionService) DeleteVersion(ctx context.Context, id string) error
- func (s *TemplateVersionService) GetPublishedVersion(ctx context.Context, templateID string) (*entity.TemplateVersionWithDetails, error)
- func (s *TemplateVersionService) GetVersion(ctx context.Context, id string) (*entity.TemplateVersion, error)
- func (s *TemplateVersionService) GetVersionWithDetails(ctx context.Context, id string) (*entity.TemplateVersionWithDetails, error)
- func (s *TemplateVersionService) ListVersions(ctx context.Context, templateID string) ([]*entity.TemplateVersion, error)
- func (s *TemplateVersionService) ProcessScheduledArchivals(ctx context.Context) error
- func (s *TemplateVersionService) ProcessScheduledPublications(ctx context.Context) error
- func (s *TemplateVersionService) PromoteVersion(ctx context.Context, cmd templateuc.PromoteVersionCommand) (*templateuc.PromoteVersionResult, error)
- func (s *TemplateVersionService) PublishVersion(ctx context.Context, id string, userID string) error
- func (s *TemplateVersionService) RemoveInjectable(ctx context.Context, id string) error
- func (s *TemplateVersionService) ScheduleArchive(ctx context.Context, cmd templateuc.ScheduleArchiveCommand) error
- func (s *TemplateVersionService) SchedulePublish(ctx context.Context, cmd templateuc.SchedulePublishCommand) error
- func (s *TemplateVersionService) UpdateVersion(ctx context.Context, cmd templateuc.UpdateVersionCommand) (*entity.TemplateVersion, error)
- func (s *TemplateVersionService) UpdateVersionContent(ctx context.Context, versionID string, content json.RawMessage) error
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 ¶
func NewTemplateVersionService( versionRepo port.TemplateVersionRepository, injectableRepo port.TemplateVersionInjectableRepository, signerRoleRepo port.TemplateVersionSignerRoleRepository, templateRepo port.TemplateRepository, tagRepo port.TemplateTagRepository, contentValidator port.ContentValidator, workspaceRepo port.WorkspaceRepository, ) templateuc.TemplateVersionUseCase
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 ¶
func (s *TemplateService) AssignDocumentType(ctx context.Context, cmd templateuc.AssignDocumentTypeCommand) (*templateuc.AssignDocumentTypeResult, error)
AssignDocumentType assigns or unassigns a document type to a template.
func (*TemplateService) CloneTemplate ¶
func (s *TemplateService) CloneTemplate(ctx context.Context, cmd templateuc.CloneTemplateCommand) (*entity.Template, *entity.TemplateVersion, error)
CloneTemplate creates a copy of an existing template from a specific version.
func (*TemplateService) CreateTemplate ¶
func (s *TemplateService) CreateTemplate(ctx context.Context, cmd templateuc.CreateTemplateCommand) (*entity.Template, *entity.TemplateVersion, error)
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 ¶
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 ¶
func (s *TemplateService) SetProcessFields(ctx context.Context, cmd templateuc.SetProcessFieldsCommand) (*entity.Template, error)
SetProcessFields sets the process and processType on a template.
func (*TemplateService) UpdateTemplate ¶
func (s *TemplateService) UpdateTemplate(ctx context.Context, cmd templateuc.UpdateTemplateCommand) (*entity.Template, error)
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 ¶
func (s *TemplateVersionService) AddInjectable(ctx context.Context, cmd templateuc.AddVersionInjectableCommand) (*entity.TemplateVersionInjectable, error)
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 ¶
func (s *TemplateVersionService) CreateVersion(ctx context.Context, cmd templateuc.CreateVersionCommand) (*entity.TemplateVersion, error)
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 ¶
func (s *TemplateVersionService) GetVersion(ctx context.Context, id string) (*entity.TemplateVersion, error)
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 ¶
func (s *TemplateVersionService) PromoteVersion(ctx context.Context, cmd templateuc.PromoteVersionCommand) (*templateuc.PromoteVersionResult, error)
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 ¶
func (s *TemplateVersionService) ScheduleArchive(ctx context.Context, cmd templateuc.ScheduleArchiveCommand) error
ScheduleArchive schedules the current published version for future archival.
func (*TemplateVersionService) SchedulePublish ¶
func (s *TemplateVersionService) SchedulePublish(ctx context.Context, cmd templateuc.SchedulePublishCommand) error
SchedulePublish schedules a version for future publication.
func (*TemplateVersionService) UpdateVersion ¶
func (s *TemplateVersionService) UpdateVersion(ctx context.Context, cmd templateuc.UpdateVersionCommand) (*entity.TemplateVersion, error)
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. |