diff --git a/frontend/src/graphql/mutations/AddScene.gql b/frontend/src/graphql/mutations/AddScene.gql index 40a2cb81c..6b6b1e99d 100644 --- a/frontend/src/graphql/mutations/AddScene.gql +++ b/frontend/src/graphql/mutations/AddScene.gql @@ -3,7 +3,9 @@ mutation AddScene($sceneData: SceneCreateInput!) { id release_date title + code details + director urls { url site { diff --git a/frontend/src/graphql/queries/Draft.gql b/frontend/src/graphql/queries/Draft.gql index 1f12120d2..357d8c1b4 100644 --- a/frontend/src/graphql/queries/Draft.gql +++ b/frontend/src/graphql/queries/Draft.gql @@ -34,7 +34,9 @@ query Draft($id: ID!) { ... on SceneDraft { id title + code details + director date url { ...URLFragment diff --git a/frontend/src/graphql/types.ts b/frontend/src/graphql/types.ts index f41c885c8..422b45f94 100644 --- a/frontend/src/graphql/types.ts +++ b/frontend/src/graphql/types.ts @@ -1291,8 +1291,10 @@ export type SceneDestroyInput = { export type SceneDraft = { __typename: "SceneDraft"; + code?: Maybe; date?: Maybe; details?: Maybe; + director?: Maybe; fingerprints: Array; id?: Maybe; image?: Maybe; @@ -1304,8 +1306,10 @@ export type SceneDraft = { }; export type SceneDraftInput = { + code?: InputMaybe; date?: InputMaybe; details?: InputMaybe; + director?: InputMaybe; fingerprints: Array; id?: InputMaybe; image?: InputMaybe; @@ -3044,7 +3048,9 @@ export type AddSceneMutation = { id: string; release_date?: string | null; title?: string | null; + code?: string | null; details?: string | null; + director?: string | null; urls: Array<{ __typename: "URL"; url: string; @@ -13859,7 +13865,9 @@ export type DraftQuery = { __typename: "SceneDraft"; id?: string | null; title?: string | null; + code?: string | null; details?: string | null; + director?: string | null; date?: string | null; url?: { __typename: "URL"; diff --git a/frontend/src/pages/drafts/parse.ts b/frontend/src/pages/drafts/parse.ts index c0cc5029a..70b99b48e 100644 --- a/frontend/src/pages/drafts/parse.ts +++ b/frontend/src/pages/drafts/parse.ts @@ -69,8 +69,8 @@ export const parseSceneDraft = ( details: draft.details, urls: joinURLs(draft.url, existingScene?.urls), studio: draft.studio?.__typename === "Studio" ? draft.studio : null, - director: null, - code: null, + director: draft.director, + code: draft.code, duration: draft.fingerprints?.[0]?.duration ?? null, images: draft.image ? [draft.image] : existingScene?.images, tags: joinTags( diff --git a/graphql/schema/types/scene.graphql b/graphql/schema/types/scene.graphql index 9c47ea7fd..b1c2776a2 100644 --- a/graphql/schema/types/scene.graphql +++ b/graphql/schema/types/scene.graphql @@ -223,7 +223,9 @@ union SceneDraftTag = Tag | DraftEntity type SceneDraft { id: ID title: String + code: String details: String + director: String url: URL date: String studio: SceneDraftStudio @@ -236,7 +238,9 @@ type SceneDraft { input SceneDraftInput { id: ID title: String + code: String details: String + director: String url: String date: String studio: DraftEntityInput diff --git a/main.go b/main.go index 7b9453fc5..2972fb5bf 100644 --- a/main.go +++ b/main.go @@ -13,7 +13,8 @@ import ( "github.com/stashapp/stash-box/pkg/user" ) -//nolint +// nolint +// //go:embed frontend/build var ui embed.FS diff --git a/pkg/api/resolver_mutation_draft.go b/pkg/api/resolver_mutation_draft.go index 2df3c5a05..bb10ce7f9 100644 --- a/pkg/api/resolver_mutation_draft.go +++ b/pkg/api/resolver_mutation_draft.go @@ -23,7 +23,9 @@ func (r *mutationResolver) SubmitSceneDraft(ctx context.Context, input models.Sc data := models.SceneDraft{ ID: input.ID, Title: input.Title, + Code: input.Code, Details: input.Details, + Director: input.Director, URL: input.URL, Date: input.Date, Studio: translateDraftEntity(input.Studio), diff --git a/pkg/models/generated_exec.go b/pkg/models/generated_exec.go index d5b513802..fb61cf3ee 100644 --- a/pkg/models/generated_exec.go +++ b/pkg/models/generated_exec.go @@ -420,8 +420,10 @@ type ComplexityRoot struct { } SceneDraft struct { + Code func(childComplexity int) int Date func(childComplexity int) int Details func(childComplexity int) int + Director func(childComplexity int) int Fingerprints func(childComplexity int) int ID func(childComplexity int) int Image func(childComplexity int) int @@ -3063,6 +3065,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Scene.Urls(childComplexity), true + case "SceneDraft.code": + if e.complexity.SceneDraft.Code == nil { + break + } + + return e.complexity.SceneDraft.Code(childComplexity), true + case "SceneDraft.date": if e.complexity.SceneDraft.Date == nil { break @@ -3077,6 +3086,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.SceneDraft.Details(childComplexity), true + case "SceneDraft.director": + if e.complexity.SceneDraft.Director == nil { + break + } + + return e.complexity.SceneDraft.Director(childComplexity), true + case "SceneDraft.fingerprints": if e.complexity.SceneDraft.Fingerprints == nil { break @@ -4913,7 +4929,9 @@ union SceneDraftTag = Tag | DraftEntity type SceneDraft { id: ID title: String + code: String details: String + director: String url: URL date: String studio: SceneDraftStudio @@ -4926,7 +4944,9 @@ type SceneDraft { input SceneDraftInput { id: ID title: String + code: String details: String + director: String url: String date: String studio: DraftEntityInput @@ -22888,6 +22908,47 @@ func (ec *executionContext) fieldContext_SceneDraft_title(ctx context.Context, f return fc, nil } +func (ec *executionContext) _SceneDraft_code(ctx context.Context, field graphql.CollectedField, obj *SceneDraft) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SceneDraft_code(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Code, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_SceneDraft_code(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "SceneDraft", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + func (ec *executionContext) _SceneDraft_details(ctx context.Context, field graphql.CollectedField, obj *SceneDraft) (ret graphql.Marshaler) { fc, err := ec.fieldContext_SceneDraft_details(ctx, field) if err != nil { @@ -22929,6 +22990,47 @@ func (ec *executionContext) fieldContext_SceneDraft_details(ctx context.Context, return fc, nil } +func (ec *executionContext) _SceneDraft_director(ctx context.Context, field graphql.CollectedField, obj *SceneDraft) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SceneDraft_director(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Director, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_SceneDraft_director(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "SceneDraft", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + func (ec *executionContext) _SceneDraft_url(ctx context.Context, field graphql.CollectedField, obj *SceneDraft) (ret graphql.Marshaler) { fc, err := ec.fieldContext_SceneDraft_url(ctx, field) if err != nil { @@ -32812,7 +32914,7 @@ func (ec *executionContext) unmarshalInputSceneDraftInput(ctx context.Context, o asMap[k] = v } - fieldsInOrder := [...]string{"id", "title", "details", "url", "date", "studio", "performers", "tags", "image", "fingerprints"} + fieldsInOrder := [...]string{"id", "title", "code", "details", "director", "url", "date", "studio", "performers", "tags", "image", "fingerprints"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -32835,6 +32937,14 @@ func (ec *executionContext) unmarshalInputSceneDraftInput(ctx context.Context, o if err != nil { return it, err } + case "code": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("code")) + it.Code, err = ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } case "details": var err error @@ -32843,6 +32953,14 @@ func (ec *executionContext) unmarshalInputSceneDraftInput(ctx context.Context, o if err != nil { return it, err } + case "director": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("director")) + it.Director, err = ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } case "url": var err error @@ -38767,10 +38885,18 @@ func (ec *executionContext) _SceneDraft(ctx context.Context, sel ast.SelectionSe out.Values[i] = ec._SceneDraft_title(ctx, field, obj) + case "code": + + out.Values[i] = ec._SceneDraft_code(ctx, field, obj) + case "details": out.Values[i] = ec._SceneDraft_details(ctx, field, obj) + case "director": + + out.Values[i] = ec._SceneDraft_director(ctx, field, obj) + case "url": field := field diff --git a/pkg/models/generated_models.go b/pkg/models/generated_models.go index 3493859a9..ee4ea421a 100644 --- a/pkg/models/generated_models.go +++ b/pkg/models/generated_models.go @@ -466,7 +466,9 @@ type SceneDestroyInput struct { type SceneDraftInput struct { ID *uuid.UUID `json:"id"` Title *string `json:"title"` + Code *string `json:"code"` Details *string `json:"details"` + Director *string `json:"director"` URL *string `json:"url"` Date *string `json:"date"` Studio *DraftEntityInput `json:"studio"` diff --git a/pkg/models/model_draft.go b/pkg/models/model_draft.go index 9dec91d4c..b0a44f4b4 100644 --- a/pkg/models/model_draft.go +++ b/pkg/models/model_draft.go @@ -29,7 +29,9 @@ func (DraftEntity) IsSceneDraftStudio() {} type SceneDraft struct { ID *uuid.UUID `json:"id,omitempty"` Title *string `json:"title,omitempty"` + Code *string `json:"code,omitempty"` Details *string `json:"details,omitempty"` + Director *string `json:"director,omitempty"` URL *string `json:"url,omitempty"` Date *string `json:"date,omitempty"` Studio *DraftEntity `json:"studio,omitempty"`