Fix submission of scene drafts without performers (#2515)

This commit is contained in:
InfiniteTF 2022-04-18 02:43:27 +02:00 committed by GitHub
parent 401660e6a3
commit cdaa191155
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 177 additions and 169 deletions

View file

@ -7,6 +7,8 @@ client:
models: models:
Date: Date:
model: github.com/99designs/gqlgen/graphql.String model: github.com/99designs/gqlgen/graphql.String
SceneDraftInput:
model: github.com/stashapp/stash/pkg/scraper/stashbox/graphql.SceneDraftInput
endpoint: endpoint:
# This points to stashdb.org currently, but can be directed at any stash-box # This points to stashdb.org currently, but can be directed at any stash-box
# instance. It is used for generation only. # instance. It is used for generation only.

View file

@ -226,6 +226,20 @@ const FindSceneByFingerprintDocument = `query FindSceneByFingerprint ($fingerpri
... SceneFragment ... SceneFragment
} }
} }
fragment URLFragment on URL {
url
type
}
fragment StudioFragment on Studio {
name
id
urls {
... URLFragment
}
images {
... ImageFragment
}
}
fragment PerformerFragment on Performer { fragment PerformerFragment on Performer {
id id
name name
@ -260,6 +274,10 @@ fragment PerformerFragment on Performer {
... BodyModificationFragment ... BodyModificationFragment
} }
} }
fragment FuzzyDateFragment on FuzzyDate {
date
accuracy
}
fragment MeasurementsFragment on Measurements { fragment MeasurementsFragment on Measurements {
band_size band_size
cup_size cup_size
@ -270,28 +288,6 @@ fragment BodyModificationFragment on BodyModification {
location location
description description
} }
fragment URLFragment on URL {
url
type
}
fragment StudioFragment on Studio {
name
id
urls {
... URLFragment
}
images {
... ImageFragment
}
}
fragment TagFragment on Tag {
name
id
}
fragment FuzzyDateFragment on FuzzyDate {
date
accuracy
}
fragment FingerprintFragment on Fingerprint { fragment FingerprintFragment on Fingerprint {
algorithm algorithm
hash hash
@ -328,6 +324,10 @@ fragment ImageFragment on Image {
width width
height height
} }
fragment TagFragment on Tag {
name
id
}
fragment PerformerAppearanceFragment on PerformerAppearance { fragment PerformerAppearanceFragment on PerformerAppearance {
as as
performer { performer {
@ -354,34 +354,19 @@ const FindScenesByFullFingerprintsDocument = `query FindScenesByFullFingerprints
... SceneFragment ... SceneFragment
} }
} }
fragment SceneFragment on Scene { fragment URLFragment on URL {
url
type
}
fragment StudioFragment on Studio {
name
id id
title
details
duration
date
urls { urls {
... URLFragment ... URLFragment
} }
images { images {
... ImageFragment ... ImageFragment
} }
studio {
... StudioFragment
}
tags {
... TagFragment
}
performers {
... PerformerAppearanceFragment
}
fingerprints {
... FingerprintFragment
}
}
fragment URLFragment on URL {
url
type
} }
fragment PerformerAppearanceFragment on PerformerAppearance { fragment PerformerAppearanceFragment on PerformerAppearance {
as as
@ -427,6 +412,35 @@ fragment FuzzyDateFragment on FuzzyDate {
date date
accuracy accuracy
} }
fragment SceneFragment on Scene {
id
title
details
duration
date
urls {
... URLFragment
}
images {
... ImageFragment
}
studio {
... StudioFragment
}
tags {
... TagFragment
}
performers {
... PerformerAppearanceFragment
}
fingerprints {
... FingerprintFragment
}
}
fragment TagFragment on Tag {
name
id
}
fragment MeasurementsFragment on Measurements { fragment MeasurementsFragment on Measurements {
band_size band_size
cup_size cup_size
@ -448,20 +462,6 @@ fragment ImageFragment on Image {
width width
height height
} }
fragment StudioFragment on Studio {
name
id
urls {
... URLFragment
}
images {
... ImageFragment
}
}
fragment TagFragment on Tag {
name
id
}
` `
func (c *Client) FindScenesByFullFingerprints(ctx context.Context, fingerprints []*FingerprintQueryInput, httpRequestOptions ...client.HTTPRequestOption) (*FindScenesByFullFingerprints, error) { func (c *Client) FindScenesByFullFingerprints(ctx context.Context, fingerprints []*FingerprintQueryInput, httpRequestOptions ...client.HTTPRequestOption) (*FindScenesByFullFingerprints, error) {
@ -486,15 +486,69 @@ fragment URLFragment on URL {
url url
type type
} }
fragment TagFragment on Tag {
name
id
}
fragment FuzzyDateFragment on FuzzyDate {
date
accuracy
}
fragment MeasurementsFragment on Measurements {
band_size
cup_size
waist
hip
}
fragment BodyModificationFragment on BodyModification {
location
description
}
fragment FingerprintFragment on Fingerprint {
algorithm
hash
duration
}
fragment SceneFragment on Scene {
id
title
details
duration
date
urls {
... URLFragment
}
images {
... ImageFragment
}
studio {
... StudioFragment
}
tags {
... TagFragment
}
performers {
... PerformerAppearanceFragment
}
fingerprints {
... FingerprintFragment
}
}
fragment ImageFragment on Image { fragment ImageFragment on Image {
id id
url url
width width
height height
} }
fragment TagFragment on Tag { fragment StudioFragment on Studio {
name name
id id
urls {
... URLFragment
}
images {
... ImageFragment
}
} }
fragment PerformerAppearanceFragment on PerformerAppearance { fragment PerformerAppearanceFragment on PerformerAppearance {
as as
@ -536,60 +590,6 @@ fragment PerformerFragment on Performer {
... BodyModificationFragment ... BodyModificationFragment
} }
} }
fragment FuzzyDateFragment on FuzzyDate {
date
accuracy
}
fragment FingerprintFragment on Fingerprint {
algorithm
hash
duration
}
fragment SceneFragment on Scene {
id
title
details
duration
date
urls {
... URLFragment
}
images {
... ImageFragment
}
studio {
... StudioFragment
}
tags {
... TagFragment
}
performers {
... PerformerAppearanceFragment
}
fingerprints {
... FingerprintFragment
}
}
fragment StudioFragment on Studio {
name
id
urls {
... URLFragment
}
images {
... ImageFragment
}
}
fragment MeasurementsFragment on Measurements {
band_size
cup_size
waist
hip
}
fragment BodyModificationFragment on BodyModification {
location
description
}
` `
func (c *Client) SearchScene(ctx context.Context, term string, httpRequestOptions ...client.HTTPRequestOption) (*SearchScene, error) { func (c *Client) SearchScene(ctx context.Context, term string, httpRequestOptions ...client.HTTPRequestOption) (*SearchScene, error) {
@ -688,6 +688,10 @@ const FindPerformerByIDDocument = `query FindPerformerByID ($id: ID!) {
... PerformerFragment ... PerformerFragment
} }
} }
fragment BodyModificationFragment on BodyModification {
location
description
}
fragment PerformerFragment on Performer { fragment PerformerFragment on Performer {
id id
name name
@ -742,10 +746,6 @@ fragment MeasurementsFragment on Measurements {
waist waist
hip hip
} }
fragment BodyModificationFragment on BodyModification {
location
description
}
` `
func (c *Client) FindPerformerByID(ctx context.Context, id string, httpRequestOptions ...client.HTTPRequestOption) (*FindPerformerByID, error) { func (c *Client) FindPerformerByID(ctx context.Context, id string, httpRequestOptions ...client.HTTPRequestOption) (*FindPerformerByID, error) {
@ -766,18 +766,6 @@ const FindSceneByIDDocument = `query FindSceneByID ($id: ID!) {
... SceneFragment ... SceneFragment
} }
} }
fragment ImageFragment on Image {
id
url
width
height
}
fragment PerformerAppearanceFragment on PerformerAppearance {
as
performer {
... PerformerFragment
}
}
fragment PerformerFragment on Performer { fragment PerformerFragment on Performer {
id id
name name
@ -812,14 +800,44 @@ fragment PerformerFragment on Performer {
... BodyModificationFragment ... BodyModificationFragment
} }
} }
fragment FuzzyDateFragment on FuzzyDate { fragment MeasurementsFragment on Measurements {
date band_size
accuracy cup_size
waist
hip
} }
fragment BodyModificationFragment on BodyModification { fragment BodyModificationFragment on BodyModification {
location location
description description
} }
fragment URLFragment on URL {
url
type
}
fragment StudioFragment on Studio {
name
id
urls {
... URLFragment
}
images {
... ImageFragment
}
}
fragment TagFragment on Tag {
name
id
}
fragment PerformerAppearanceFragment on PerformerAppearance {
as
performer {
... PerformerFragment
}
}
fragment FuzzyDateFragment on FuzzyDate {
date
accuracy
}
fragment FingerprintFragment on Fingerprint { fragment FingerprintFragment on Fingerprint {
algorithm algorithm
hash hash
@ -850,29 +868,11 @@ fragment SceneFragment on Scene {
... FingerprintFragment ... FingerprintFragment
} }
} }
fragment URLFragment on URL { fragment ImageFragment on Image {
id
url url
type width
} height
fragment StudioFragment on Studio {
name
id
urls {
... URLFragment
}
images {
... ImageFragment
}
}
fragment TagFragment on Tag {
name
id
}
fragment MeasurementsFragment on Measurements {
band_size
cup_size
waist
hip
} }
` `

View file

@ -88,8 +88,8 @@ type DraftEntity struct {
ID *string `json:"id,omitempty"` ID *string `json:"id,omitempty"`
} }
func (DraftEntity) IsSceneDraftStudio() {}
func (DraftEntity) IsSceneDraftPerformer() {} func (DraftEntity) IsSceneDraftPerformer() {}
func (DraftEntity) IsSceneDraftStudio() {}
func (DraftEntity) IsSceneDraftTag() {} func (DraftEntity) IsSceneDraftTag() {}
type DraftEntityInput struct { type DraftEntityInput struct {
@ -348,8 +348,8 @@ type Performer struct {
Updated time.Time `json:"updated"` Updated time.Time `json:"updated"`
} }
func (Performer) IsEditTarget() {}
func (Performer) IsSceneDraftPerformer() {} func (Performer) IsSceneDraftPerformer() {}
func (Performer) IsEditTarget() {}
type PerformerAppearance struct { type PerformerAppearance struct {
Performer *Performer `json:"performer,omitempty"` Performer *Performer `json:"performer,omitempty"`
@ -681,18 +681,6 @@ type SceneDraft struct {
func (SceneDraft) IsDraftData() {} func (SceneDraft) IsDraftData() {}
type SceneDraftInput struct {
Title *string `json:"title,omitempty"`
Details *string `json:"details,omitempty"`
URL *string `json:"url,omitempty"`
Date *string `json:"date,omitempty"`
Studio *DraftEntityInput `json:"studio,omitempty"`
Performers []*DraftEntityInput `json:"performers,omitempty"`
Tags []*DraftEntityInput `json:"tags,omitempty"`
Image *graphql.Upload `json:"image,omitempty"`
Fingerprints []*FingerprintInput `json:"fingerprints,omitempty"`
}
type SceneEdit struct { type SceneEdit struct {
Title *string `json:"title,omitempty"` Title *string `json:"title,omitempty"`
Details *string `json:"details,omitempty"` Details *string `json:"details,omitempty"`
@ -845,8 +833,8 @@ type Studio struct {
Updated time.Time `json:"updated"` Updated time.Time `json:"updated"`
} }
func (Studio) IsEditTarget() {}
func (Studio) IsSceneDraftStudio() {} func (Studio) IsSceneDraftStudio() {}
func (Studio) IsEditTarget() {}
type StudioCreateInput struct { type StudioCreateInput struct {
Name string `json:"name"` Name string `json:"name"`
@ -921,8 +909,8 @@ type Tag struct {
Updated time.Time `json:"updated"` Updated time.Time `json:"updated"`
} }
func (Tag) IsEditTarget() {}
func (Tag) IsSceneDraftTag() {} func (Tag) IsSceneDraftTag() {}
func (Tag) IsEditTarget() {}
type TagCategory struct { type TagCategory struct {
ID string `json:"id"` ID string `json:"id"`

View file

@ -0,0 +1,17 @@
package graphql
import "github.com/99designs/gqlgen/graphql"
// Override for generated struct due to mistaken omitempty
// https://github.com/Yamashou/gqlgenc/issues/77
type SceneDraftInput struct {
Title *string `json:"title,omitempty"`
Details *string `json:"details,omitempty"`
URL *string `json:"url,omitempty"`
Date *string `json:"date,omitempty"`
Studio *DraftEntityInput `json:"studio,omitempty"`
Performers []*DraftEntityInput `json:"performers"`
Tags []*DraftEntityInput `json:"tags,omitempty"`
Image *graphql.Upload `json:"image,omitempty"`
Fingerprints []*FingerprintInput `json:"fingerprints"`
}

View file

@ -1,2 +1,3 @@
### 🐛 Bug fixes ### 🐛 Bug fixes
* Fix error when submitting scene draft to stash-box without performers. ([#2515](https://github.com/stashapp/stash/pull/2515))
* Fix incorrect video player positioning on touch-enabled devices. ([#2501](https://github.com/stashapp/stash/issues/2501)) * Fix incorrect video player positioning on touch-enabled devices. ([#2501](https://github.com/stashapp/stash/issues/2501))