Skip to content

Commit eb43289

Browse files
authored
fix: updated layer model to also saves popup fields info (#670)
1 parent 18eb550 commit eb43289

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

src/models/layer.model.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@ export interface PopupElementFields {
2020
fields?: string[];
2121
}
2222

23+
/**
24+
* Layer Popup Fields type interface
25+
*/
26+
export interface FieldElement {
27+
label: string;
28+
name: string;
29+
type: string;
30+
[key: string]: string;
31+
}
32+
2333
/**
2434
* PopupElementType type.
2535
*/
@@ -145,6 +155,7 @@ const layerSchema = new Schema(
145155
title: String,
146156
description: String,
147157
popupElements: [mongoose.Schema.Types.Mixed],
158+
fieldsInfo: [mongoose.Schema.Types.Mixed],
148159
},
149160
datasource: {
150161
resource: {

src/schema/inputs/layer.input.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,17 @@ const LayerDefinitionInputType = new GraphQLInputObjectType({
104104
}),
105105
});
106106

107+
/** GraphQL Fields Element Definition input type definition */
108+
// eslint-disable-next-line @typescript-eslint/naming-convention
109+
const FieldElementInputType = new GraphQLInputObjectType({
110+
name: 'FieldElementInputType',
111+
fields: () => ({
112+
label: { type: GraphQLString },
113+
name: { type: GraphQLString },
114+
type: { type: GraphQLString },
115+
}),
116+
});
117+
107118
/** GraphQL Layer Popup Element Fields input type definition */
108119
// eslint-disable-next-line @typescript-eslint/naming-convention
109120
const LayerPopupElementInputType = new GraphQLInputObjectType({
@@ -150,6 +161,7 @@ const LayerInputType = new GraphQLInputObjectType({
150161
title: { type: GraphQLString },
151162
description: { type: GraphQLString },
152163
popupElements: { type: new GraphQLList(LayerPopupElementInputType) },
164+
fieldsInfo: { type: GraphQLList(FieldElementInputType) },
153165
}),
154166
}),
155167
},

src/schema/types/layer.type.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,19 @@ const LayerPopupElement = new GraphQLObjectType({
139139
},
140140
}),
141141
});
142+
143+
/**
144+
* GraphQL LayerFieldElement type.
145+
*/
146+
const LayerFieldElement = new GraphQLObjectType({
147+
name: 'LayerFieldElement',
148+
fields: () => ({
149+
label: { type: GraphQLString },
150+
name: { type: GraphQLString },
151+
type: { type: GraphQLString },
152+
}),
153+
});
154+
142155
/**
143156
* GraphQL Layer type.
144157
*/
@@ -164,6 +177,7 @@ export const LayerType = new GraphQLObjectType({
164177
title: { type: GraphQLString },
165178
description: { type: GraphQLString },
166179
popupElements: { type: new GraphQLList(LayerPopupElement) },
180+
fieldsInfo: { type: new GraphQLList(LayerFieldElement) },
167181
}),
168182
}),
169183
},

0 commit comments

Comments
 (0)