mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
Studio aliases (#1660)
* Add migration to create studio aliases table * Refactor studioQueryBuilder.Query to use filterBuilder * Expand GraphQL API with aliases support for studio * Add aliases support for studios to the UI * List aliases in details panel * Allow editing aliases in edit panel * Add 'aliases' filter when searching * Find studios by alias in filter / select * Add auto-tagging based on studio aliases * Support studio aliases for filename parsing * Support importing and exporting of studio aliases * Search for studio alias as well during scraping
This commit is contained in:
@@ -53,7 +53,7 @@ func TestImporterPreImport(t *testing.T) {
|
||||
|
||||
assert.Nil(t, err)
|
||||
|
||||
i.Input = *createFullJSONStudio(studioName, image)
|
||||
i.Input = *createFullJSONStudio(studioName, image, []string{"alias"})
|
||||
i.Input.ParentStudio = ""
|
||||
|
||||
err = i.PreImport()
|
||||
@@ -151,13 +151,22 @@ func TestImporterPostImport(t *testing.T) {
|
||||
|
||||
i := Importer{
|
||||
ReaderWriter: readerWriter,
|
||||
imageData: imageBytes,
|
||||
Input: jsonschema.Studio{
|
||||
Aliases: []string{"alias"},
|
||||
},
|
||||
imageData: imageBytes,
|
||||
}
|
||||
|
||||
updateStudioImageErr := errors.New("UpdateImage error")
|
||||
updateTagAliasErr := errors.New("UpdateAlias error")
|
||||
|
||||
readerWriter.On("UpdateImage", studioID, imageBytes).Return(nil).Once()
|
||||
readerWriter.On("UpdateImage", errImageID, imageBytes).Return(updateStudioImageErr).Once()
|
||||
readerWriter.On("UpdateImage", errAliasID, imageBytes).Return(nil).Once()
|
||||
|
||||
readerWriter.On("UpdateAliases", studioID, i.Input.Aliases).Return(nil).Once()
|
||||
readerWriter.On("UpdateAliases", errImageID, i.Input.Aliases).Return(nil).Maybe()
|
||||
readerWriter.On("UpdateAliases", errAliasID, i.Input.Aliases).Return(updateTagAliasErr).Once()
|
||||
|
||||
err := i.PostImport(studioID)
|
||||
assert.Nil(t, err)
|
||||
@@ -165,6 +174,9 @@ func TestImporterPostImport(t *testing.T) {
|
||||
err = i.PostImport(errImageID)
|
||||
assert.NotNil(t, err)
|
||||
|
||||
err = i.PostImport(errAliasID)
|
||||
assert.NotNil(t, err)
|
||||
|
||||
readerWriter.AssertExpectations(t)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user