group

package
v0.27.1 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package group provides the application logic for groups.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyName     = errors.New("name cannot be empty")
	ErrHierarchyLoop = errors.New("a group cannot be contained by one of its subgroups")
)
View Source
var ErrInvalidInsertIndex = errors.New("invalid insert index")

Functions

func CountByContainingGroupID

func CountByContainingGroupID(ctx context.Context, r models.GroupQueryer, id int, depth *int) (int, error)

func CountByStudioID

func CountByStudioID(ctx context.Context, r models.GroupQueryer, id int, depth *int) (int, error)

func CountByTagID

func CountByTagID(ctx context.Context, r models.GroupQueryer, id int, depth *int) (int, error)

func ToJSON

func ToJSON(ctx context.Context, reader ImageGetter, studioReader models.StudioGetter, movie *models.Group) (*jsonschema.Group, error)

ToJSON converts a Movie into its JSON equivalent.

Types

type AnscestorFinder

type AnscestorFinder interface {
	FindInAncestors(ctx context.Context, ascestorIDs []int, ids []int) ([]int, error)
}

type ImageGetter

type ImageGetter interface {
	GetFrontImage(ctx context.Context, movieID int) ([]byte, error)
	GetBackImage(ctx context.Context, movieID int) ([]byte, error)
}

type ImageInput

type ImageInput struct {
	Image []byte
	Set   bool
}

type Importer

type Importer struct {
	ReaderWriter        ImporterReaderWriter
	StudioWriter        models.StudioFinderCreator
	TagWriter           models.TagFinderCreator
	Input               jsonschema.Group
	MissingRefBehaviour models.ImportMissingRefEnum
	// contains filtered or unexported fields
}

func (*Importer) Create

func (i *Importer) Create(ctx context.Context) (*int, error)

func (*Importer) FindExistingID

func (i *Importer) FindExistingID(ctx context.Context) (*int, error)

func (*Importer) Name

func (i *Importer) Name() string

func (*Importer) PostImport

func (i *Importer) PostImport(ctx context.Context, id int) error

func (*Importer) PreImport

func (i *Importer) PreImport(ctx context.Context) error

func (*Importer) Update

func (i *Importer) Update(ctx context.Context, id int) error

type ImporterReaderWriter

type ImporterReaderWriter interface {
	models.GroupCreatorUpdater
	FindByName(ctx context.Context, name string, nocase bool) (*models.Group, error)
}

type Service

type Service struct {
	Repository CreatorUpdater
}

func (*Service) AddSubGroups

func (s *Service) AddSubGroups(ctx context.Context, groupID int, subGroups []models.GroupIDDescription, insertIndex *int) error

func (*Service) Create

func (s *Service) Create(ctx context.Context, group *models.Group, frontimageData []byte, backimageData []byte) error

func (*Service) RemoveSubGroups

func (s *Service) RemoveSubGroups(ctx context.Context, groupID int, subGroupIDs []int) error

func (*Service) ReorderSubGroups

func (s *Service) ReorderSubGroups(ctx context.Context, groupID int, subGroupIDs []int, insertPointID int, insertAfter bool) error

func (*Service) UpdatePartial

func (s *Service) UpdatePartial(ctx context.Context, id int, updatedGroup models.GroupPartial, frontImage ImageInput, backImage ImageInput) (*models.Group, error)

type SubGroupAdder

type SubGroupAdder interface {
	AddSubGroups(ctx context.Context, groupID int, subGroups []models.GroupIDDescription, insertIndex *int) error
}

type SubGroupAlreadyInGroupError

type SubGroupAlreadyInGroupError struct {
	GroupIDs []int
}

func (*SubGroupAlreadyInGroupError) Error

type SubGroupIDFinder

type SubGroupIDFinder interface {
	FindSubGroupIDs(ctx context.Context, containingID int, ids []int) ([]int, error)
}

type SubGroupNotExistError

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

func (SubGroupNotExistError) Error

func (e SubGroupNotExistError) Error() string

func (SubGroupNotExistError) MissingSubGroup

func (e SubGroupNotExistError) MissingSubGroup() string

type SubGroupRemover

type SubGroupRemover interface {
	RemoveSubGroups(ctx context.Context, groupID int, subGroupIDs []int) error
}

type SubGroupReorderer

type SubGroupReorderer interface {
	ReorderSubGroups(ctx context.Context, groupID int, subGroupIDs []int, insertID int, insertAfter bool) error
}

Jump to

Keyboard shortcuts

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