Documentation
¶
Index ¶
- func RegisterRoutesWithGroup(g *echo.Group, db *bun.DB, authMiddleware *auth.Middleware)
- type ListGenresOptions
- type ListGenresQuery
- type MergeGenresPayload
- type RetrieveGenreOptions
- type Service
- func (svc *Service) CleanupOrphanedGenres(ctx context.Context) (int, error)
- func (svc *Service) CreateGenre(ctx context.Context, genre *models.Genre) error
- func (svc *Service) DeleteGenre(ctx context.Context, genreID int) error
- func (svc *Service) FindOrCreateGenre(ctx context.Context, name string, libraryID int) (*models.Genre, error)
- func (svc *Service) GetBookCount(ctx context.Context, genreID int) (int, error)
- func (svc *Service) GetBooks(ctx context.Context, genreID int) ([]*models.Book, error)
- func (svc *Service) ListGenres(ctx context.Context, opts ListGenresOptions) ([]*models.Genre, error)
- func (svc *Service) ListGenresWithTotal(ctx context.Context, opts ListGenresOptions) ([]*models.Genre, int, error)
- func (svc *Service) MergeGenres(ctx context.Context, targetID, sourceID int) error
- func (svc *Service) RetrieveGenre(ctx context.Context, opts RetrieveGenreOptions) (*models.Genre, error)
- func (svc *Service) UpdateGenre(ctx context.Context, genre *models.Genre, opts UpdateGenreOptions) error
- type UpdateGenreOptions
- type UpdateGenrePayload
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterRoutesWithGroup ¶
RegisterRoutesWithGroup registers genre routes on a pre-configured group.
Types ¶
type ListGenresOptions ¶
type ListGenresQuery ¶
type ListGenresQuery 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 MergeGenresPayload ¶
type MergeGenresPayload struct {
SourceID int `json:"source_id" validate:"required,min=1"`
}
type RetrieveGenreOptions ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) CleanupOrphanedGenres ¶
CleanupOrphanedGenres deletes genres with no book associations.
func (*Service) CreateGenre ¶
func (*Service) DeleteGenre ¶
DeleteGenre deletes a genre and all book associations.
func (*Service) FindOrCreateGenre ¶
func (svc *Service) FindOrCreateGenre(ctx context.Context, name string, libraryID int) (*models.Genre, error)
FindOrCreateGenre finds an existing genre or creates a new one (case-insensitive match).
func (*Service) GetBookCount ¶
GetBookCount returns the count of books with this genre.
func (*Service) ListGenres ¶
func (*Service) ListGenresWithTotal ¶
func (*Service) MergeGenres ¶
MergeGenres merges sourceGenre into targetGenre (moves all associations, deletes source).
func (*Service) RetrieveGenre ¶
func (*Service) UpdateGenre ¶
type UpdateGenreOptions ¶
type UpdateGenreOptions struct {
Columns []string
}
type UpdateGenrePayload ¶
type UpdateGenrePayload struct {
Name *string `json:"name,omitempty" validate:"omitempty,min=1,max=300"`
}
Click to show internal directories.
Click to hide internal directories.