gallery

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: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultPage is the default gallery page number.
	DefaultPage = 1
	// DefaultPerPage is the default gallery page size.
	DefaultPerPage = 20
	// MaxUploadSize is the maximum accepted upload size in bytes (10 MB).
	MaxUploadSize = 10 << 20
)

Variables

View Source
var (
	// ErrQueryRequired indicates that the search query is required.
	ErrQueryRequired = errors.New("query parameter 'q' is required")
	// ErrAssetKeyRequired indicates that the asset key is required.
	ErrAssetKeyRequired = errors.New("query parameter 'key' is required")
	// ErrUploadEmpty indicates that an upload body was empty.
	ErrUploadEmpty = errors.New("gallery upload is empty")
)

Functions

This section is empty.

Types

type AssetPayload

type AssetPayload struct {
	Data        []byte
	ContentType string
}

AssetPayload is a binary gallery asset resolved for HTTP serving.

type AssetsPage

type AssetsPage struct {
	Assets  []*entity.GalleryAsset
	Total   int
	Page    int
	PerPage int
}

AssetsPage holds a paginated list of gallery assets.

type DeleteAssetCmd

type DeleteAssetCmd struct {
	WorkspaceID string
	Key         string
}

DeleteAssetCmd is the command for deleting a gallery asset.

type GalleryUseCase

type GalleryUseCase interface {
	// ListAssets returns a paginated list of assets for the workspace.
	ListAssets(ctx context.Context, cmd ListAssetsCmd) (*AssetsPage, error)

	// SearchAssets returns assets matching the search query.
	SearchAssets(ctx context.Context, cmd SearchAssetsCmd) (*AssetsPage, error)

	// UploadAsset uploads a new image and registers it in the gallery.
	// Deduplicates by SHA-256: returns the existing asset if the content is identical.
	UploadAsset(ctx context.Context, cmd UploadAssetCmd) (*entity.GalleryAsset, error)

	// DeleteAsset removes an asset from storage and from the gallery registry.
	DeleteAsset(ctx context.Context, cmd DeleteAssetCmd) error

	// GetAssetURL returns a resolvable HTTP URL for the given asset key.
	GetAssetURL(ctx context.Context, cmd GetAssetURLCmd) (string, error)

	// ServeAsset resolves an owned asset and returns its payload for direct HTTP serving.
	ServeAsset(ctx context.Context, cmd ServeAssetCmd) (*AssetPayload, error)
}

GalleryUseCase defines the input port for gallery operations.

type GetAssetURLCmd

type GetAssetURLCmd struct {
	WorkspaceID string
	Key         string
}

GetAssetURLCmd is the command for resolving a gallery asset URL.

type ListAssetsCmd

type ListAssetsCmd struct {
	WorkspaceID string
	Page        int
	PerPage     int
}

ListAssetsCmd is the command for listing gallery assets.

type SearchAssetsCmd

type SearchAssetsCmd struct {
	WorkspaceID string
	Query       string
	Page        int
	PerPage     int
}

SearchAssetsCmd is the command for searching gallery assets.

type ServeAssetCmd

type ServeAssetCmd struct {
	WorkspaceID string
	Key         string
}

ServeAssetCmd is the command for resolving gallery asset bytes for HTTP streaming.

type UploadAssetCmd

type UploadAssetCmd struct {
	TenantID    string
	WorkspaceID string
	UserID      string
	Filename    string
	ContentType string
	Data        []byte
}

UploadAssetCmd is the command for uploading a new gallery asset.

Jump to

Keyboard shortcuts

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