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:
Date:
model: github.com/99designs/gqlgen/graphql.String
SceneDraftInput:
model: github.com/stashapp/stash/pkg/scraper/stashbox/graphql.SceneDraftInput
endpoint:
# This points to stashdb.org currently, but can be directed at any stash-box
# instance. It is used for generation only.

View file

@ -226,6 +226,20 @@ const FindSceneByFingerprintDocument = `query FindSceneByFingerprint ($fingerpri
... SceneFragment
}
}
fragment URLFragment on URL {
url
type
}
fragment StudioFragment on Studio {
name
id
urls {
... URLFragment
}
images {
... ImageFragment
}
}
fragment PerformerFragment on Performer {
id
name
@ -260,6 +274,10 @@ fragment PerformerFragment on Performer {
... BodyModificationFragment
}
}
fragment FuzzyDateFragment on FuzzyDate {
date
accuracy
}
fragment MeasurementsFragment on Measurements {
band_size
cup_size
@ -270,28 +288,6 @@ fragment BodyModificationFragment on BodyModification {
location
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 {
algorithm
hash
@ -328,6 +324,10 @@ fragment ImageFragment on Image {
width
height
}
fragment TagFragment on Tag {
name
id
}
fragment PerformerAppearanceFragment on PerformerAppearance {
as
performer {
@ -354,34 +354,19 @@ const FindScenesByFullFingerprintsDocument = `query FindScenesByFullFingerprints
... SceneFragment
}
}
fragment SceneFragment on Scene {
fragment URLFragment on URL {
url
type
}
fragment StudioFragment on Studio {
name
id
title
details
duration
date
urls {
... URLFragment
}
images {
... ImageFragment
}
studio {
... StudioFragment
}
tags {
... TagFragment
}
performers {
... PerformerAppearanceFragment
}
fingerprints {
... FingerprintFragment
}
}
fragment URLFragment on URL {
url
type
}
fragment PerformerAppearanceFragment on PerformerAppearance {
as
@ -427,6 +412,35 @@ fragment FuzzyDateFragment on FuzzyDate {
date
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 {
band_size
cup_size
@ -448,20 +462,6 @@ fragment ImageFragment on Image {
width
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) {
@ -486,15 +486,69 @@ fragment URLFragment on URL {
url
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 {
id
url
width
height
}
fragment TagFragment on Tag {
fragment StudioFragment on Studio {
name
id
urls {
... URLFragment
}
images {
... ImageFragment
}
}
fragment PerformerAppearanceFragment on PerformerAppearance {
as
@ -536,60 +590,6 @@ fragment PerformerFragment on Performer {
... 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) {
@ -688,6 +688,10 @@ const FindPerformerByIDDocument = `query FindPerformerByID ($id: ID!) {
... PerformerFragment
}
}
fragment BodyModificationFragment on BodyModification {
location
description
}
fragment PerformerFragment on Performer {
id
name
@ -742,10 +746,6 @@ fragment MeasurementsFragment on Measurements {
waist
hip
}
fragment BodyModificationFragment on BodyModification {
location
description
}
`
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
}
}
fragment ImageFragment on Image {
id
url
width
height
}
fragment PerformerAppearanceFragment on PerformerAppearance {
as
performer {
... PerformerFragment
}
}
fragment PerformerFragment on Performer {
id
name
@ -812,14 +800,44 @@ fragment PerformerFragment on Performer {
... BodyModificationFragment
}
}
fragment FuzzyDateFragment on FuzzyDate {
date
accuracy
fragment MeasurementsFragment on Measurements {
band_size
cup_size
waist
hip
}
fragment BodyModificationFragment on BodyModification {
location
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 {
algorithm
hash
@ -850,29 +868,11 @@ fragment SceneFragment on Scene {
... FingerprintFragment
}
}
fragment URLFragment on URL {
fragment ImageFragment on Image {
id
url
type
}
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
width
height
}
`

View file

@ -88,8 +88,8 @@ type DraftEntity struct {
ID *string `json:"id,omitempty"`
}
func (DraftEntity) IsSceneDraftStudio() {}
func (DraftEntity) IsSceneDraftPerformer() {}
func (DraftEntity) IsSceneDraftStudio() {}
func (DraftEntity) IsSceneDraftTag() {}
type DraftEntityInput struct {
@ -348,8 +348,8 @@ type Performer struct {
Updated time.Time `json:"updated"`
}
func (Performer) IsEditTarget() {}
func (Performer) IsSceneDraftPerformer() {}
func (Performer) IsEditTarget() {}
type PerformerAppearance struct {
Performer *Performer `json:"performer,omitempty"`
@ -681,18 +681,6 @@ type SceneDraft struct {
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 {
Title *string `json:"title,omitempty"`
Details *string `json:"details,omitempty"`
@ -845,8 +833,8 @@ type Studio struct {
Updated time.Time `json:"updated"`
}
func (Studio) IsEditTarget() {}
func (Studio) IsSceneDraftStudio() {}
func (Studio) IsEditTarget() {}
type StudioCreateInput struct {
Name string `json:"name"`
@ -921,8 +909,8 @@ type Tag struct {
Updated time.Time `json:"updated"`
}
func (Tag) IsEditTarget() {}
func (Tag) IsSceneDraftTag() {}
func (Tag) IsEditTarget() {}
type TagCategory struct {
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
* 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))