Gallery URLs (#4114)

* Initial backend changes
* Fix unit tests
* UI changes
* Fix missing URL filters
This commit is contained in:
WithoutPants
2023-09-25 12:27:20 +10:00
committed by GitHub
parent a369e395e7
commit 9577600804
29 changed files with 361 additions and 117 deletions

View File

@@ -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)