catalog

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateDocumentTypeCommand

type CreateDocumentTypeCommand struct {
	TenantID    string
	Code        string
	Name        entity.I18nText
	Description entity.I18nText
}

CreateDocumentTypeCommand represents the command to create a document type.

type CreateFolderCommand

type CreateFolderCommand struct {
	WorkspaceID string
	ParentID    *string
	Name        string
	CreatedBy   string
}

CreateFolderCommand represents the command to create a folder.

type CreateTagCommand

type CreateTagCommand struct {
	WorkspaceID string
	Name        string
	Color       string
	CreatedBy   string
}

CreateTagCommand represents the command to create a tag.

type DeleteDocumentTypeCommand

type DeleteDocumentTypeCommand struct {
	ID            string
	TenantID      string  // Required to verify ownership (cannot delete global types)
	Force         bool    // If true, delete even if templates are assigned (sets them to NULL)
	ReplaceWithID *string // If set, replace document_type_id in templates with this type before deleting
}

DeleteDocumentTypeCommand represents the command to delete a document type.

type DeleteDocumentTypeResult

type DeleteDocumentTypeResult struct {
	Deleted    bool                               // True if deletion was performed
	Templates  []*entity.DocumentTypeTemplateInfo // Templates using this type (if not deleted)
	CanReplace bool                               // True if replacement is possible
}

DeleteDocumentTypeResult represents the result of attempting to delete a document type.

type DocumentTypeUseCase

type DocumentTypeUseCase interface {
	// CreateDocumentType creates a new document type.
	CreateDocumentType(ctx context.Context, cmd CreateDocumentTypeCommand) (*entity.DocumentType, error)

	// GetDocumentType retrieves a document type by ID.
	GetDocumentType(ctx context.Context, id string) (*entity.DocumentType, error)

	// GetDocumentTypeByCode retrieves a document type by code within a tenant.
	GetDocumentTypeByCode(ctx context.Context, tenantID, code string) (*entity.DocumentType, error)

	// ListDocumentTypes lists all document types for a tenant with pagination.
	ListDocumentTypes(ctx context.Context, tenantID string, filters port.DocumentTypeFilters) ([]*entity.DocumentType, int64, error)

	// ListDocumentTypesWithCount lists document types with template usage count.
	ListDocumentTypesWithCount(ctx context.Context, tenantID string, filters port.DocumentTypeFilters) ([]*entity.DocumentTypeListItem, int64, error)

	// UpdateDocumentType updates a document type's details (name and description only).
	UpdateDocumentType(ctx context.Context, cmd UpdateDocumentTypeCommand) (*entity.DocumentType, error)

	// DeleteDocumentType attempts to delete a document type.
	// If templates are assigned and Force is false, returns templates list without deleting.
	// If ReplaceWithID is set, replaces the type in all templates before deleting.
	DeleteDocumentType(ctx context.Context, cmd DeleteDocumentTypeCommand) (*DeleteDocumentTypeResult, error)
}

DocumentTypeUseCase defines the input port for document type operations.

type FolderUseCase

type FolderUseCase interface {
	// CreateFolder creates a new folder.
	CreateFolder(ctx context.Context, cmd CreateFolderCommand) (*entity.Folder, error)

	// GetFolder retrieves a folder by ID.
	GetFolder(ctx context.Context, id string) (*entity.Folder, error)

	// GetFolderWithCounts retrieves a folder by ID including item counts.
	GetFolderWithCounts(ctx context.Context, id string) (*entity.FolderWithCounts, error)

	// ListFolders lists all folders in a workspace.
	ListFolders(ctx context.Context, workspaceID string) ([]*entity.Folder, error)

	// ListFoldersWithCounts lists all folders in a workspace including item counts.
	ListFoldersWithCounts(ctx context.Context, workspaceID string) ([]*entity.FolderWithCounts, error)

	// ListChildFolders lists all child folders of a parent.
	ListChildFolders(ctx context.Context, workspaceID string, parentID *string) ([]*entity.Folder, error)

	// ListRootFolders lists all root folders in a workspace.
	ListRootFolders(ctx context.Context, workspaceID string) ([]*entity.Folder, error)

	// GetFolderTree retrieves the complete folder tree for a workspace.
	GetFolderTree(ctx context.Context, workspaceID string) ([]*entity.FolderTree, error)

	// UpdateFolder updates a folder's details.
	UpdateFolder(ctx context.Context, cmd UpdateFolderCommand) (*entity.Folder, error)

	// MoveFolder moves a folder to a new parent.
	MoveFolder(ctx context.Context, cmd MoveFolderCommand) (*entity.Folder, error)

	// DeleteFolder deletes a folder.
	// Returns error if folder has children or contains templates.
	DeleteFolder(ctx context.Context, id string) error

	// GetFolderPath retrieves the full path of a folder from root.
	GetFolderPath(ctx context.Context, id string) ([]*entity.Folder, error)
}

FolderUseCase defines the input port for folder operations.

type MoveFolderCommand

type MoveFolderCommand struct {
	ID          string
	NewParentID *string
}

MoveFolderCommand represents the command to move a folder to a new parent.

type TagUseCase

type TagUseCase interface {
	// CreateTag creates a new tag.
	CreateTag(ctx context.Context, cmd CreateTagCommand) (*entity.Tag, error)

	// GetTag retrieves a tag by ID.
	GetTag(ctx context.Context, id string) (*entity.Tag, error)

	// ListTags lists all tags in a workspace.
	ListTags(ctx context.Context, workspaceID string) ([]*entity.Tag, error)

	// ListTagsWithCount lists all tags with their template counts.
	ListTagsWithCount(ctx context.Context, workspaceID string) ([]*entity.TagWithCount, error)

	// UpdateTag updates a tag's details.
	UpdateTag(ctx context.Context, cmd UpdateTagCommand) (*entity.Tag, error)

	// DeleteTag deletes a tag.
	// Returns error if tag is attached to any templates.
	DeleteTag(ctx context.Context, id string) error

	// FindTagByName finds a tag by name within a workspace.
	FindTagByName(ctx context.Context, workspaceID, name string) (*entity.Tag, error)
}

TagUseCase defines the input port for tag operations.

type UpdateDocumentTypeCommand

type UpdateDocumentTypeCommand struct {
	ID          string
	TenantID    string // Required to verify ownership (cannot modify global types)
	Name        entity.I18nText
	Description entity.I18nText
}

UpdateDocumentTypeCommand represents the command to update a document type.

type UpdateFolderCommand

type UpdateFolderCommand struct {
	ID   string
	Name string
}

UpdateFolderCommand represents the command to update a folder.

type UpdateTagCommand

type UpdateTagCommand struct {
	ID    string
	Name  string
	Color string
}

UpdateTagCommand represents the command to update a tag.

Jump to

Keyboard shortcuts

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