2020-09-15 07:28:53 +00:00
|
|
|
package models
|
|
|
|
|
2022-05-19 07:49:32 +00:00
|
|
|
import "context"
|
|
|
|
|
2022-04-25 05:55:05 +00:00
|
|
|
type StudioFilterType struct {
|
|
|
|
And *StudioFilterType `json:"AND"`
|
|
|
|
Or *StudioFilterType `json:"OR"`
|
|
|
|
Not *StudioFilterType `json:"NOT"`
|
|
|
|
Name *StringCriterionInput `json:"name"`
|
|
|
|
Details *StringCriterionInput `json:"details"`
|
|
|
|
// Filter to only include studios with this parent studio
|
|
|
|
Parents *MultiCriterionInput `json:"parents"`
|
|
|
|
// Filter by StashID
|
|
|
|
StashID *StringCriterionInput `json:"stash_id"`
|
|
|
|
// Filter to only include studios missing this property
|
|
|
|
IsMissing *string `json:"is_missing"`
|
|
|
|
// Filter by rating
|
|
|
|
Rating *IntCriterionInput `json:"rating"`
|
|
|
|
// Filter by scene count
|
|
|
|
SceneCount *IntCriterionInput `json:"scene_count"`
|
|
|
|
// Filter by image count
|
|
|
|
ImageCount *IntCriterionInput `json:"image_count"`
|
|
|
|
// Filter by gallery count
|
|
|
|
GalleryCount *IntCriterionInput `json:"gallery_count"`
|
|
|
|
// Filter by url
|
|
|
|
URL *StringCriterionInput `json:"url"`
|
|
|
|
// Filter by studio aliases
|
|
|
|
Aliases *StringCriterionInput `json:"aliases"`
|
|
|
|
// Filter by autotag ignore value
|
|
|
|
IgnoreAutoTag *bool `json:"ignore_auto_tag"`
|
|
|
|
}
|
|
|
|
|
2020-09-15 07:28:53 +00:00
|
|
|
type StudioReader interface {
|
2022-05-19 07:49:32 +00:00
|
|
|
Find(ctx context.Context, id int) (*Studio, error)
|
|
|
|
FindMany(ctx context.Context, ids []int) ([]*Studio, error)
|
|
|
|
FindChildren(ctx context.Context, id int) ([]*Studio, error)
|
|
|
|
FindByName(ctx context.Context, name string, nocase bool) (*Studio, error)
|
|
|
|
FindByStashID(ctx context.Context, stashID StashID) ([]*Studio, error)
|
|
|
|
Count(ctx context.Context) (int, error)
|
|
|
|
All(ctx context.Context) ([]*Studio, error)
|
2021-04-26 02:51:31 +00:00
|
|
|
// TODO - this interface is temporary until the filter schema can fully
|
|
|
|
// support the query needed
|
2022-05-19 07:49:32 +00:00
|
|
|
QueryForAutoTag(ctx context.Context, words []string) ([]*Studio, error)
|
|
|
|
Query(ctx context.Context, studioFilter *StudioFilterType, findFilter *FindFilterType) ([]*Studio, int, error)
|
|
|
|
GetImage(ctx context.Context, studioID int) ([]byte, error)
|
|
|
|
HasImage(ctx context.Context, studioID int) (bool, error)
|
|
|
|
GetStashIDs(ctx context.Context, studioID int) ([]*StashID, error)
|
|
|
|
GetAliases(ctx context.Context, studioID int) ([]string, error)
|
2020-09-15 07:28:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type StudioWriter interface {
|
2022-05-19 07:49:32 +00:00
|
|
|
Create(ctx context.Context, newStudio Studio) (*Studio, error)
|
|
|
|
Update(ctx context.Context, updatedStudio StudioPartial) (*Studio, error)
|
|
|
|
UpdateFull(ctx context.Context, updatedStudio Studio) (*Studio, error)
|
|
|
|
Destroy(ctx context.Context, id int) error
|
|
|
|
UpdateImage(ctx context.Context, studioID int, image []byte) error
|
|
|
|
DestroyImage(ctx context.Context, studioID int) error
|
2022-07-13 06:30:54 +00:00
|
|
|
UpdateStashIDs(ctx context.Context, studioID int, stashIDs []*StashID) error
|
2022-05-19 07:49:32 +00:00
|
|
|
UpdateAliases(ctx context.Context, studioID int, aliases []string) error
|
2020-09-15 07:28:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type StudioReaderWriter interface {
|
|
|
|
StudioReader
|
|
|
|
StudioWriter
|
|
|
|
}
|