mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
Gallery URLs (#4114)
* Initial backend changes * Fix unit tests * UI changes * Fix missing URL filters
This commit is contained in:
@@ -11,7 +11,6 @@ type Gallery struct {
|
||||
ID int `json:"id"`
|
||||
|
||||
Title string `json:"title"`
|
||||
URL string `json:"url"`
|
||||
Date *Date `json:"date"`
|
||||
Details string `json:"details"`
|
||||
// Rating expressed in 1-100 scale
|
||||
@@ -31,9 +30,10 @@ type Gallery struct {
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
|
||||
SceneIDs RelatedIDs `json:"scene_ids"`
|
||||
TagIDs RelatedIDs `json:"tag_ids"`
|
||||
PerformerIDs RelatedIDs `json:"performer_ids"`
|
||||
URLs RelatedStrings `json:"urls"`
|
||||
SceneIDs RelatedIDs `json:"scene_ids"`
|
||||
TagIDs RelatedIDs `json:"tag_ids"`
|
||||
PerformerIDs RelatedIDs `json:"performer_ids"`
|
||||
}
|
||||
|
||||
func NewGallery() Gallery {
|
||||
@@ -51,7 +51,7 @@ type GalleryPartial struct {
|
||||
// Checksum OptionalString
|
||||
// Zip OptionalBool
|
||||
Title OptionalString
|
||||
URL OptionalString
|
||||
URLs *UpdateStrings
|
||||
Date OptionalDate
|
||||
Details OptionalString
|
||||
// Rating expressed in 1-100 scale
|
||||
@@ -81,6 +81,12 @@ func (g *Gallery) IsUserCreated() bool {
|
||||
return g.PrimaryFileID == nil && g.FolderID == nil
|
||||
}
|
||||
|
||||
func (g *Gallery) LoadURLs(ctx context.Context, l URLLoader) error {
|
||||
return g.URLs.load(func() ([]string, error) {
|
||||
return l.GetURLs(ctx, g.ID)
|
||||
})
|
||||
}
|
||||
|
||||
func (g *Gallery) LoadFiles(ctx context.Context, l FileLoader) error {
|
||||
return g.Files.load(func() ([]File, error) {
|
||||
return l.GetFiles(ctx, g.ID)
|
||||
|
||||
Reference in New Issue
Block a user