Skip to content

Commit

Permalink
chore(server): handle visibility for nls layer (#661)
Browse files Browse the repository at this point in the history
  • Loading branch information
pyshx authored Sep 5, 2023
1 parent ba45558 commit 708833b
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions server/gql/newlayer.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ input AddNLSLayerSimpleInput {
sceneId: ID!
config: JSON
index: Int
visible: Boolean
}

input RemoveNLSLayerInput {
Expand Down
11 changes: 10 additions & 1 deletion server/internal/adapter/gql/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions server/internal/adapter/gql/gqlmodel/models_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions server/internal/adapter/gql/resolver_mutation_nlslayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ func (r *mutationResolver) AddNLSLayerSimple(ctx context.Context, input gqlmodel
Index: input.Index,
LayerType: gqlmodel.ToNLSLayerType(input.LayerType),
Config: gqlmodel.ToNLSConfig(input.Config),
Visible: input.Visible,
}

layer, err := usecases(ctx).NLSLayer.AddLayerSimple(ctx, inp, getOperator(ctx))
Expand Down
1 change: 1 addition & 0 deletions server/internal/usecase/interactor/nlslayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ func (i *NLSLayer) AddLayerSimple(ctx context.Context, inp interfaces.AddNLSLaye
LayerType: inp.LayerType,
Index: inp.Index,
Title: inp.Title,
Visible: inp.Visible,
}.Initialize()
if err != nil {
return nil, err
Expand Down
1 change: 1 addition & 0 deletions server/internal/usecase/interfaces/nlslayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type AddNLSLayerSimpleInput struct {
Index *int
LayerType nlslayer.LayerType
Config *nlslayer.Config
Visible *bool
}

type UpdateNLSLayerInput struct {
Expand Down
7 changes: 7 additions & 0 deletions server/pkg/nlslayer/nlslayerops/intializer.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type LayerSimple struct {
Config *nlslayer.Config
Index *int
Title string
Visible *bool
}

func (i LayerSimple) Initialize() (*nlslayer.NLSLayerSimple, error) {
Expand All @@ -21,6 +22,12 @@ func (i LayerSimple) Initialize() (*nlslayer.NLSLayerSimple, error) {
builder.Config(i.Config)
}

if i.Visible != nil {
builder.IsVisible(*i.Visible)
} else {
builder.IsVisible(true)
}

var layerSimple *nlslayer.NLSLayerSimple

if i.LayerType.IsValidLayerType() {
Expand Down

0 comments on commit 708833b

Please sign in to comment.