libraries

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 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, opts ...RegisterRoutesOptions)

RegisterRoutesWithGroup registers library routes on a pre-configured group.

Types

type CreateLibraryPayload

type CreateLibraryPayload struct {
	Name                     string   `json:"name" validate:"required,max=100"`
	OrganizeFileStructure    *bool    `json:"organize_file_structure,omitempty"`
	CoverAspectRatio         string   `json:"cover_aspect_ratio" validate:"required,oneof=book audiobook book_fallback_audiobook audiobook_fallback_book"`
	DownloadFormatPreference *string  `json:"download_format_preference,omitempty" validate:"omitempty,oneof=original kepub ask"`
	LibraryPaths             []string `json:"library_paths" validate:"required,min=1,max=50,dive"`
}

type ListLibrariesOptions

type ListLibrariesOptions struct {
	Limit          *int
	Offset         *int
	IncludeDeleted bool
	LibraryIDs     []int // If set, only return libraries with these IDs
	// contains filtered or unexported fields
}

type ListLibrariesQuery

type ListLibrariesQuery struct {
	Limit   int  `query:"limit" json:"limit,omitempty" default:"10" validate:"min=1,max=100"`
	Offset  int  `query:"offset" json:"offset,omitempty" validate:"min=0"`
	Deleted bool `query:"deleted" json:"deleted,omitempty"`
}

type RegisterRoutesOptions added in v0.0.20

type RegisterRoutesOptions struct {
	// OnLibraryChanged is called after a library is created or its paths/deletion state changes.
	// Used by the monitor to refresh filesystem watches.
	OnLibraryChanged func()
}

RegisterRoutesOptions configures optional behaviors for library routes.

type RetrieveLibraryOptions

type RetrieveLibraryOptions struct {
	ID *int
}

type Service

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

func NewService

func NewService(db *bun.DB) *Service

func (*Service) CreateLibrary

func (svc *Service) CreateLibrary(ctx context.Context, library *models.Library) error

func (*Service) ListLibraries

func (svc *Service) ListLibraries(ctx context.Context, opts ListLibrariesOptions) ([]*models.Library, error)

func (*Service) ListLibrariesWithTotal

func (svc *Service) ListLibrariesWithTotal(ctx context.Context, opts ListLibrariesOptions) ([]*models.Library, int, error)

func (*Service) RetrieveLibrary

func (svc *Service) RetrieveLibrary(ctx context.Context, opts RetrieveLibraryOptions) (*models.Library, error)

func (*Service) UpdateLibrary

func (svc *Service) UpdateLibrary(ctx context.Context, library *models.Library, opts UpdateLibraryOptions) error

type UpdateLibraryOptions

type UpdateLibraryOptions struct {
	Columns            []string
	UpdateLibraryPaths bool
}

type UpdateLibraryPayload

type UpdateLibraryPayload struct {
	Name                     *string  `json:"name,omitempty" validate:"omitempty,max=100"`
	OrganizeFileStructure    *bool    `json:"organize_file_structure,omitempty"`
	CoverAspectRatio         *string  `json:"cover_aspect_ratio,omitempty" validate:"omitempty,oneof=book audiobook book_fallback_audiobook audiobook_fallback_book"`
	DownloadFormatPreference *string  `json:"download_format_preference,omitempty" validate:"omitempty,oneof=original kepub ask"`
	LibraryPaths             []string `json:"library_paths,omitempty" validate:"omitempty,min=1,max=50,dive"`
	Deleted                  *bool    `json:"deleted,omitempty" validate:"omitempty"`
}

Jump to

Keyboard shortcuts

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