diff --git a/server/gql/storytelling.graphql b/server/gql/storytelling.graphql index d5cd4b4421..2671930201 100644 --- a/server/gql/storytelling.graphql +++ b/server/gql/storytelling.graphql @@ -11,6 +11,15 @@ type Story implements Node { publishedAt: DateTime sceneId: ID! scene: Scene + panelPosition: Position! + + isBasicAuthActive: Boolean! + basicAuthUsername: String! + basicAuthPassword: String! + publicTitle: String! + publicDescription: String! + publicImage: String! + publicNoIndex: Boolean! } type StoryPage implements Node { @@ -40,6 +49,11 @@ type StoryBlock implements Node { linkedDatasetId: ID } +enum Position { + LEFT + RIGHT +} + # InputType input CreateStoryInput { @@ -53,6 +67,18 @@ input UpdateStoryInput { storyId: ID! title: String index: Int + panelPosition: Position + +# publishment + isBasicAuthActive: Boolean + basicAuthUsername: String + basicAuthPassword: String + alias: String + publicTitle: String + publicDescription: String + publicImage: String + publicNoIndex: Boolean + deletePublicImage: Boolean } input MoveStoryInput { diff --git a/server/internal/adapter/gql/generated.go b/server/internal/adapter/gql/generated.go index 7c7b4c3ef9..00d54a1eb5 100644 --- a/server/internal/adapter/gql/generated.go +++ b/server/internal/adapter/gql/generated.go @@ -966,11 +966,19 @@ type ComplexityRoot struct { Story struct { Alias func(childComplexity int) int + BasicAuthPassword func(childComplexity int) int + BasicAuthUsername func(childComplexity int) int CreatedAt func(childComplexity int) int ID func(childComplexity int) int + IsBasicAuthActive func(childComplexity int) int Pages func(childComplexity int) int + PanelPosition func(childComplexity int) int Property func(childComplexity int) int PropertyID func(childComplexity int) int + PublicDescription func(childComplexity int) int + PublicImage func(childComplexity int) int + PublicNoIndex func(childComplexity int) int + PublicTitle func(childComplexity int) int PublishedAt func(childComplexity int) int PublishmentStatus func(childComplexity int) int Scene func(childComplexity int) int @@ -6091,6 +6099,20 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Story.Alias(childComplexity), true + case "Story.basicAuthPassword": + if e.complexity.Story.BasicAuthPassword == nil { + break + } + + return e.complexity.Story.BasicAuthPassword(childComplexity), true + + case "Story.basicAuthUsername": + if e.complexity.Story.BasicAuthUsername == nil { + break + } + + return e.complexity.Story.BasicAuthUsername(childComplexity), true + case "Story.createdAt": if e.complexity.Story.CreatedAt == nil { break @@ -6105,6 +6127,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Story.ID(childComplexity), true + case "Story.isBasicAuthActive": + if e.complexity.Story.IsBasicAuthActive == nil { + break + } + + return e.complexity.Story.IsBasicAuthActive(childComplexity), true + case "Story.pages": if e.complexity.Story.Pages == nil { break @@ -6112,6 +6141,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Story.Pages(childComplexity), true + case "Story.panelPosition": + if e.complexity.Story.PanelPosition == nil { + break + } + + return e.complexity.Story.PanelPosition(childComplexity), true + case "Story.property": if e.complexity.Story.Property == nil { break @@ -6126,6 +6162,34 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Story.PropertyID(childComplexity), true + case "Story.publicDescription": + if e.complexity.Story.PublicDescription == nil { + break + } + + return e.complexity.Story.PublicDescription(childComplexity), true + + case "Story.publicImage": + if e.complexity.Story.PublicImage == nil { + break + } + + return e.complexity.Story.PublicImage(childComplexity), true + + case "Story.publicNoIndex": + if e.complexity.Story.PublicNoIndex == nil { + break + } + + return e.complexity.Story.PublicNoIndex(childComplexity), true + + case "Story.publicTitle": + if e.complexity.Story.PublicTitle == nil { + break + } + + return e.complexity.Story.PublicTitle(childComplexity), true + case "Story.publishedAt": if e.complexity.Story.PublishedAt == nil { break @@ -8402,6 +8466,15 @@ extend type Mutation { publishedAt: DateTime sceneId: ID! scene: Scene + panelPosition: Position! + + isBasicAuthActive: Boolean! + basicAuthUsername: String! + basicAuthPassword: String! + publicTitle: String! + publicDescription: String! + publicImage: String! + publicNoIndex: Boolean! } type StoryPage implements Node { @@ -8431,6 +8504,11 @@ type StoryBlock implements Node { linkedDatasetId: ID } +enum Position { + LEFT + RIGHT +} + # InputType input CreateStoryInput { @@ -8444,6 +8522,18 @@ input UpdateStoryInput { storyId: ID! title: String index: Int + panelPosition: Position + +# publishment + isBasicAuthActive: Boolean + basicAuthUsername: String + basicAuthPassword: String + alias: String + publicTitle: String + publicDescription: String + publicImage: String + publicNoIndex: Boolean + deletePublicImage: Boolean } input MoveStoryInput { @@ -13607,6 +13697,22 @@ func (ec *executionContext) fieldContext_CreateStoryBlockPayload_story(ctx conte return ec.fieldContext_Story_sceneId(ctx, field) case "scene": return ec.fieldContext_Story_scene(ctx, field) + case "panelPosition": + return ec.fieldContext_Story_panelPosition(ctx, field) + case "isBasicAuthActive": + return ec.fieldContext_Story_isBasicAuthActive(ctx, field) + case "basicAuthUsername": + return ec.fieldContext_Story_basicAuthUsername(ctx, field) + case "basicAuthPassword": + return ec.fieldContext_Story_basicAuthPassword(ctx, field) + case "publicTitle": + return ec.fieldContext_Story_publicTitle(ctx, field) + case "publicDescription": + return ec.fieldContext_Story_publicDescription(ctx, field) + case "publicImage": + return ec.fieldContext_Story_publicImage(ctx, field) + case "publicNoIndex": + return ec.fieldContext_Story_publicNoIndex(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Story", field.Name) }, @@ -16388,6 +16494,22 @@ func (ec *executionContext) fieldContext_DeleteStoryPagePayload_story(ctx contex return ec.fieldContext_Story_sceneId(ctx, field) case "scene": return ec.fieldContext_Story_scene(ctx, field) + case "panelPosition": + return ec.fieldContext_Story_panelPosition(ctx, field) + case "isBasicAuthActive": + return ec.fieldContext_Story_isBasicAuthActive(ctx, field) + case "basicAuthUsername": + return ec.fieldContext_Story_basicAuthUsername(ctx, field) + case "basicAuthPassword": + return ec.fieldContext_Story_basicAuthPassword(ctx, field) + case "publicTitle": + return ec.fieldContext_Story_publicTitle(ctx, field) + case "publicDescription": + return ec.fieldContext_Story_publicDescription(ctx, field) + case "publicImage": + return ec.fieldContext_Story_publicImage(ctx, field) + case "publicNoIndex": + return ec.fieldContext_Story_publicNoIndex(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Story", field.Name) }, @@ -24776,6 +24898,22 @@ func (ec *executionContext) fieldContext_MoveStoryBlockPayload_story(ctx context return ec.fieldContext_Story_sceneId(ctx, field) case "scene": return ec.fieldContext_Story_scene(ctx, field) + case "panelPosition": + return ec.fieldContext_Story_panelPosition(ctx, field) + case "isBasicAuthActive": + return ec.fieldContext_Story_isBasicAuthActive(ctx, field) + case "basicAuthUsername": + return ec.fieldContext_Story_basicAuthUsername(ctx, field) + case "basicAuthPassword": + return ec.fieldContext_Story_basicAuthPassword(ctx, field) + case "publicTitle": + return ec.fieldContext_Story_publicTitle(ctx, field) + case "publicDescription": + return ec.fieldContext_Story_publicDescription(ctx, field) + case "publicImage": + return ec.fieldContext_Story_publicImage(ctx, field) + case "publicNoIndex": + return ec.fieldContext_Story_publicNoIndex(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Story", field.Name) }, @@ -25006,6 +25144,22 @@ func (ec *executionContext) fieldContext_MoveStoryPagePayload_story(ctx context. return ec.fieldContext_Story_sceneId(ctx, field) case "scene": return ec.fieldContext_Story_scene(ctx, field) + case "panelPosition": + return ec.fieldContext_Story_panelPosition(ctx, field) + case "isBasicAuthActive": + return ec.fieldContext_Story_isBasicAuthActive(ctx, field) + case "basicAuthUsername": + return ec.fieldContext_Story_basicAuthUsername(ctx, field) + case "basicAuthPassword": + return ec.fieldContext_Story_basicAuthPassword(ctx, field) + case "publicTitle": + return ec.fieldContext_Story_publicTitle(ctx, field) + case "publicDescription": + return ec.fieldContext_Story_publicDescription(ctx, field) + case "publicImage": + return ec.fieldContext_Story_publicImage(ctx, field) + case "publicNoIndex": + return ec.fieldContext_Story_publicNoIndex(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Story", field.Name) }, @@ -25208,6 +25362,22 @@ func (ec *executionContext) fieldContext_MoveStoryPayload_stories(ctx context.Co return ec.fieldContext_Story_sceneId(ctx, field) case "scene": return ec.fieldContext_Story_scene(ctx, field) + case "panelPosition": + return ec.fieldContext_Story_panelPosition(ctx, field) + case "isBasicAuthActive": + return ec.fieldContext_Story_isBasicAuthActive(ctx, field) + case "basicAuthUsername": + return ec.fieldContext_Story_basicAuthUsername(ctx, field) + case "basicAuthPassword": + return ec.fieldContext_Story_basicAuthPassword(ctx, field) + case "publicTitle": + return ec.fieldContext_Story_publicTitle(ctx, field) + case "publicDescription": + return ec.fieldContext_Story_publicDescription(ctx, field) + case "publicImage": + return ec.fieldContext_Story_publicImage(ctx, field) + case "publicNoIndex": + return ec.fieldContext_Story_publicNoIndex(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Story", field.Name) }, @@ -39602,6 +39772,22 @@ func (ec *executionContext) fieldContext_RemoveStoryBlockPayload_story(ctx conte return ec.fieldContext_Story_sceneId(ctx, field) case "scene": return ec.fieldContext_Story_scene(ctx, field) + case "panelPosition": + return ec.fieldContext_Story_panelPosition(ctx, field) + case "isBasicAuthActive": + return ec.fieldContext_Story_isBasicAuthActive(ctx, field) + case "basicAuthUsername": + return ec.fieldContext_Story_basicAuthUsername(ctx, field) + case "basicAuthPassword": + return ec.fieldContext_Story_basicAuthPassword(ctx, field) + case "publicTitle": + return ec.fieldContext_Story_publicTitle(ctx, field) + case "publicDescription": + return ec.fieldContext_Story_publicDescription(ctx, field) + case "publicImage": + return ec.fieldContext_Story_publicImage(ctx, field) + case "publicNoIndex": + return ec.fieldContext_Story_publicNoIndex(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Story", field.Name) }, @@ -40647,6 +40833,22 @@ func (ec *executionContext) fieldContext_Scene_stories(ctx context.Context, fiel return ec.fieldContext_Story_sceneId(ctx, field) case "scene": return ec.fieldContext_Story_scene(ctx, field) + case "panelPosition": + return ec.fieldContext_Story_panelPosition(ctx, field) + case "isBasicAuthActive": + return ec.fieldContext_Story_isBasicAuthActive(ctx, field) + case "basicAuthUsername": + return ec.fieldContext_Story_basicAuthUsername(ctx, field) + case "basicAuthPassword": + return ec.fieldContext_Story_basicAuthPassword(ctx, field) + case "publicTitle": + return ec.fieldContext_Story_publicTitle(ctx, field) + case "publicDescription": + return ec.fieldContext_Story_publicDescription(ctx, field) + case "publicImage": + return ec.fieldContext_Story_publicImage(ctx, field) + case "publicNoIndex": + return ec.fieldContext_Story_publicNoIndex(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Story", field.Name) }, @@ -42438,6 +42640,358 @@ func (ec *executionContext) fieldContext_Story_scene(ctx context.Context, field return fc, nil } +func (ec *executionContext) _Story_panelPosition(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.Story) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Story_panelPosition(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.PanelPosition, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(gqlmodel.Position) + fc.Result = res + return ec.marshalNPosition2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐPosition(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Story_panelPosition(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 Position 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 { + 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.IsBasicAuthActive, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Story_isBasicAuthActive(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 Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Story_basicAuthUsername(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.Story) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Story_basicAuthUsername(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.BasicAuthUsername, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Story_basicAuthUsername(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_basicAuthPassword(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.Story) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Story_basicAuthPassword(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.BasicAuthPassword, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Story_basicAuthPassword(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_publicTitle(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.Story) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Story_publicTitle(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.PublicTitle, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Story_publicTitle(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_publicDescription(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.Story) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Story_publicDescription(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.PublicDescription, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Story_publicDescription(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_publicImage(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.Story) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Story_publicImage(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.PublicImage, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Story_publicImage(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_publicNoIndex(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.Story) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Story_publicNoIndex(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.PublicNoIndex, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Story_publicNoIndex(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 Boolean does not have child fields") + }, + } + return fc, nil +} + func (ec *executionContext) _StoryBlock_id(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.StoryBlock) (ret graphql.Marshaler) { fc, err := ec.fieldContext_StoryBlock_id(ctx, field) if err != nil { @@ -43629,6 +44183,22 @@ func (ec *executionContext) fieldContext_StoryPagePayload_story(ctx context.Cont return ec.fieldContext_Story_sceneId(ctx, field) case "scene": return ec.fieldContext_Story_scene(ctx, field) + case "panelPosition": + return ec.fieldContext_Story_panelPosition(ctx, field) + case "isBasicAuthActive": + return ec.fieldContext_Story_isBasicAuthActive(ctx, field) + case "basicAuthUsername": + return ec.fieldContext_Story_basicAuthUsername(ctx, field) + case "basicAuthPassword": + return ec.fieldContext_Story_basicAuthPassword(ctx, field) + case "publicTitle": + return ec.fieldContext_Story_publicTitle(ctx, field) + case "publicDescription": + return ec.fieldContext_Story_publicDescription(ctx, field) + case "publicImage": + return ec.fieldContext_Story_publicImage(ctx, field) + case "publicNoIndex": + return ec.fieldContext_Story_publicNoIndex(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Story", field.Name) }, @@ -43699,6 +44269,22 @@ func (ec *executionContext) fieldContext_StoryPayload_story(ctx context.Context, return ec.fieldContext_Story_sceneId(ctx, field) case "scene": return ec.fieldContext_Story_scene(ctx, field) + case "panelPosition": + return ec.fieldContext_Story_panelPosition(ctx, field) + case "isBasicAuthActive": + return ec.fieldContext_Story_isBasicAuthActive(ctx, field) + case "basicAuthUsername": + return ec.fieldContext_Story_basicAuthUsername(ctx, field) + case "basicAuthPassword": + return ec.fieldContext_Story_basicAuthPassword(ctx, field) + case "publicTitle": + return ec.fieldContext_Story_publicTitle(ctx, field) + case "publicDescription": + return ec.fieldContext_Story_publicDescription(ctx, field) + case "publicImage": + return ec.fieldContext_Story_publicImage(ctx, field) + case "publicNoIndex": + return ec.fieldContext_Story_publicNoIndex(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Story", field.Name) }, @@ -53328,7 +53914,7 @@ func (ec *executionContext) unmarshalInputUpdateStoryInput(ctx context.Context, asMap[k] = v } - fieldsInOrder := [...]string{"sceneId", "storyId", "title", "index"} + fieldsInOrder := [...]string{"sceneId", "storyId", "title", "index", "panelPosition", "isBasicAuthActive", "basicAuthUsername", "basicAuthPassword", "alias", "publicTitle", "publicDescription", "publicImage", "publicNoIndex", "deletePublicImage"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -53367,6 +53953,86 @@ func (ec *executionContext) unmarshalInputUpdateStoryInput(ctx context.Context, if err != nil { return it, err } + case "panelPosition": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("panelPosition")) + it.PanelPosition, err = ec.unmarshalOPosition2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐPosition(ctx, v) + if err != nil { + return it, err + } + case "isBasicAuthActive": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("isBasicAuthActive")) + it.IsBasicAuthActive, err = ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + case "basicAuthUsername": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basicAuthUsername")) + it.BasicAuthUsername, err = ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + case "basicAuthPassword": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("basicAuthPassword")) + it.BasicAuthPassword, err = ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + case "alias": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("alias")) + it.Alias, err = ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + case "publicTitle": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("publicTitle")) + it.PublicTitle, err = ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + case "publicDescription": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("publicDescription")) + it.PublicDescription, err = ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + case "publicImage": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("publicImage")) + it.PublicImage, err = ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + case "publicNoIndex": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("publicNoIndex")) + it.PublicNoIndex, err = ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + case "deletePublicImage": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deletePublicImage")) + it.DeletePublicImage, err = ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } } } @@ -61508,6 +62174,62 @@ func (ec *executionContext) _Story(ctx context.Context, sel ast.SelectionSet, ob return innerFunc(ctx) }) + case "panelPosition": + + out.Values[i] = ec._Story_panelPosition(ctx, field, obj) + + if out.Values[i] == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + case "isBasicAuthActive": + + out.Values[i] = ec._Story_isBasicAuthActive(ctx, field, obj) + + if out.Values[i] == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + case "basicAuthUsername": + + out.Values[i] = ec._Story_basicAuthUsername(ctx, field, obj) + + if out.Values[i] == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + case "basicAuthPassword": + + out.Values[i] = ec._Story_basicAuthPassword(ctx, field, obj) + + if out.Values[i] == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + case "publicTitle": + + out.Values[i] = ec._Story_publicTitle(ctx, field, obj) + + if out.Values[i] == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + case "publicDescription": + + out.Values[i] = ec._Story_publicDescription(ctx, field, obj) + + if out.Values[i] == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + case "publicImage": + + out.Values[i] = ec._Story_publicImage(ctx, field, obj) + + if out.Values[i] == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + case "publicNoIndex": + + out.Values[i] = ec._Story_publicNoIndex(ctx, field, obj) + + if out.Values[i] == graphql.Null { + atomic.AddUint32(&invalids, 1) + } default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -64802,7 +65524,250 @@ func (ec *executionContext) marshalNMergedPropertyGroup2ᚕᚖgithubᚗcomᚋree if !isLen1 { defer wg.Done() } - ret[i] = ec.marshalNMergedPropertyGroup2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMergedPropertyGroup(ctx, sel, v[i]) + ret[i] = ec.marshalNMergedPropertyGroup2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMergedPropertyGroup(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNMergedPropertyGroup2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMergedPropertyGroup(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.MergedPropertyGroup) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._MergedPropertyGroup(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNMoveInfoboxFieldInput2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveInfoboxFieldInput(ctx context.Context, v interface{}) (gqlmodel.MoveInfoboxFieldInput, error) { + res, err := ec.unmarshalInputMoveInfoboxFieldInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalNMoveLayerInput2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveLayerInput(ctx context.Context, v interface{}) (gqlmodel.MoveLayerInput, error) { + res, err := ec.unmarshalInputMoveLayerInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalNMovePropertyItemInput2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMovePropertyItemInput(ctx context.Context, v interface{}) (gqlmodel.MovePropertyItemInput, error) { + res, err := ec.unmarshalInputMovePropertyItemInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalNMoveStoryBlockInput2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveStoryBlockInput(ctx context.Context, v interface{}) (gqlmodel.MoveStoryBlockInput, error) { + res, err := ec.unmarshalInputMoveStoryBlockInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNMoveStoryBlockPayload2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveStoryBlockPayload(ctx context.Context, sel ast.SelectionSet, v gqlmodel.MoveStoryBlockPayload) graphql.Marshaler { + return ec._MoveStoryBlockPayload(ctx, sel, &v) +} + +func (ec *executionContext) marshalNMoveStoryBlockPayload2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveStoryBlockPayload(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.MoveStoryBlockPayload) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._MoveStoryBlockPayload(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNMoveStoryInput2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveStoryInput(ctx context.Context, v interface{}) (gqlmodel.MoveStoryInput, error) { + res, err := ec.unmarshalInputMoveStoryInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalNMoveStoryPageInput2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveStoryPageInput(ctx context.Context, v interface{}) (gqlmodel.MoveStoryPageInput, error) { + res, err := ec.unmarshalInputMoveStoryPageInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNMoveStoryPagePayload2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveStoryPagePayload(ctx context.Context, sel ast.SelectionSet, v gqlmodel.MoveStoryPagePayload) graphql.Marshaler { + return ec._MoveStoryPagePayload(ctx, sel, &v) +} + +func (ec *executionContext) marshalNMoveStoryPagePayload2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveStoryPagePayload(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.MoveStoryPagePayload) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._MoveStoryPagePayload(ctx, sel, v) +} + +func (ec *executionContext) marshalNMoveStoryPayload2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveStoryPayload(ctx context.Context, sel ast.SelectionSet, v gqlmodel.MoveStoryPayload) graphql.Marshaler { + return ec._MoveStoryPayload(ctx, sel, &v) +} + +func (ec *executionContext) marshalNMoveStoryPayload2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveStoryPayload(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.MoveStoryPayload) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._MoveStoryPayload(ctx, sel, v) +} + +func (ec *executionContext) marshalNNode2ᚕgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐNode(ctx context.Context, sel ast.SelectionSet, v []gqlmodel.Node) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalONode2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐNode(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + return ret +} + +func (ec *executionContext) unmarshalNNodeType2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐNodeType(ctx context.Context, v interface{}) (gqlmodel.NodeType, error) { + var res gqlmodel.NodeType + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNNodeType2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐNodeType(ctx context.Context, sel ast.SelectionSet, v gqlmodel.NodeType) graphql.Marshaler { + return v +} + +func (ec *executionContext) marshalNPageInfo2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐPageInfo(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.PageInfo) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._PageInfo(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNPageLayerInput2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐPageLayerInput(ctx context.Context, v interface{}) (gqlmodel.PageLayerInput, error) { + res, err := ec.unmarshalInputPageLayerInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNPlugin2ᚕᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐPluginᚄ(ctx context.Context, sel ast.SelectionSet, v []*gqlmodel.Plugin) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNPlugin2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐPlugin(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNPlugin2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐPlugin(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.Plugin) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._Plugin(ctx, sel, v) +} + +func (ec *executionContext) marshalNPluginExtension2ᚕᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐPluginExtensionᚄ(ctx context.Context, sel ast.SelectionSet, v []*gqlmodel.PluginExtension) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNPluginExtension2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐPluginExtension(ctx, sel, v[i]) } if isLen1 { f(i) @@ -64822,266 +65787,33 @@ func (ec *executionContext) marshalNMergedPropertyGroup2ᚕᚖgithubᚗcomᚋree return ret } -func (ec *executionContext) marshalNMergedPropertyGroup2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMergedPropertyGroup(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.MergedPropertyGroup) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "the requested element is null which the schema does not allow") - } - return graphql.Null - } - return ec._MergedPropertyGroup(ctx, sel, v) -} - -func (ec *executionContext) unmarshalNMoveInfoboxFieldInput2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveInfoboxFieldInput(ctx context.Context, v interface{}) (gqlmodel.MoveInfoboxFieldInput, error) { - res, err := ec.unmarshalInputMoveInfoboxFieldInput(ctx, v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) unmarshalNMoveLayerInput2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveLayerInput(ctx context.Context, v interface{}) (gqlmodel.MoveLayerInput, error) { - res, err := ec.unmarshalInputMoveLayerInput(ctx, v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) unmarshalNMovePropertyItemInput2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMovePropertyItemInput(ctx context.Context, v interface{}) (gqlmodel.MovePropertyItemInput, error) { - res, err := ec.unmarshalInputMovePropertyItemInput(ctx, v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) unmarshalNMoveStoryBlockInput2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveStoryBlockInput(ctx context.Context, v interface{}) (gqlmodel.MoveStoryBlockInput, error) { - res, err := ec.unmarshalInputMoveStoryBlockInput(ctx, v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNMoveStoryBlockPayload2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveStoryBlockPayload(ctx context.Context, sel ast.SelectionSet, v gqlmodel.MoveStoryBlockPayload) graphql.Marshaler { - return ec._MoveStoryBlockPayload(ctx, sel, &v) -} - -func (ec *executionContext) marshalNMoveStoryBlockPayload2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveStoryBlockPayload(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.MoveStoryBlockPayload) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "the requested element is null which the schema does not allow") - } - return graphql.Null - } - return ec._MoveStoryBlockPayload(ctx, sel, v) -} - -func (ec *executionContext) unmarshalNMoveStoryInput2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveStoryInput(ctx context.Context, v interface{}) (gqlmodel.MoveStoryInput, error) { - res, err := ec.unmarshalInputMoveStoryInput(ctx, v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) unmarshalNMoveStoryPageInput2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveStoryPageInput(ctx context.Context, v interface{}) (gqlmodel.MoveStoryPageInput, error) { - res, err := ec.unmarshalInputMoveStoryPageInput(ctx, v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNMoveStoryPagePayload2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveStoryPagePayload(ctx context.Context, sel ast.SelectionSet, v gqlmodel.MoveStoryPagePayload) graphql.Marshaler { - return ec._MoveStoryPagePayload(ctx, sel, &v) -} - -func (ec *executionContext) marshalNMoveStoryPagePayload2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveStoryPagePayload(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.MoveStoryPagePayload) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "the requested element is null which the schema does not allow") - } - return graphql.Null - } - return ec._MoveStoryPagePayload(ctx, sel, v) -} - -func (ec *executionContext) marshalNMoveStoryPayload2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveStoryPayload(ctx context.Context, sel ast.SelectionSet, v gqlmodel.MoveStoryPayload) graphql.Marshaler { - return ec._MoveStoryPayload(ctx, sel, &v) -} - -func (ec *executionContext) marshalNMoveStoryPayload2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveStoryPayload(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.MoveStoryPayload) graphql.Marshaler { +func (ec *executionContext) marshalNPluginExtension2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐPluginExtension(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.PluginExtension) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") } return graphql.Null } - return ec._MoveStoryPayload(ctx, sel, v) -} - -func (ec *executionContext) marshalNNode2ᚕgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐNode(ctx context.Context, sel ast.SelectionSet, v []gqlmodel.Node) graphql.Marshaler { - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() - } - ret[i] = ec.marshalONode2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐNode(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - - return ret + return ec._PluginExtension(ctx, sel, v) } -func (ec *executionContext) unmarshalNNodeType2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐNodeType(ctx context.Context, v interface{}) (gqlmodel.NodeType, error) { - var res gqlmodel.NodeType +func (ec *executionContext) unmarshalNPluginExtensionType2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐPluginExtensionType(ctx context.Context, v interface{}) (gqlmodel.PluginExtensionType, error) { + var res gqlmodel.PluginExtensionType err := res.UnmarshalGQL(v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNNodeType2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐNodeType(ctx context.Context, sel ast.SelectionSet, v gqlmodel.NodeType) graphql.Marshaler { +func (ec *executionContext) marshalNPluginExtensionType2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐPluginExtensionType(ctx context.Context, sel ast.SelectionSet, v gqlmodel.PluginExtensionType) graphql.Marshaler { return v } -func (ec *executionContext) marshalNPageInfo2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐPageInfo(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.PageInfo) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "the requested element is null which the schema does not allow") - } - return graphql.Null - } - return ec._PageInfo(ctx, sel, v) -} - -func (ec *executionContext) unmarshalNPageLayerInput2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐPageLayerInput(ctx context.Context, v interface{}) (gqlmodel.PageLayerInput, error) { - res, err := ec.unmarshalInputPageLayerInput(ctx, v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNPlugin2ᚕᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐPluginᚄ(ctx context.Context, sel ast.SelectionSet, v []*gqlmodel.Plugin) graphql.Marshaler { - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() - } - ret[i] = ec.marshalNPlugin2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐPlugin(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - - return ret -} - -func (ec *executionContext) marshalNPlugin2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐPlugin(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.Plugin) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "the requested element is null which the schema does not allow") - } - return graphql.Null - } - return ec._Plugin(ctx, sel, v) -} - -func (ec *executionContext) marshalNPluginExtension2ᚕᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐPluginExtensionᚄ(ctx context.Context, sel ast.SelectionSet, v []*gqlmodel.PluginExtension) graphql.Marshaler { - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() - } - ret[i] = ec.marshalNPluginExtension2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐPluginExtension(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - - return ret -} - -func (ec *executionContext) marshalNPluginExtension2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐPluginExtension(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.PluginExtension) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "the requested element is null which the schema does not allow") - } - return graphql.Null - } - return ec._PluginExtension(ctx, sel, v) -} - -func (ec *executionContext) unmarshalNPluginExtensionType2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐPluginExtensionType(ctx context.Context, v interface{}) (gqlmodel.PluginExtensionType, error) { - var res gqlmodel.PluginExtensionType +func (ec *executionContext) unmarshalNPosition2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐPosition(ctx context.Context, v interface{}) (gqlmodel.Position, error) { + var res gqlmodel.Position err := res.UnmarshalGQL(v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNPluginExtensionType2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐPluginExtensionType(ctx context.Context, sel ast.SelectionSet, v gqlmodel.PluginExtensionType) graphql.Marshaler { +func (ec *executionContext) marshalNPosition2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐPosition(ctx context.Context, sel ast.SelectionSet, v gqlmodel.Position) graphql.Marshaler { return v } @@ -67328,6 +68060,22 @@ func (ec *executionContext) marshalOPolicy2ᚖgithubᚗcomᚋreearthᚋreearth return ec._Policy(ctx, sel, v) } +func (ec *executionContext) unmarshalOPosition2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐPosition(ctx context.Context, v interface{}) (*gqlmodel.Position, error) { + if v == nil { + return nil, nil + } + var res = new(gqlmodel.Position) + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOPosition2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐPosition(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.Position) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return v +} + func (ec *executionContext) marshalOProject2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐProject(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.Project) graphql.Marshaler { if v == nil { return graphql.Null diff --git a/server/internal/adapter/gql/gqlmodel/convert_storytelling.go b/server/internal/adapter/gql/gqlmodel/convert_storytelling.go index 0b8e0962d2..d3c9aa9be5 100644 --- a/server/internal/adapter/gql/gqlmodel/convert_storytelling.go +++ b/server/internal/adapter/gql/gqlmodel/convert_storytelling.go @@ -20,6 +20,15 @@ func ToStory(s *storytelling.Story) *Story { CreatedAt: s.Id().Timestamp(), UpdatedAt: s.UpdatedAt(), PublishedAt: s.PublishedAt(), + PanelPosition: ToStoryPosition(s.PanelPosition()), + + IsBasicAuthActive: s.IsBasicAuthActive(), + BasicAuthUsername: s.BasicAuthUsername(), + BasicAuthPassword: s.BasicAuthPassword(), + PublicTitle: s.PublicTitle(), + PublicDescription: s.PublicDescription(), + PublicImage: s.PublicImage(), + PublicNoIndex: s.PublicNoIndex(), } } @@ -93,3 +102,26 @@ func ToStoryPublishmentStatus(v storytelling.PublishmentStatus) PublishmentStatu } return "" } + +func ToStoryPosition(v storytelling.Position) Position { + switch v { + case storytelling.PositionLeft: + return PositionLeft + case storytelling.PositionRight: + return PositionRight + } + return "" +} + +func FromStoryPositionRef(v *Position) *storytelling.Position { + if v == nil { + return nil + } + switch *v { + case PositionLeft: + return lo.ToPtr(storytelling.PositionLeft) + case PositionRight: + return lo.ToPtr(storytelling.PositionRight) + } + return nil +} diff --git a/server/internal/adapter/gql/gqlmodel/models_gen.go b/server/internal/adapter/gql/gqlmodel/models_gen.go index 48d9c6c810..99e6274941 100644 --- a/server/internal/adapter/gql/gqlmodel/models_gen.go +++ b/server/internal/adapter/gql/gqlmodel/models_gen.go @@ -1196,6 +1196,14 @@ type Story struct { PublishedAt *time.Time `json:"publishedAt"` SceneID ID `json:"sceneId"` Scene *Scene `json:"scene"` + PanelPosition Position `json:"panelPosition"` + IsBasicAuthActive bool `json:"isBasicAuthActive"` + BasicAuthUsername string `json:"basicAuthUsername"` + BasicAuthPassword string `json:"basicAuthPassword"` + PublicTitle string `json:"publicTitle"` + PublicDescription string `json:"publicDescription"` + PublicImage string `json:"publicImage"` + PublicNoIndex bool `json:"publicNoIndex"` } func (Story) IsNode() {} @@ -1424,10 +1432,20 @@ type UpdatePropertyValueInput struct { } type UpdateStoryInput struct { - SceneID ID `json:"sceneId"` - StoryID ID `json:"storyId"` - Title *string `json:"title"` - Index *int `json:"index"` + SceneID ID `json:"sceneId"` + StoryID ID `json:"storyId"` + Title *string `json:"title"` + Index *int `json:"index"` + PanelPosition *Position `json:"panelPosition"` + IsBasicAuthActive *bool `json:"isBasicAuthActive"` + BasicAuthUsername *string `json:"basicAuthUsername"` + BasicAuthPassword *string `json:"basicAuthPassword"` + Alias *string `json:"alias"` + PublicTitle *string `json:"publicTitle"` + PublicDescription *string `json:"publicDescription"` + PublicImage *string `json:"publicImage"` + PublicNoIndex *bool `json:"publicNoIndex"` + DeletePublicImage *bool `json:"deletePublicImage"` } type UpdateStoryPageInput struct { @@ -1840,6 +1858,47 @@ func (e PluginExtensionType) MarshalGQL(w io.Writer) { fmt.Fprint(w, strconv.Quote(e.String())) } +type Position string + +const ( + PositionLeft Position = "LEFT" + PositionRight Position = "RIGHT" +) + +var AllPosition = []Position{ + PositionLeft, + PositionRight, +} + +func (e Position) IsValid() bool { + switch e { + case PositionLeft, PositionRight: + return true + } + return false +} + +func (e Position) String() string { + return string(e) +} + +func (e *Position) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = Position(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid Position", str) + } + return nil +} + +func (e Position) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + type PropertySchemaFieldUI string const ( diff --git a/server/internal/adapter/gql/resolver_mutation_storytelling.go b/server/internal/adapter/gql/resolver_mutation_storytelling.go index 3c9e66578e..6cfcff17c5 100644 --- a/server/internal/adapter/gql/resolver_mutation_storytelling.go +++ b/server/internal/adapter/gql/resolver_mutation_storytelling.go @@ -39,10 +39,21 @@ func (r *mutationResolver) UpdateStory(ctx context.Context, input gqlmodel.Updat } inp := interfaces.UpdateStoryInput{ - SceneID: sceneId, - StoryID: storyId, - Title: input.Title, - Index: input.Index, + SceneID: sceneId, + StoryID: storyId, + Title: input.Title, + Index: input.Index, + PanelPosition: gqlmodel.FromStoryPositionRef(input.PanelPosition), + + IsBasicAuthActive: input.IsBasicAuthActive, + BasicAuthUsername: input.BasicAuthUsername, + BasicAuthPassword: input.BasicAuthPassword, + Alias: input.Alias, + PublicTitle: input.PublicTitle, + PublicDescription: input.PublicDescription, + PublicImage: input.PublicImage, + PublicNoIndex: input.PublicNoIndex, + DeletePublicImage: input.DeletePublicImage, } res, err := usecases(ctx).StoryTelling.Update(ctx, inp, getOperator(ctx)) diff --git a/server/internal/infrastructure/mongo/mongodoc/storytelling.go b/server/internal/infrastructure/mongo/mongodoc/storytelling.go index c939564061..15548e133b 100644 --- a/server/internal/infrastructure/mongo/mongodoc/storytelling.go +++ b/server/internal/infrastructure/mongo/mongodoc/storytelling.go @@ -11,16 +11,25 @@ import ( ) type StorytellingDocument struct { - Id string - Property string - Scene string - Title string - Alias string - Pages []PageDocument - Status string - PublishedAt *time.Time - UpdatedAt time.Time - Index int + Id string + Property string + Scene string + Title string + Alias string + Pages []PageDocument + Status string + PublishedAt *time.Time + UpdatedAt time.Time + Index int + PanelPosition string + + IsBasicAuthActive bool + BasicAuthUsername string + BasicAuthPassword string + PublicTitle string + PublicDescription string + PublicImage string + PublicNoIndex bool } type PageDocument struct { @@ -52,16 +61,25 @@ func NewStorytelling(s *storytelling.Story) (*StorytellingDocument, string) { sId := s.Id().String() return &StorytellingDocument{ - Id: s.Id().String(), - Property: s.Property().String(), - Scene: s.Scene().String(), - Title: s.Title(), - Alias: s.Alias(), - Pages: newPages(s.Pages()), - Status: string(s.Status()), - PublishedAt: s.PublishedAt(), - UpdatedAt: s.UpdatedAt(), - Index: 1, + Id: s.Id().String(), + Property: s.Property().String(), + Scene: s.Scene().String(), + Title: s.Title(), + Alias: s.Alias(), + Pages: newPages(s.Pages()), + Status: string(s.Status()), + PublishedAt: s.PublishedAt(), + UpdatedAt: s.UpdatedAt(), + Index: 1, + PanelPosition: string(s.PanelPosition()), + + IsBasicAuthActive: s.IsBasicAuthActive(), + BasicAuthUsername: s.BasicAuthUsername(), + BasicAuthPassword: s.BasicAuthPassword(), + PublicTitle: s.PublicTitle(), + PublicDescription: s.PublicDescription(), + PublicImage: s.PublicImage(), + PublicNoIndex: s.PublicNoIndex(), }, sId } @@ -160,9 +178,15 @@ func (d *StorytellingDocument) Model() (*storytelling.Story, error) { Title(d.Title). Alias(d.Alias). Status(storytelling.PublishmentStatus(d.Status)). + PanelPosition(storytelling.Position(d.PanelPosition)). PublishedAt(d.PublishedAt). UpdatedAt(d.UpdatedAt). Pages(storytelling.NewPageList(pages)). + PublicBasicAuth(d.IsBasicAuthActive, d.BasicAuthUsername, d.BasicAuthPassword). + PublicTitle(d.PublicTitle). + PublicDescription(d.PublicDescription). + PublicImage(d.PublicImage). + PublicNoIndex(d.PublicNoIndex). Build() if err != nil { return nil, err diff --git a/server/internal/usecase/interactor/storytelling.go b/server/internal/usecase/interactor/storytelling.go index a46bd726b8..cfb96c5b6c 100644 --- a/server/internal/usecase/interactor/storytelling.go +++ b/server/internal/usecase/interactor/storytelling.go @@ -112,6 +112,32 @@ func (i *Storytelling) Update(ctx context.Context, inp interfaces.UpdateStoryInp story.Rename(*inp.Title) } + if inp.PublicTitle != nil { + story.SetPublicTitle(*inp.PublicTitle) + } + + if inp.PublicDescription != nil { + story.SetPublicDescription(*inp.PublicDescription) + } + + if inp.PublicImage != nil { + story.SetPublicImage(*inp.PublicImage) + } + + if inp.IsBasicAuthActive != nil { + if err := story.SetBasicAuth(*inp.IsBasicAuthActive, inp.BasicAuthUsername, inp.BasicAuthPassword); err != nil { + return nil, err + } + } + + if inp.PublicNoIndex != nil { + story.SetPublicNoIndex(*inp.PublicNoIndex) + } + + if inp.PanelPosition != nil { + story.SetPanelPosition(*inp.PanelPosition) + } + // TODO: Handel ordering err = i.storytellingRepo.Save(ctx, *story) diff --git a/server/internal/usecase/interfaces/story.go b/server/internal/usecase/interfaces/story.go index 1743847e80..ec00699867 100644 --- a/server/internal/usecase/interfaces/story.go +++ b/server/internal/usecase/interfaces/story.go @@ -18,10 +18,21 @@ type CreateStoryInput struct { } type UpdateStoryInput struct { - SceneID id.SceneID - StoryID id.StoryID - Title *string - Index *int + SceneID id.SceneID + StoryID id.StoryID + Title *string + Index *int + PanelPosition *storytelling.Position + + IsBasicAuthActive *bool + BasicAuthUsername *string + BasicAuthPassword *string + Alias *string + PublicTitle *string + PublicDescription *string + PublicImage *string + PublicNoIndex *bool + DeletePublicImage *bool } type MoveStoryInput struct { diff --git a/server/pkg/storytelling/block.go b/server/pkg/storytelling/block.go index e5594928eb..00e3135da3 100644 --- a/server/pkg/storytelling/block.go +++ b/server/pkg/storytelling/block.go @@ -15,18 +15,30 @@ type Block struct { } func (i *Block) ID() BlockID { + if i == nil { + return BlockID{} + } return i.id } func (i *Block) Plugin() PluginID { + if i == nil { + return PluginID{} + } return i.plugin } func (i *Block) Extension() PluginExtensionID { + if i == nil { + return PluginExtensionID("") + } return i.extension } func (i *Block) Property() PropertyID { + if i == nil { + return PropertyID{} + } return i.property } diff --git a/server/pkg/storytelling/block_test.go b/server/pkg/storytelling/block_test.go new file mode 100644 index 0000000000..e1baa6df55 --- /dev/null +++ b/server/pkg/storytelling/block_test.go @@ -0,0 +1,58 @@ +package storytelling + +import ( + "testing" + + "github.com/reearth/reearth/server/pkg/id" + "github.com/stretchr/testify/assert" +) + +func TestBlock_SettersGetters(t *testing.T) { + + var b *Block + assert.True(t, b.ID().IsEmpty()) + assert.True(t, b.Property().IsEmpty()) + assert.Equal(t, PluginID{}, b.Plugin()) + assert.Equal(t, PluginExtensionID(""), b.Extension()) + assert.Nil(t, b.PropertyRef()) + assert.Nil(t, b.Clone()) + + blockID := NewBlockID() + propertyID := NewPropertyID() + pluginID, _ := id.NewPluginID("plugin", "1.0.0", nil) + extensionID := PluginExtensionID("extension") + b = &Block{ + id: blockID, + plugin: pluginID, + extension: extensionID, + property: propertyID, + } + assert.Equal(t, blockID, b.ID()) + assert.Equal(t, propertyID, b.Property()) + assert.Equal(t, pluginID, b.Plugin()) + assert.Equal(t, extensionID, b.Extension()) + assert.Equal(t, propertyID.Ref(), b.PropertyRef()) + assert.NotSame(t, propertyID.Ref(), b.PropertyRef()) + + newPluginID, _ := id.NewPluginID("plugin2", "1.0.1", nil) + b.UpgradePlugin(newPluginID) + assert.Equal(t, pluginID, b.Plugin()) + + newPluginID, _ = id.NewPluginID("plugin", "1.0.1", nil) + b.UpgradePlugin(newPluginID) + assert.Equal(t, newPluginID, b.Plugin()) + + b2 := b.Clone() + assert.Equal(t, b, b2) + assert.NotSame(t, b, b2) + assert.Equal(t, b.ID(), b2.ID()) + assert.Equal(t, b.Property(), b2.Property()) + assert.NotSame(t, b.Property(), b2.Property()) + assert.Equal(t, b.Plugin(), b2.Plugin()) + assert.NotSame(t, b.Plugin(), b2.Plugin()) + assert.Equal(t, b.Extension(), b2.Extension()) + assert.NotSame(t, b.Extension(), b2.Extension()) + assert.Equal(t, b.PropertyRef(), b2.PropertyRef()) + assert.NotSame(t, b.PropertyRef(), b2.PropertyRef()) + +} diff --git a/server/pkg/storytelling/position.go b/server/pkg/storytelling/position.go new file mode 100644 index 0000000000..61580e1cda --- /dev/null +++ b/server/pkg/storytelling/position.go @@ -0,0 +1,9 @@ +package storytelling + +type Position string + +const ( + PositionLeft Position = "left" + + PositionRight Position = "right" +) diff --git a/server/pkg/storytelling/story.go b/server/pkg/storytelling/story.go index f43d7298c6..d52a217abb 100644 --- a/server/pkg/storytelling/story.go +++ b/server/pkg/storytelling/story.go @@ -10,16 +10,27 @@ import ( "github.com/reearth/reearthx/util" ) +var ErrBasicAuthUserNamePasswordEmpty = errors.New("basic auth username or password is empty") + type Story struct { - id StoryID - property PropertyID - scene SceneID - title string - alias string - pages *PageList - status PublishmentStatus - publishedAt *time.Time - updatedAt time.Time + id StoryID + property PropertyID + scene SceneID + title string + pages *PageList + panelPosition Position + updatedAt time.Time + + alias string + status PublishmentStatus + publishedAt *time.Time + isBasicAuthActive bool + basicAuthUsername string + basicAuthPassword string + publicTitle string + publicDescription string + publicImage string + publicNoIndex bool } func (s *Story) Id() StoryID { @@ -62,6 +73,44 @@ func (s *Story) UpdatedAt() time.Time { return s.updatedAt } +func (s *Story) IsBasicAuthActive() bool { + return s.isBasicAuthActive +} + +func (s *Story) BasicAuthUsername() string { + if !s.isBasicAuthActive { + return "" + } + return s.basicAuthUsername +} + +func (s *Story) BasicAuthPassword() string { + if !s.isBasicAuthActive { + return "" + } + return s.basicAuthPassword +} + +func (s *Story) PublicTitle() string { + return s.publicTitle +} + +func (s *Story) SetPublicDescription(publicDescription string) { + s.publicDescription = publicDescription +} + +func (s *Story) SetPublicImage(publicImage string) { + s.publicImage = publicImage +} + +func (s *Story) SetPublicNoIndex(publicNoIndex bool) { + s.publicNoIndex = publicNoIndex +} + +func (s *Story) SetPanelPosition(panelPosition Position) { + s.panelPosition = panelPosition +} + func (s *Story) Rename(name string) { s.title = name s.updatedAt = util.Now() @@ -71,6 +120,41 @@ func (s *Story) SetUpdatedAt(now time.Time) { s.updatedAt = now } +func (s *Story) SetBasicAuth(isBasicAuthActive bool, basicAuthUsername, basicAuthPassword *string) error { + s.isBasicAuthActive = isBasicAuthActive + if !isBasicAuthActive { + s.basicAuthUsername = "" + s.basicAuthPassword = "" + return nil + } + if isBasicAuthActive && (basicAuthUsername == nil || basicAuthPassword == nil) { + return ErrBasicAuthUserNamePasswordEmpty + } + s.basicAuthUsername = *basicAuthUsername + s.basicAuthPassword = *basicAuthPassword + return nil +} + +func (s *Story) SetPublicTitle(publicTitle string) { + s.publicTitle = publicTitle +} + +func (s *Story) PublicDescription() string { + return s.publicDescription +} + +func (s *Story) PublicImage() string { + return s.publicImage +} + +func (s *Story) PublicNoIndex() bool { + return s.publicNoIndex +} + +func (s *Story) PanelPosition() Position { + return s.panelPosition +} + func (s *Story) ValidateProperties(pm property.Map) error { if pm == nil { return nil diff --git a/server/pkg/storytelling/story_bulider.go b/server/pkg/storytelling/story_bulider.go index d320c97188..9010849fe2 100644 --- a/server/pkg/storytelling/story_bulider.go +++ b/server/pkg/storytelling/story_bulider.go @@ -19,6 +19,9 @@ func (b *StoryBuilder) Build() (*Story, error) { if b.s.updatedAt.IsZero() { b.s.updatedAt = b.s.CreatedAt() } + if len(b.s.panelPosition) == 0 { + b.s.panelPosition = PositionLeft + } return b.s, nil } @@ -60,6 +63,11 @@ func (b *StoryBuilder) Status(status PublishmentStatus) *StoryBuilder { return b } +func (b *StoryBuilder) PanelPosition(position Position) *StoryBuilder { + b.s.panelPosition = position + return b +} + func (b *StoryBuilder) Alias(alias string) *StoryBuilder { b.s.alias = alias return b @@ -79,3 +87,30 @@ func (b *StoryBuilder) UpdatedAt(at time.Time) *StoryBuilder { b.s.updatedAt = at return b } + +func (b *StoryBuilder) PublicBasicAuth(active bool, username, password string) *StoryBuilder { + b.s.isBasicAuthActive = active + b.s.basicAuthUsername = username + b.s.basicAuthPassword = password + return b +} + +func (b *StoryBuilder) PublicTitle(title string) *StoryBuilder { + b.s.publicTitle = title + return b +} + +func (b *StoryBuilder) PublicDescription(description string) *StoryBuilder { + b.s.publicDescription = description + return b +} + +func (b *StoryBuilder) PublicImage(image string) *StoryBuilder { + b.s.publicImage = image + return b +} + +func (b *StoryBuilder) PublicNoIndex(noIndex bool) *StoryBuilder { + b.s.publicNoIndex = noIndex + return b +} diff --git a/server/pkg/storytelling/story_bulider_test.go b/server/pkg/storytelling/story_bulider_test.go index 4094309062..cbf6bda840 100644 --- a/server/pkg/storytelling/story_bulider_test.go +++ b/server/pkg/storytelling/story_bulider_test.go @@ -33,27 +33,42 @@ func TestStoryBuilder(t *testing.T) { Property(propertyID). Pages(nil). Status(PublishmentStatusPrivate). - PublishedAt(nil) + PublishedAt(nil). + PublicTitle("public title"). + PublicDescription("public description"). + PublicImage("/test.jpg"). + PublicNoIndex(true). + PublicBasicAuth(true, "user", "pass") s, err = b.Build() assert.NoError(t, err) assert.Equal(t, &Story{ - id: storyID, - property: propertyID, - scene: sceneID, - title: "title", - alias: "alias", - pages: nil, - status: PublishmentStatusPrivate, - publishedAt: nil, - updatedAt: storyID.Timestamp(), + id: storyID, + property: propertyID, + scene: sceneID, + title: "title", + alias: "alias", + pages: nil, + status: PublishmentStatusPrivate, + panelPosition: PositionLeft, + publishedAt: nil, + updatedAt: storyID.Timestamp(), + publicTitle: "public title", + publicDescription: "public description", + publicImage: "/test.jpg", + publicNoIndex: true, + isBasicAuthActive: true, + basicAuthUsername: "user", + basicAuthPassword: "pass", }, s) now := util.Now() b = b.UpdatedAt(now) + b = b.PanelPosition(PositionRight) s, err = b.Build() assert.NoError(t, err) assert.Equal(t, s.updatedAt, now) + assert.Equal(t, s.panelPosition, PositionRight) assert.NotPanics(t, func() { b.MustBuild() diff --git a/server/pkg/storytelling/story_test.go b/server/pkg/storytelling/story_test.go index 0a145b0dde..212566db19 100644 --- a/server/pkg/storytelling/story_test.go +++ b/server/pkg/storytelling/story_test.go @@ -5,6 +5,7 @@ import ( "time" "github.com/reearth/reearthx/util" + "github.com/samber/lo" "github.com/stretchr/testify/assert" ) @@ -16,15 +17,23 @@ func TestStory_SettersGetters(t *testing.T) { now := time.Now() s := &Story{ - id: sId, - property: pId, - scene: sceneID, - title: "test", - alias: "abc", - pages: nil, - status: PublishmentStatusPrivate, - publishedAt: nil, - updatedAt: now, + id: sId, + property: pId, + scene: sceneID, + title: "test", + alias: "abc", + pages: nil, + status: PublishmentStatusPrivate, + publishedAt: nil, + updatedAt: now, + panelPosition: PositionRight, + isBasicAuthActive: false, + basicAuthUsername: "user", + basicAuthPassword: "pass", + publicTitle: "public title", + publicDescription: "public description", + publicImage: "/test.jpg", + publicNoIndex: true, } assert.Equal(t, sId, s.Id()) @@ -37,6 +46,14 @@ func TestStory_SettersGetters(t *testing.T) { assert.Nil(t, s.Pages()) assert.Nil(t, s.PublishedAt()) assert.Equal(t, sId.Timestamp(), s.CreatedAt()) + assert.Equal(t, PositionRight, s.PanelPosition()) + assert.Equal(t, false, s.IsBasicAuthActive()) + assert.Equal(t, "", s.BasicAuthUsername()) + assert.Equal(t, "", s.BasicAuthPassword()) + assert.Equal(t, "public title", s.PublicTitle()) + assert.Equal(t, "public description", s.PublicDescription()) + assert.Equal(t, "/test.jpg", s.PublicImage()) + assert.Equal(t, true, s.PublicNoIndex()) util.MockNow(now.Add(1 * time.Hour)) s.Rename("test2") @@ -46,6 +63,35 @@ func TestStory_SettersGetters(t *testing.T) { s.SetUpdatedAt(now.Add(2 * time.Hour)) assert.Equal(t, now.Add(2*time.Hour), s.UpdatedAt()) + s.SetPanelPosition(PositionLeft) + assert.Equal(t, PositionLeft, s.PanelPosition()) + + err := s.SetBasicAuth(true, nil, nil) + assert.Equal(t, ErrBasicAuthUserNamePasswordEmpty, err) + + err = s.SetBasicAuth(false, lo.ToPtr("user"), lo.ToPtr("pass")) + assert.NoError(t, err) + assert.Equal(t, false, s.IsBasicAuthActive()) + assert.Equal(t, "", s.BasicAuthUsername()) + assert.Equal(t, "", s.BasicAuthPassword()) + + err = s.SetBasicAuth(true, lo.ToPtr("user"), lo.ToPtr("pass")) + assert.NoError(t, err) + assert.Equal(t, true, s.IsBasicAuthActive()) + assert.Equal(t, "user", s.BasicAuthUsername()) + assert.Equal(t, "pass", s.BasicAuthPassword()) + + s.SetPublicTitle("public title 2") + assert.Equal(t, "public title 2", s.PublicTitle()) + + s.SetPublicDescription("public description 2") + assert.Equal(t, "public description 2", s.PublicDescription()) + + s.SetPublicImage("/test2.jpg") + assert.Equal(t, "/test2.jpg", s.PublicImage()) + + s.SetPublicNoIndex(false) + assert.Equal(t, false, s.PublicNoIndex()) } func TestStory_ValidateProperties(t *testing.T) {