diff --git a/server/gql/storytelling.graphql b/server/gql/storytelling.graphql index 267193020..a5bc71c2a 100644 --- a/server/gql/storytelling.graphql +++ b/server/gql/storytelling.graphql @@ -12,6 +12,7 @@ type Story implements Node { sceneId: ID! scene: Scene panelPosition: Position! + bgColor: String isBasicAuthActive: Boolean! basicAuthUsername: String! @@ -68,6 +69,7 @@ input UpdateStoryInput { title: String index: Int panelPosition: Position + bgColor: String # publishment isBasicAuthActive: Boolean diff --git a/server/internal/adapter/gql/generated.go b/server/internal/adapter/gql/generated.go index e12083b85..9c933cb06 100644 --- a/server/internal/adapter/gql/generated.go +++ b/server/internal/adapter/gql/generated.go @@ -1022,6 +1022,7 @@ type ComplexityRoot struct { Alias func(childComplexity int) int BasicAuthPassword func(childComplexity int) int BasicAuthUsername func(childComplexity int) int + BgColor func(childComplexity int) int CreatedAt func(childComplexity int) int ID func(childComplexity int) int IsBasicAuthActive func(childComplexity int) int @@ -6467,6 +6468,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Story.BasicAuthUsername(childComplexity), true + case "Story.bgColor": + if e.complexity.Story.BgColor == nil { + break + } + + return e.complexity.Story.BgColor(childComplexity), true + case "Story.createdAt": if e.complexity.Story.CreatedAt == nil { break @@ -8988,6 +8996,7 @@ extend type Mutation { sceneId: ID! scene: Scene panelPosition: Position! + bgColor: String isBasicAuthActive: Boolean! basicAuthUsername: String! @@ -9044,6 +9053,7 @@ input UpdateStoryInput { title: String index: Int panelPosition: Position + bgColor: String # publishment isBasicAuthActive: Boolean @@ -14493,6 +14503,8 @@ func (ec *executionContext) fieldContext_CreateStoryBlockPayload_story(ctx conte return ec.fieldContext_Story_scene(ctx, field) case "panelPosition": return ec.fieldContext_Story_panelPosition(ctx, field) + case "bgColor": + return ec.fieldContext_Story_bgColor(ctx, field) case "isBasicAuthActive": return ec.fieldContext_Story_isBasicAuthActive(ctx, field) case "basicAuthUsername": @@ -17294,6 +17306,8 @@ func (ec *executionContext) fieldContext_DeleteStoryPagePayload_story(ctx contex return ec.fieldContext_Story_scene(ctx, field) case "panelPosition": return ec.fieldContext_Story_panelPosition(ctx, field) + case "bgColor": + return ec.fieldContext_Story_bgColor(ctx, field) case "isBasicAuthActive": return ec.fieldContext_Story_isBasicAuthActive(ctx, field) case "basicAuthUsername": @@ -25730,6 +25744,8 @@ func (ec *executionContext) fieldContext_MoveStoryBlockPayload_story(ctx context return ec.fieldContext_Story_scene(ctx, field) case "panelPosition": return ec.fieldContext_Story_panelPosition(ctx, field) + case "bgColor": + return ec.fieldContext_Story_bgColor(ctx, field) case "isBasicAuthActive": return ec.fieldContext_Story_isBasicAuthActive(ctx, field) case "basicAuthUsername": @@ -25976,6 +25992,8 @@ func (ec *executionContext) fieldContext_MoveStoryPagePayload_story(ctx context. return ec.fieldContext_Story_scene(ctx, field) case "panelPosition": return ec.fieldContext_Story_panelPosition(ctx, field) + case "bgColor": + return ec.fieldContext_Story_bgColor(ctx, field) case "isBasicAuthActive": return ec.fieldContext_Story_isBasicAuthActive(ctx, field) case "basicAuthUsername": @@ -26194,6 +26212,8 @@ func (ec *executionContext) fieldContext_MoveStoryPayload_stories(ctx context.Co return ec.fieldContext_Story_scene(ctx, field) case "panelPosition": return ec.fieldContext_Story_panelPosition(ctx, field) + case "bgColor": + return ec.fieldContext_Story_bgColor(ctx, field) case "isBasicAuthActive": return ec.fieldContext_Story_isBasicAuthActive(ctx, field) case "basicAuthUsername": @@ -42050,6 +42070,8 @@ func (ec *executionContext) fieldContext_RemoveStoryBlockPayload_story(ctx conte return ec.fieldContext_Story_scene(ctx, field) case "panelPosition": return ec.fieldContext_Story_panelPosition(ctx, field) + case "bgColor": + return ec.fieldContext_Story_bgColor(ctx, field) case "isBasicAuthActive": return ec.fieldContext_Story_isBasicAuthActive(ctx, field) case "basicAuthUsername": @@ -43203,6 +43225,8 @@ func (ec *executionContext) fieldContext_Scene_stories(ctx context.Context, fiel return ec.fieldContext_Story_scene(ctx, field) case "panelPosition": return ec.fieldContext_Story_panelPosition(ctx, field) + case "bgColor": + return ec.fieldContext_Story_bgColor(ctx, field) case "isBasicAuthActive": return ec.fieldContext_Story_isBasicAuthActive(ctx, field) case "basicAuthUsername": @@ -45112,6 +45136,47 @@ func (ec *executionContext) fieldContext_Story_panelPosition(ctx context.Context return fc, nil } +func (ec *executionContext) _Story_bgColor(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.Story) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Story_bgColor(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.BgColor, 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_Story_bgColor(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Story", + 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) _Story_isBasicAuthActive(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.Story) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Story_isBasicAuthActive(ctx, field) if err != nil { @@ -46617,6 +46682,8 @@ func (ec *executionContext) fieldContext_StoryPagePayload_story(ctx context.Cont return ec.fieldContext_Story_scene(ctx, field) case "panelPosition": return ec.fieldContext_Story_panelPosition(ctx, field) + case "bgColor": + return ec.fieldContext_Story_bgColor(ctx, field) case "isBasicAuthActive": return ec.fieldContext_Story_isBasicAuthActive(ctx, field) case "basicAuthUsername": @@ -46703,6 +46770,8 @@ func (ec *executionContext) fieldContext_StoryPayload_story(ctx context.Context, return ec.fieldContext_Story_scene(ctx, field) case "panelPosition": return ec.fieldContext_Story_panelPosition(ctx, field) + case "bgColor": + return ec.fieldContext_Story_bgColor(ctx, field) case "isBasicAuthActive": return ec.fieldContext_Story_isBasicAuthActive(ctx, field) case "basicAuthUsername": @@ -57078,7 +57147,7 @@ func (ec *executionContext) unmarshalInputUpdateStoryInput(ctx context.Context, asMap[k] = v } - fieldsInOrder := [...]string{"sceneId", "storyId", "title", "index", "panelPosition", "isBasicAuthActive", "basicAuthUsername", "basicAuthPassword", "alias", "publicTitle", "publicDescription", "publicImage", "publicNoIndex", "deletePublicImage"} + fieldsInOrder := [...]string{"sceneId", "storyId", "title", "index", "panelPosition", "bgColor", "isBasicAuthActive", "basicAuthUsername", "basicAuthPassword", "alias", "publicTitle", "publicDescription", "publicImage", "publicNoIndex", "deletePublicImage"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -57125,6 +57194,14 @@ func (ec *executionContext) unmarshalInputUpdateStoryInput(ctx context.Context, if err != nil { return it, err } + case "bgColor": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("bgColor")) + it.BgColor, err = ec.unmarshalOString2áš–string(ctx, v) + if err != nil { + return it, err + } case "isBasicAuthActive": var err error @@ -65803,6 +65880,10 @@ func (ec *executionContext) _Story(ctx context.Context, sel ast.SelectionSet, ob if out.Values[i] == graphql.Null { atomic.AddUint32(&invalids, 1) } + case "bgColor": + + out.Values[i] = ec._Story_bgColor(ctx, field, obj) + case "isBasicAuthActive": out.Values[i] = ec._Story_isBasicAuthActive(ctx, field, obj) diff --git a/server/internal/adapter/gql/gqlmodel/models_gen.go b/server/internal/adapter/gql/gqlmodel/models_gen.go index eef7a1674..0ffd7f586 100644 --- a/server/internal/adapter/gql/gqlmodel/models_gen.go +++ b/server/internal/adapter/gql/gqlmodel/models_gen.go @@ -1273,6 +1273,7 @@ type Story struct { SceneID ID `json:"sceneId"` Scene *Scene `json:"scene"` PanelPosition Position `json:"panelPosition"` + BgColor *string `json:"bgColor"` IsBasicAuthActive bool `json:"isBasicAuthActive"` BasicAuthUsername string `json:"basicAuthUsername"` BasicAuthPassword string `json:"basicAuthPassword"` @@ -1538,6 +1539,7 @@ type UpdateStoryInput struct { Title *string `json:"title"` Index *int `json:"index"` PanelPosition *Position `json:"panelPosition"` + BgColor *string `json:"bgColor"` IsBasicAuthActive *bool `json:"isBasicAuthActive"` BasicAuthUsername *string `json:"basicAuthUsername"` BasicAuthPassword *string `json:"basicAuthPassword"` diff --git a/server/internal/usecase/interactor/storytelling.go b/server/internal/usecase/interactor/storytelling.go index 9102f4421..fc4ce39d6 100644 --- a/server/internal/usecase/interactor/storytelling.go +++ b/server/internal/usecase/interactor/storytelling.go @@ -170,6 +170,10 @@ func (i *Storytelling) Update(ctx context.Context, inp interfaces.UpdateStoryInp story.SetPanelPosition(*inp.PanelPosition) } + if inp.BgColor != nil { + story.SetBgColor(*inp.BgColor) + } + oldAlias := story.Alias() if inp.Alias != nil && *inp.Alias != oldAlias { if err := story.UpdateAlias(*inp.Alias); err != nil { diff --git a/server/internal/usecase/interfaces/story.go b/server/internal/usecase/interfaces/story.go index b7671a18a..a6529bb8e 100644 --- a/server/internal/usecase/interfaces/story.go +++ b/server/internal/usecase/interfaces/story.go @@ -23,6 +23,7 @@ type UpdateStoryInput struct { Title *string Index *int PanelPosition *storytelling.Position + BgColor *string IsBasicAuthActive *bool BasicAuthUsername *string diff --git a/server/pkg/storytelling/story.go b/server/pkg/storytelling/story.go index 896669f8f..a918951a6 100644 --- a/server/pkg/storytelling/story.go +++ b/server/pkg/storytelling/story.go @@ -24,6 +24,7 @@ type Story struct { title string pages *PageList panelPosition Position + bgColor string updatedAt time.Time alias string @@ -116,6 +117,10 @@ func (s *Story) SetPanelPosition(panelPosition Position) { s.panelPosition = panelPosition } +func (s *Story) SetBgColor(bgColor string) { + s.bgColor = bgColor +} + func (s *Story) Rename(name string) { s.title = name s.updatedAt = util.Now()