service

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: May 30, 2025 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 ContentService

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

ContentService handles content-related operations

func NewContentService

func NewContentService(
	contentRepo repository.ContentRepository,
	metadataRepo repository.ContentMetadataRepository,
	objectRepo repository.ObjectRepository,
) *ContentService

NewContentService creates a new content service

func (*ContentService) CreateContent

func (s *ContentService) CreateContent(
	ctx context.Context,
	ownerID, tenantID uuid.UUID,
) (*domain.Content, error)

CreateContent creates a new original content

func (*ContentService) CreateDerivedContent

func (s *ContentService) CreateDerivedContent(
	ctx context.Context,
	parentID uuid.UUID,
	ownerID, tenantID uuid.UUID,
) (*domain.Content, error)

CreateDerivedContent creates a new content derived from an existing content

func (*ContentService) DeleteContent

func (s *ContentService) DeleteContent(ctx context.Context, id uuid.UUID) error

DeleteContent deletes a content

func (*ContentService) GetContent

func (s *ContentService) GetContent(ctx context.Context, id uuid.UUID) (*domain.Content, error)

GetContent retrieves a content by ID

func (*ContentService) GetContentMetadata

func (s *ContentService) GetContentMetadata(ctx context.Context, contentID uuid.UUID) (*domain.ContentMetadata, error)

GetContentMetadata retrieves metadata for a content

func (*ContentService) ListContents

func (s *ContentService) ListContents(ctx context.Context, ownerID, tenantID uuid.UUID) ([]*domain.Content, error)

ListContents lists contents by owner ID and tenant ID

func (*ContentService) SetContentMetadata

func (s *ContentService) SetContentMetadata(
	ctx context.Context,
	contentID uuid.UUID,
	contentType, title, description string,
	tags []string,
	fileSize int64,
	createdBy string,
	customMetadata map[string]interface{},
) error

SetContentMetadata sets metadata for a content

func (*ContentService) UpdateContent

func (s *ContentService) UpdateContent(ctx context.Context, content *domain.Content) error

UpdateContent updates a content

type ObjectService

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

ObjectService handles object-related operations

func NewObjectService

func NewObjectService(
	objectRepo repository.ObjectRepository,
	objectMetadataRepo repository.ObjectMetadataRepository,
	storageBackendRepo repository.StorageBackendRepository,
	defaultBackend storage.Backend,
) *ObjectService

NewObjectService creates a new object service

func (*ObjectService) CreateObject

func (s *ObjectService) CreateObject(
	ctx context.Context,
	contentID uuid.UUID,
	storageBackendName string,
	version int,
) (*domain.Object, error)

CreateObject creates a new object

func (*ObjectService) DeleteObject

func (s *ObjectService) DeleteObject(ctx context.Context, id uuid.UUID) error

DeleteObject deletes an object

func (*ObjectService) DownloadObject

func (s *ObjectService) DownloadObject(ctx context.Context, id uuid.UUID) (io.ReadCloser, error)

DownloadObject downloads an object

func (*ObjectService) GetBackend

func (s *ObjectService) GetBackend(name string) (storage.Backend, error)

GetBackend returns a storage backend by name

func (*ObjectService) GetDownloadURL

func (s *ObjectService) GetDownloadURL(ctx context.Context, id uuid.UUID) (string, error)

GetDownloadURL gets a URL for downloading an object

func (*ObjectService) GetObject

func (s *ObjectService) GetObject(ctx context.Context, id uuid.UUID) (*domain.Object, error)

GetObject retrieves an object by ID

func (*ObjectService) GetObjectMetadata

func (s *ObjectService) GetObjectMetadata(ctx context.Context, objectID uuid.UUID) (map[string]interface{}, error)

GetObjectMetadata retrieves metadata for an object

func (*ObjectService) GetObjectsByContentID

func (s *ObjectService) GetObjectsByContentID(ctx context.Context, contentID uuid.UUID) ([]*domain.Object, error)

GetObjectsByContentID retrieves objects by content ID

func (*ObjectService) GetUploadURL

func (s *ObjectService) GetUploadURL(ctx context.Context, id uuid.UUID) (string, error)

GetUploadURL gets a URL for uploading an object

func (*ObjectService) RegisterBackend

func (s *ObjectService) RegisterBackend(name string, backend storage.Backend)

RegisterBackend registers a storage backend

func (*ObjectService) SetObjectMetadata

func (s *ObjectService) SetObjectMetadata(ctx context.Context, objectID uuid.UUID, metadata map[string]interface{}) error

SetObjectMetadata sets metadata for an object

func (*ObjectService) UpdateObject

func (s *ObjectService) UpdateObject(ctx context.Context, object *domain.Object) error

UpdateObject updates an object

func (*ObjectService) UploadObject

func (s *ObjectService) UploadObject(ctx context.Context, id uuid.UUID, reader io.Reader) error

UploadObject uploads an object

type StorageBackendService

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

StorageBackendService handles storage backend operations

func NewStorageBackendService

func NewStorageBackendService(
	storageBackendRepo repository.StorageBackendRepository,
) *StorageBackendService

NewStorageBackendService creates a new storage backend service

func (*StorageBackendService) CreateStorageBackend

func (s *StorageBackendService) CreateStorageBackend(
	ctx context.Context,
	name string,
	backendType string,
	config map[string]interface{},
) (*domain.StorageBackend, error)

CreateStorageBackend creates a new storage backend

func (*StorageBackendService) DeleteStorageBackend

func (s *StorageBackendService) DeleteStorageBackend(ctx context.Context, name string) error

DeleteStorageBackend deletes a storage backend

func (*StorageBackendService) GetStorageBackend

func (s *StorageBackendService) GetStorageBackend(ctx context.Context, name string) (*domain.StorageBackend, error)

GetStorageBackend retrieves a storage backend by name

func (*StorageBackendService) ListStorageBackends

func (s *StorageBackendService) ListStorageBackends(ctx context.Context) ([]*domain.StorageBackend, error)

ListStorageBackends lists all storage backends

func (*StorageBackendService) UpdateStorageBackend

func (s *StorageBackendService) UpdateStorageBackend(ctx context.Context, backend *domain.StorageBackend) error

UpdateStorageBackend updates a storage backend

Jump to

Keyboard shortcuts

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