tags

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterRoutesWithGroup

func RegisterRoutesWithGroup(g *echo.Group, db *bun.DB, authMiddleware *auth.Middleware)

RegisterRoutesWithGroup registers tag routes on a pre-configured group.

Types

type ListTagsOptions

type ListTagsOptions struct {
	Limit      *int
	Offset     *int
	LibraryID  *int
	LibraryIDs []int // Filter by multiple library IDs (for access control)
	Search     *string
	// contains filtered or unexported fields
}

type ListTagsQuery

type ListTagsQuery struct {
	Limit     int     `query:"limit" json:"limit,omitempty" default:"24" validate:"min=1,max=50"`
	Offset    int     `query:"offset" json:"offset,omitempty" validate:"min=0"`
	LibraryID *int    `query:"library_id" json:"library_id,omitempty" validate:"omitempty,min=1" tstype:"number"`
	Search    *string `query:"search" json:"search,omitempty" validate:"omitempty,max=100" tstype:"string"`
}

type MergeTagsPayload

type MergeTagsPayload struct {
	SourceID int `json:"source_id" validate:"required,min=1"`
}

type RetrieveTagOptions

type RetrieveTagOptions struct {
	ID        *int
	Name      *string
	LibraryID *int
}

type Service

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

func NewService

func NewService(db *bun.DB) *Service

func (*Service) CleanupOrphanedTags

func (svc *Service) CleanupOrphanedTags(ctx context.Context) (int, error)

CleanupOrphanedTags deletes tags with no book associations.

func (*Service) CreateTag

func (svc *Service) CreateTag(ctx context.Context, tag *models.Tag) error

func (*Service) DeleteTag

func (svc *Service) DeleteTag(ctx context.Context, tagID int) error

DeleteTag deletes a tag and all book associations.

func (*Service) FindOrCreateTag

func (svc *Service) FindOrCreateTag(ctx context.Context, name string, libraryID int) (*models.Tag, error)

FindOrCreateTag finds an existing tag or creates a new one (case-insensitive match).

func (*Service) GetBookCount

func (svc *Service) GetBookCount(ctx context.Context, tagID int) (int, error)

GetBookCount returns the count of books with this tag.

func (*Service) GetBooks

func (svc *Service) GetBooks(ctx context.Context, tagID int) ([]*models.Book, error)

GetBooks returns all books with this tag.

func (*Service) ListTags

func (svc *Service) ListTags(ctx context.Context, opts ListTagsOptions) ([]*models.Tag, error)

func (*Service) ListTagsWithTotal

func (svc *Service) ListTagsWithTotal(ctx context.Context, opts ListTagsOptions) ([]*models.Tag, int, error)

func (*Service) MergeTags

func (svc *Service) MergeTags(ctx context.Context, targetID, sourceID int) error

MergeTags merges sourceTag into targetTag (moves all associations, deletes source).

func (*Service) RetrieveTag

func (svc *Service) RetrieveTag(ctx context.Context, opts RetrieveTagOptions) (*models.Tag, error)

func (*Service) UpdateTag

func (svc *Service) UpdateTag(ctx context.Context, tag *models.Tag, opts UpdateTagOptions) error

type UpdateTagOptions

type UpdateTagOptions struct {
	Columns []string
}

type UpdateTagPayload

type UpdateTagPayload struct {
	Name *string `json:"name,omitempty" validate:"omitempty,min=1,max=300"`
}

Jump to

Keyboard shortcuts

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