-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Convert group aliases to list #6951
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
0f45dc0
845e0ba
fd198af
bc90011
6e208b4
2782b5d
5f15a7d
c12fff8
f9f8ee3
4daaa07
5a02f7c
57e5985
b01695e
71a0d95
bcd33e3
f83923e
d6b7d10
920b3d3
b04b4d0
dd5df5b
ac695eb
4895a2b
3e66369
9ebc217
2692042
050fc71
1642b8d
bbb670d
d0d7fea
88d526b
62e7d38
c74276a
ee852b5
735c6c2
c5cf544
6533f7b
ba0780f
c627c32
49e1545
ae64cf0
9558fcd
eff7eac
758f6d2
1c03ecc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,3 @@ | ||
| /ui/v2.5/src/docs/en/Manual/ @DogmaDragon | ||
| /docs/ @DogmaDragon | ||
| README.md @DogmaDragon | ||
| /docker/ @feederbox826 | ||
| /.github/workflows/ @feederbox826 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,27 @@ | ||
| dir: ./pkg/models | ||
| name: ".*ReaderWriter" | ||
| outpkg: mocks | ||
| output: ./pkg/models/mocks | ||
| with-expecter: false | ||
| packages: | ||
| github.com/stashapp/stash/pkg/models: | ||
| config: | ||
| dir: ./pkg/models/mocks | ||
| filename: "{{.InterfaceName}}.go" | ||
| outpkg: mocks | ||
| interfaces: | ||
| FileReaderWriter: | ||
| FolderReaderWriter: | ||
| GalleryReaderWriter: | ||
| GalleryChapterReaderWriter: | ||
| ImageReaderWriter: | ||
| GroupReaderWriter: | ||
| PerformerReaderWriter: | ||
| SceneReaderWriter: | ||
| SceneMarkerReaderWriter: | ||
| StudioReaderWriter: | ||
| TagReaderWriter: | ||
| SavedFilterReaderWriter: | ||
| github.com/stashapp/stash/internal/manager: | ||
| config: | ||
| dir: ./internal/manager/mocks | ||
| filename: "{{.InterfaceName}}.go" | ||
| outpkg: mocks | ||
| interfaces: | ||
| GroupService: | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,15 +55,15 @@ require ( | |
| github.com/vearutop/statigz v1.4.0 | ||
| github.com/vektah/dataloaden v0.3.0 | ||
| github.com/vektah/gqlparser/v2 v2.5.27 | ||
| github.com/vektra/mockery/v2 v2.10.0 | ||
| github.com/vektra/mockery/v2 v2.21.6 | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated to use |
||
| github.com/xWTF/chardet v0.0.0-20230208095535-c780f2ac244e | ||
| github.com/zencoder/go-dash/v3 v3.0.2 | ||
| golang.org/x/crypto v0.48.0 | ||
| golang.org/x/image v0.38.0 | ||
| golang.org/x/net v0.50.0 | ||
| golang.org/x/sys v0.41.0 | ||
| golang.org/x/term v0.40.0 | ||
| golang.org/x/text v0.35.0 | ||
| golang.org/x/crypto v0.52.0 | ||
| golang.org/x/image v0.41.0 | ||
| golang.org/x/net v0.55.0 | ||
| golang.org/x/sys v0.45.0 | ||
| golang.org/x/term v0.43.0 | ||
| golang.org/x/text v0.37.0 | ||
| golang.org/x/time v0.10.0 | ||
| gopkg.in/guregu/null.v4 v4.0.0 | ||
| gopkg.in/natefinch/lumberjack.v2 v2.2.1 | ||
|
|
@@ -76,6 +76,7 @@ require ( | |
| github.com/antchfx/xpath v1.3.6 // indirect | ||
| github.com/asticode/go-astikit v0.20.0 // indirect | ||
| github.com/asticode/go-astits v1.8.0 // indirect | ||
| github.com/chigopher/pathlib v0.12.0 // indirect | ||
| github.com/chromedp/sysutil v1.1.0 // indirect | ||
| github.com/coder/websocket v1.8.12 // indirect | ||
| github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect | ||
|
|
@@ -133,9 +134,9 @@ require ( | |
| github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect | ||
| go.uber.org/atomic v1.11.0 // indirect | ||
| go.yaml.in/yaml/v3 v3.0.3 // indirect | ||
| golang.org/x/mod v0.33.0 // indirect | ||
| golang.org/x/mod v0.35.0 // indirect | ||
| golang.org/x/sync v0.20.0 // indirect | ||
| golang.org/x/tools v0.42.0 // indirect | ||
| golang.org/x/tools v0.44.0 // indirect | ||
| gopkg.in/ini.v1 v1.67.0 // indirect | ||
| gopkg.in/yaml.v3 v3.0.1 // indirect | ||
| ) | ||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,7 @@ type GroupDescription { | |
| type Group { | ||
| id: ID! | ||
| name: String! | ||
| aliases: String | ||
| aliases: [String!] | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change breaks compatibility with existing external systems. You will need to deprecate the existing We did the same with performer aliases before we removed the deprecated field. See https://github.com/WithoutPants/stash/blob/f65e87773c4b9fb053f4c5f23bcb77c03adbbccd/internal/api/resolver_model_performer.go#L21 Will need to apply this to the other alias field changes. |
||
| "Duration in seconds" | ||
| duration: Int | ||
| date: String | ||
|
|
@@ -41,7 +41,8 @@ input GroupDescriptionInput { | |
|
|
||
| input GroupCreateInput { | ||
| name: String! | ||
| aliases: String | ||
| "Duplicate aliases and those equal to name will be ignored (case-insensitive)" | ||
| aliases: [String!] | ||
| "Duration in seconds" | ||
| duration: Int | ||
| date: String | ||
|
|
@@ -67,7 +68,8 @@ input GroupCreateInput { | |
| input GroupUpdateInput { | ||
| id: ID! | ||
| name: String | ||
| aliases: String | ||
| "Duplicate aliases and those equal to name will be ignored (case-insensitive)" | ||
| aliases: [String!] | ||
| duration: Int | ||
| date: String | ||
| # rating expressed as 1-100 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -228,3 +228,28 @@ func (r *groupResolver) CustomFields(ctx context.Context, obj *models.Group) (ma | |
|
|
||
| return m, nil | ||
| } | ||
|
|
||
| func (r *groupResolver) Aliases(ctx context.Context, obj *models.Group) ([]string, error) { | ||
| if !obj.Aliases.Loaded() { | ||
| if err := r.withReadTxn(ctx, func(ctx context.Context) error { | ||
| return obj.LoadAliases(ctx, r.repository.Group) | ||
| }); err != nil { | ||
| return nil, err | ||
| } | ||
| } | ||
|
|
||
| return obj.Aliases.List(), nil | ||
| } | ||
|
|
||
| // movieResolver.Aliases overrides groupResolver.Aliases to return a single string | ||
| // for backward compatibility with the deprecated Movie type. | ||
| func (r *movieResolver) Aliases(ctx context.Context, obj *models.Group) (*string, error) { | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only basic changes done to movie related codebase to ensure existing stuff doesn't break & code compiles correctly.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can be repurposed to be on |
||
| aliases, err := r.groupResolver.Aliases(ctx, obj) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
| if len(aliases) == 0 { | ||
| return nil, nil | ||
| } | ||
| return &aliases[0], nil | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More service interfaces exist but mocks for those can be generated as and when required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes should largely not be necessary if we remove the unit test from the api package.