Documentation
¶
Index ¶
- func BuildVersionInjectableDefaults(injectables []*entity.VersionInjectableWithDefinition) map[string]string
- func NewInternalRenderService(tenantRepo port.TenantRepository, workspaceRepo port.WorkspaceRepository, ...) templateuc.InternalRenderUseCase
- func NewTemplateService(templateRepo port.TemplateRepository, ...) templateuc.TemplateUseCase
- func NewTemplateVersionService(versionRepo port.TemplateVersionRepository, ...) templateuc.TemplateVersionUseCase
- type InternalRenderService
- type TemplateCache
- 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) 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) 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)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildVersionInjectableDefaults ¶
func BuildVersionInjectableDefaults(injectables []*entity.VersionInjectableWithDefinition) map[string]string
BuildVersionInjectableDefaults builds a map of default values from version injectables. Priority: TemplateVersionInjectable.DefaultValue > InjectableDefinition.DefaultValue.
func NewInternalRenderService ¶
func NewInternalRenderService( tenantRepo port.TenantRepository, workspaceRepo port.WorkspaceRepository, docTypeRepo port.DocumentTypeRepository, templateRepo port.TemplateRepository, versionRepo port.TemplateVersionRepository, pdfRenderer port.PDFRenderer, resolver *injectablesvc.InjectableResolverService, templateCache *TemplateCache, ) templateuc.InternalRenderUseCase
NewInternalRenderService creates a new internal render service.
func NewTemplateService ¶
func NewTemplateService( templateRepo port.TemplateRepository, versionRepo port.TemplateVersionRepository, tagRepo port.TemplateTagRepository, ) templateuc.TemplateUseCase
NewTemplateService creates a new template service.
func NewTemplateVersionService ¶
func NewTemplateVersionService( versionRepo port.TemplateVersionRepository, injectableRepo port.TemplateVersionInjectableRepository, templateRepo port.TemplateRepository, contentValidator port.ContentValidator, ) templateuc.TemplateVersionUseCase
NewTemplateVersionService creates a new template version service.
Types ¶
type InternalRenderService ¶
type InternalRenderService struct {
// contains filtered or unexported fields
}
InternalRenderService implements the internal render use case with fallback chain.
func (*InternalRenderService) RenderByDocumentType ¶
func (s *InternalRenderService) RenderByDocumentType(ctx context.Context, cmd templateuc.InternalRenderCommand) (*port.RenderPreviewResult, error)
RenderByDocumentType resolves a template using the fallback chain and renders a PDF.
func (*InternalRenderService) RenderByWorkspaceID ¶
func (s *InternalRenderService) RenderByWorkspaceID(ctx context.Context, cmd templateuc.RenderByWorkspaceCommand) (*port.RenderPreviewResult, error)
RenderByWorkspaceID resolves a template using workspace ID and document type code.
type TemplateCache ¶
type TemplateCache struct {
// contains filtered or unexported fields
}
TemplateCache provides an in-memory cache for resolved template versions.
func NewTemplateCache ¶
func NewTemplateCache(maxEntries int64, ttl time.Duration) (*TemplateCache, error)
NewTemplateCache creates a new template cache. maxEntries controls the approximate number of items the cache will hold. ttl controls how long items remain valid.
func (*TemplateCache) Get ¶
func (c *TemplateCache) Get(tenantCode, workspaceCode, docTypeCode string) *entity.TemplateVersionWithDetails
Get retrieves a cached template version, returning nil on miss.
func (*TemplateCache) Set ¶
func (c *TemplateCache) Set(tenantCode, workspaceCode, docTypeCode string, version *entity.TemplateVersionWithDetails)
Set stores a resolved template version in the cache.
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) 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) 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.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package contentvalidator provides content structure validation for template versions.
|
Package contentvalidator provides content structure validation for template versions. |