mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
Add Studio Code and Photographer to Galleries. (#4195)
* Added Studio Code and Photographer to Galleries * Fix gallery display on mobile * Fixed potential panic when scraping with a bad configuration --------- Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
@@ -56,12 +56,14 @@ func loadGalleryRelationships(ctx context.Context, expected models.Gallery, actu
|
||||
|
||||
func Test_galleryQueryBuilder_Create(t *testing.T) {
|
||||
var (
|
||||
title = "title"
|
||||
url = "url"
|
||||
rating = 60
|
||||
details = "details"
|
||||
createdAt = time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC)
|
||||
updatedAt = time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC)
|
||||
title = "title"
|
||||
code = "1337"
|
||||
url = "url"
|
||||
rating = 60
|
||||
details = "details"
|
||||
photographer = "photographer"
|
||||
createdAt = time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC)
|
||||
updatedAt = time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC)
|
||||
|
||||
galleryFile = makeFileWithID(fileIdxStartGalleryFiles)
|
||||
)
|
||||
@@ -77,9 +79,11 @@ func Test_galleryQueryBuilder_Create(t *testing.T) {
|
||||
"full",
|
||||
models.Gallery{
|
||||
Title: title,
|
||||
Code: code,
|
||||
URLs: models.NewRelatedStrings([]string{url}),
|
||||
Date: &date,
|
||||
Details: details,
|
||||
Photographer: photographer,
|
||||
Rating: &rating,
|
||||
Organized: true,
|
||||
StudioID: &studioIDs[studioIdxWithScene],
|
||||
@@ -94,13 +98,15 @@ func Test_galleryQueryBuilder_Create(t *testing.T) {
|
||||
{
|
||||
"with file",
|
||||
models.Gallery{
|
||||
Title: title,
|
||||
URLs: models.NewRelatedStrings([]string{url}),
|
||||
Date: &date,
|
||||
Details: details,
|
||||
Rating: &rating,
|
||||
Organized: true,
|
||||
StudioID: &studioIDs[studioIdxWithScene],
|
||||
Title: title,
|
||||
Code: code,
|
||||
URLs: models.NewRelatedStrings([]string{url}),
|
||||
Date: &date,
|
||||
Details: details,
|
||||
Photographer: photographer,
|
||||
Rating: &rating,
|
||||
Organized: true,
|
||||
StudioID: &studioIDs[studioIdxWithScene],
|
||||
Files: models.NewRelatedFiles([]models.File{
|
||||
galleryFile,
|
||||
}),
|
||||
@@ -207,12 +213,14 @@ func makeGalleryFileWithID(i int) *models.BaseFile {
|
||||
|
||||
func Test_galleryQueryBuilder_Update(t *testing.T) {
|
||||
var (
|
||||
title = "title"
|
||||
url = "url"
|
||||
rating = 60
|
||||
details = "details"
|
||||
createdAt = time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC)
|
||||
updatedAt = time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC)
|
||||
title = "title"
|
||||
code = "code"
|
||||
url = "url"
|
||||
rating = 60
|
||||
details = "details"
|
||||
photographer = "photographer"
|
||||
createdAt = time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC)
|
||||
updatedAt = time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC)
|
||||
)
|
||||
|
||||
date, _ := models.ParseDate("2003-02-01")
|
||||
@@ -225,14 +233,16 @@ func Test_galleryQueryBuilder_Update(t *testing.T) {
|
||||
{
|
||||
"full",
|
||||
&models.Gallery{
|
||||
ID: galleryIDs[galleryIdxWithScene],
|
||||
Title: title,
|
||||
URLs: models.NewRelatedStrings([]string{url}),
|
||||
Date: &date,
|
||||
Details: details,
|
||||
Rating: &rating,
|
||||
Organized: true,
|
||||
StudioID: &studioIDs[studioIdxWithScene],
|
||||
ID: galleryIDs[galleryIdxWithScene],
|
||||
Title: title,
|
||||
Code: code,
|
||||
URLs: models.NewRelatedStrings([]string{url}),
|
||||
Date: &date,
|
||||
Details: details,
|
||||
Photographer: photographer,
|
||||
Rating: &rating,
|
||||
Organized: true,
|
||||
StudioID: &studioIDs[studioIdxWithScene],
|
||||
Files: models.NewRelatedFiles([]models.File{
|
||||
makeGalleryFileWithID(galleryIdxWithScene),
|
||||
}),
|
||||
@@ -389,7 +399,9 @@ func clearGalleryPartial() models.GalleryPartial {
|
||||
// leave mandatory fields
|
||||
return models.GalleryPartial{
|
||||
Title: models.OptionalString{Set: true, Null: true},
|
||||
Code: models.OptionalString{Set: true, Null: true},
|
||||
Details: models.OptionalString{Set: true, Null: true},
|
||||
Photographer: models.OptionalString{Set: true, Null: true},
|
||||
URLs: &models.UpdateStrings{Mode: models.RelationshipUpdateModeSet},
|
||||
Date: models.OptionalDate{Set: true, Null: true},
|
||||
Rating: models.OptionalInt{Set: true, Null: true},
|
||||
@@ -401,12 +413,14 @@ func clearGalleryPartial() models.GalleryPartial {
|
||||
|
||||
func Test_galleryQueryBuilder_UpdatePartial(t *testing.T) {
|
||||
var (
|
||||
title = "title"
|
||||
details = "details"
|
||||
url = "url"
|
||||
rating = 60
|
||||
createdAt = time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC)
|
||||
updatedAt = time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC)
|
||||
title = "title"
|
||||
code = "code"
|
||||
details = "details"
|
||||
photographer = "photographer"
|
||||
url = "url"
|
||||
rating = 60
|
||||
createdAt = time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC)
|
||||
updatedAt = time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC)
|
||||
|
||||
date, _ = models.ParseDate("2003-02-01")
|
||||
)
|
||||
@@ -422,8 +436,10 @@ func Test_galleryQueryBuilder_UpdatePartial(t *testing.T) {
|
||||
"full",
|
||||
galleryIDs[galleryIdxWithImage],
|
||||
models.GalleryPartial{
|
||||
Title: models.NewOptionalString(title),
|
||||
Details: models.NewOptionalString(details),
|
||||
Title: models.NewOptionalString(title),
|
||||
Code: models.NewOptionalString(code),
|
||||
Details: models.NewOptionalString(details),
|
||||
Photographer: models.NewOptionalString(photographer),
|
||||
URLs: &models.UpdateStrings{
|
||||
Values: []string{url},
|
||||
Mode: models.RelationshipUpdateModeSet,
|
||||
@@ -449,14 +465,16 @@ func Test_galleryQueryBuilder_UpdatePartial(t *testing.T) {
|
||||
},
|
||||
},
|
||||
models.Gallery{
|
||||
ID: galleryIDs[galleryIdxWithImage],
|
||||
Title: title,
|
||||
Details: details,
|
||||
URLs: models.NewRelatedStrings([]string{url}),
|
||||
Date: &date,
|
||||
Rating: &rating,
|
||||
Organized: true,
|
||||
StudioID: &studioIDs[studioIdxWithGallery],
|
||||
ID: galleryIDs[galleryIdxWithImage],
|
||||
Title: title,
|
||||
Code: code,
|
||||
Details: details,
|
||||
Photographer: photographer,
|
||||
URLs: models.NewRelatedStrings([]string{url}),
|
||||
Date: &date,
|
||||
Rating: &rating,
|
||||
Organized: true,
|
||||
StudioID: &studioIDs[studioIdxWithGallery],
|
||||
Files: models.NewRelatedFiles([]models.File{
|
||||
makeGalleryFile(galleryIdxWithImage),
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user