mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
Gallery URLs (#4114)
* Initial backend changes * Fix unit tests * UI changes * Fix missing URL filters
This commit is contained in:
@@ -14,7 +14,7 @@ import (
|
||||
func ToBasicJSON(gallery *models.Gallery) (*jsonschema.Gallery, error) {
|
||||
newGalleryJSON := jsonschema.Gallery{
|
||||
Title: gallery.Title,
|
||||
URL: gallery.URL,
|
||||
URLs: gallery.URLs.List(),
|
||||
Details: gallery.Details,
|
||||
CreatedAt: json.JSONTime{Time: gallery.CreatedAt},
|
||||
UpdatedAt: json.JSONTime{Time: gallery.UpdatedAt},
|
||||
|
||||
@@ -59,7 +59,7 @@ func createFullGallery(id int) models.Gallery {
|
||||
Details: details,
|
||||
Rating: &rating,
|
||||
Organized: organized,
|
||||
URL: url,
|
||||
URLs: models.NewRelatedStrings([]string{url}),
|
||||
CreatedAt: createTime,
|
||||
UpdatedAt: updateTime,
|
||||
}
|
||||
@@ -85,7 +85,7 @@ func createFullJSONGallery() *jsonschema.Gallery {
|
||||
Details: details,
|
||||
Rating: rating,
|
||||
Organized: organized,
|
||||
URL: url,
|
||||
URLs: []string{url},
|
||||
ZipFiles: []string{path},
|
||||
CreatedAt: json.JSONTime{
|
||||
Time: createTime,
|
||||
|
||||
@@ -65,8 +65,10 @@ func (i *Importer) galleryJSONToGallery(galleryJSON jsonschema.Gallery) models.G
|
||||
if galleryJSON.Details != "" {
|
||||
newGallery.Details = galleryJSON.Details
|
||||
}
|
||||
if galleryJSON.URL != "" {
|
||||
newGallery.URL = galleryJSON.URL
|
||||
if len(galleryJSON.URLs) > 0 {
|
||||
newGallery.URLs = models.NewRelatedStrings(galleryJSON.URLs)
|
||||
} else if galleryJSON.URL != "" {
|
||||
newGallery.URLs = models.NewRelatedStrings([]string{galleryJSON.URL})
|
||||
}
|
||||
if galleryJSON.Date != "" {
|
||||
d, err := models.ParseDate(galleryJSON.Date)
|
||||
|
||||
@@ -66,7 +66,7 @@ func TestImporterPreImport(t *testing.T) {
|
||||
Details: details,
|
||||
Rating: &rating,
|
||||
Organized: organized,
|
||||
URL: url,
|
||||
URLs: models.NewRelatedStrings([]string{url}),
|
||||
Files: models.NewRelatedFiles([]models.File{}),
|
||||
TagIDs: models.NewRelatedIDs([]int{}),
|
||||
PerformerIDs: models.NewRelatedIDs([]int{}),
|
||||
|
||||
Reference in New Issue
Block a user