@things-factory/shell 6.0.101 → 6.0.107

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/client/scene/scene-viewer.js +1 -1
  2. package/dist-server/service/attribute/attribute-item-type.d.ts +29 -0
  3. package/dist-server/service/attribute/attribute-item-type.js +81 -0
  4. package/dist-server/service/attribute/attribute-item-type.js.map +1 -0
  5. package/dist-server/service/attribute/attribute-mutation.d.ts +10 -0
  6. package/dist-server/service/attribute/attribute-mutation.js +130 -0
  7. package/dist-server/service/attribute/attribute-mutation.js.map +1 -0
  8. package/dist-server/service/attribute/attribute-query.d.ts +8 -0
  9. package/dist-server/service/attribute/attribute-query.js +60 -0
  10. package/dist-server/service/attribute/attribute-query.js.map +1 -0
  11. package/dist-server/service/attribute/attribute-type.d.ts +19 -0
  12. package/dist-server/service/attribute/attribute-type.js +70 -0
  13. package/dist-server/service/attribute/attribute-type.js.map +1 -0
  14. package/dist-server/service/attribute/attribute.d.ts +9 -0
  15. package/dist-server/service/attribute/attribute.js +52 -0
  16. package/dist-server/service/attribute/attribute.js.map +1 -0
  17. package/dist-server/service/attribute/index.d.ts +5 -0
  18. package/dist-server/service/attribute/index.js +9 -0
  19. package/dist-server/service/attribute/index.js.map +1 -0
  20. package/dist-server/service/attribute-set/attribute-set-item-type.d.ts +31 -0
  21. package/dist-server/service/attribute-set/attribute-set-item-type.js +89 -0
  22. package/dist-server/service/attribute-set/attribute-set-item-type.js.map +1 -0
  23. package/dist-server/service/attribute-set/attribute-set-mutation.d.ts +10 -0
  24. package/dist-server/service/attribute-set/attribute-set-mutation.js +130 -0
  25. package/dist-server/service/attribute-set/attribute-set-mutation.js.map +1 -0
  26. package/dist-server/service/attribute-set/attribute-set-query.d.ts +8 -0
  27. package/dist-server/service/attribute-set/attribute-set-query.js +60 -0
  28. package/dist-server/service/attribute-set/attribute-set-query.js.map +1 -0
  29. package/dist-server/service/attribute-set/attribute-set-type.d.ts +19 -0
  30. package/dist-server/service/attribute-set/attribute-set-type.js +70 -0
  31. package/dist-server/service/attribute-set/attribute-set-type.js.map +1 -0
  32. package/dist-server/service/attribute-set/attribute-set.d.ts +9 -0
  33. package/dist-server/service/attribute-set/attribute-set.js +52 -0
  34. package/dist-server/service/attribute-set/attribute-set.js.map +1 -0
  35. package/dist-server/service/attribute-set/index.d.ts +5 -0
  36. package/dist-server/service/attribute-set/index.js +9 -0
  37. package/dist-server/service/attribute-set/index.js.map +1 -0
  38. package/dist-server/service/domain/domain-resolver.d.ts +1 -1
  39. package/dist-server/service/domain/domain-resolver.js +3 -2
  40. package/dist-server/service/domain/domain-resolver.js.map +1 -1
  41. package/dist-server/service/domain/domain-types.d.ts +1 -0
  42. package/dist-server/service/domain/domain-types.js +5 -0
  43. package/dist-server/service/domain/domain-types.js.map +1 -1
  44. package/dist-server/service/domain/domain.d.ts +1 -0
  45. package/dist-server/service/domain/domain.js +6 -0
  46. package/dist-server/service/domain/domain.js.map +1 -1
  47. package/dist-server/service/index.d.ts +3 -2
  48. package/dist-server/service/index.js +4 -2
  49. package/dist-server/service/index.js.map +1 -1
  50. package/dist-server/tsconfig.tsbuildinfo +1 -1
  51. package/helps/shell/attribute.md +160 -0
  52. package/package.json +2 -2
  53. package/server/service/attribute-set/attribute-set-item-type.ts +65 -0
  54. package/server/service/attribute-set/attribute-set-mutation.ts +125 -0
  55. package/server/service/attribute-set/attribute-set-query.ts +36 -0
  56. package/server/service/attribute-set/attribute-set-type.ts +46 -0
  57. package/server/service/attribute-set/attribute-set.ts +35 -0
  58. package/server/service/attribute-set/index.ts +6 -0
  59. package/server/service/domain/domain-resolver.ts +1 -1
  60. package/server/service/domain/domain-types.ts +4 -1
  61. package/server/service/domain/domain.ts +5 -0
  62. package/server/service/index.ts +5 -8
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AttributeSetItemPatch = exports.AttributeSetItem = exports.AttributeSetItemType = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const type_graphql_1 = require("type-graphql");
6
+ const common_types_1 = require("../common-types");
7
+ var AttributeSetItemType;
8
+ (function (AttributeSetItemType) {
9
+ AttributeSetItemType["number"] = "number";
10
+ AttributeSetItemType["text"] = "text";
11
+ AttributeSetItemType["boolean"] = "boolean";
12
+ AttributeSetItemType["select"] = "select";
13
+ AttributeSetItemType["date"] = "date";
14
+ AttributeSetItemType["datetime"] = "datetime";
15
+ AttributeSetItemType["file"] = "file";
16
+ })(AttributeSetItemType = exports.AttributeSetItemType || (exports.AttributeSetItemType = {}));
17
+ (0, type_graphql_1.registerEnumType)(AttributeSetItemType, {
18
+ name: 'AttributeSetItemType',
19
+ description: 'type enumeration of a attribute-set-item'
20
+ });
21
+ let AttributeSetItem = class AttributeSetItem {
22
+ };
23
+ tslib_1.__decorate([
24
+ (0, type_graphql_1.Field)(),
25
+ tslib_1.__metadata("design:type", String)
26
+ ], AttributeSetItem.prototype, "name", void 0);
27
+ tslib_1.__decorate([
28
+ (0, type_graphql_1.Field)({ nullable: true }),
29
+ tslib_1.__metadata("design:type", String)
30
+ ], AttributeSetItem.prototype, "description", void 0);
31
+ tslib_1.__decorate([
32
+ (0, type_graphql_1.Field)({ nullable: true }),
33
+ tslib_1.__metadata("design:type", String)
34
+ ], AttributeSetItem.prototype, "tag", void 0);
35
+ tslib_1.__decorate([
36
+ (0, type_graphql_1.Field)({ nullable: true }),
37
+ tslib_1.__metadata("design:type", Boolean)
38
+ ], AttributeSetItem.prototype, "active", void 0);
39
+ tslib_1.__decorate([
40
+ (0, type_graphql_1.Field)({ nullable: true }),
41
+ tslib_1.__metadata("design:type", Boolean)
42
+ ], AttributeSetItem.prototype, "hidden", void 0);
43
+ tslib_1.__decorate([
44
+ (0, type_graphql_1.Field)({ nullable: true }),
45
+ tslib_1.__metadata("design:type", String)
46
+ ], AttributeSetItem.prototype, "type", void 0);
47
+ tslib_1.__decorate([
48
+ (0, type_graphql_1.Field)(type => common_types_1.ScalarObject, { nullable: true }),
49
+ tslib_1.__metadata("design:type", Object)
50
+ ], AttributeSetItem.prototype, "options", void 0);
51
+ AttributeSetItem = tslib_1.__decorate([
52
+ (0, type_graphql_1.ObjectType)({ description: 'Entity for AttributeSetItem' })
53
+ ], AttributeSetItem);
54
+ exports.AttributeSetItem = AttributeSetItem;
55
+ let AttributeSetItemPatch = class AttributeSetItemPatch {
56
+ };
57
+ tslib_1.__decorate([
58
+ (0, type_graphql_1.Field)({ nullable: true }),
59
+ tslib_1.__metadata("design:type", String)
60
+ ], AttributeSetItemPatch.prototype, "name", void 0);
61
+ tslib_1.__decorate([
62
+ (0, type_graphql_1.Field)({ nullable: true }),
63
+ tslib_1.__metadata("design:type", String)
64
+ ], AttributeSetItemPatch.prototype, "description", void 0);
65
+ tslib_1.__decorate([
66
+ (0, type_graphql_1.Field)({ nullable: true }),
67
+ tslib_1.__metadata("design:type", String)
68
+ ], AttributeSetItemPatch.prototype, "tag", void 0);
69
+ tslib_1.__decorate([
70
+ (0, type_graphql_1.Field)(type => AttributeSetItemType, { nullable: true }),
71
+ tslib_1.__metadata("design:type", String)
72
+ ], AttributeSetItemPatch.prototype, "type", void 0);
73
+ tslib_1.__decorate([
74
+ (0, type_graphql_1.Field)(type => common_types_1.ScalarObject, { nullable: true }),
75
+ tslib_1.__metadata("design:type", Object)
76
+ ], AttributeSetItemPatch.prototype, "options", void 0);
77
+ tslib_1.__decorate([
78
+ (0, type_graphql_1.Field)({ nullable: true }),
79
+ tslib_1.__metadata("design:type", Boolean)
80
+ ], AttributeSetItemPatch.prototype, "active", void 0);
81
+ tslib_1.__decorate([
82
+ (0, type_graphql_1.Field)({ nullable: true }),
83
+ tslib_1.__metadata("design:type", Boolean)
84
+ ], AttributeSetItemPatch.prototype, "hidden", void 0);
85
+ AttributeSetItemPatch = tslib_1.__decorate([
86
+ (0, type_graphql_1.InputType)()
87
+ ], AttributeSetItemPatch);
88
+ exports.AttributeSetItemPatch = AttributeSetItemPatch;
89
+ //# sourceMappingURL=attribute-set-item-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attribute-set-item-type.js","sourceRoot":"","sources":["../../../server/service/attribute-set/attribute-set-item-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAkF;AAClF,kDAA8C;AAE9C,IAAY,oBAQX;AARD,WAAY,oBAAoB;IAC9B,yCAAiB,CAAA;IACjB,qCAAa,CAAA;IACb,2CAAmB,CAAA;IACnB,yCAAiB,CAAA;IACjB,qCAAa,CAAA;IACb,6CAAqB,CAAA;IACrB,qCAAa,CAAA;AACf,CAAC,EARW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAQ/B;AAED,IAAA,+BAAgB,EAAC,oBAAoB,EAAE;IACrC,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,0CAA0C;CACxD,CAAC,CAAA;AAGK,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAqB5B,CAAA;AApBC;IAAC,IAAA,oBAAK,GAAE;;8CACI;AAEZ;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDACN;AAEpB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACd;AAEZ;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACV;AAEhB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACV;AAEhB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACC;AAE3B;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,2BAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACb;AApBxB,gBAAgB;IAD5B,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,6BAA6B,EAAE,CAAC;GAC9C,gBAAgB,CAqB5B;AArBY,4CAAgB;AAwBtB,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;CAqBjC,CAAA;AApBC;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACb;AAEb;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0DACN;AAEpB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDACd;AAEZ;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,oBAAoB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDAC7B;AAE3B;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,2BAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;sDACb;AAEnC;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDACV;AAEhB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDACV;AApBL,qBAAqB;IADjC,IAAA,wBAAS,GAAE;GACC,qBAAqB,CAqBjC;AArBY,sDAAqB","sourcesContent":["import { Field, InputType, Int, ObjectType, registerEnumType } from 'type-graphql'\nimport { ScalarObject } from '../common-types'\n\nexport enum AttributeSetItemType {\n number = 'number',\n text = 'text',\n boolean = 'boolean',\n select = 'select',\n date = 'date',\n datetime = 'datetime',\n file = 'file'\n}\n\nregisterEnumType(AttributeSetItemType, {\n name: 'AttributeSetItemType',\n description: 'type enumeration of a attribute-set-item'\n})\n\n@ObjectType({ description: 'Entity for AttributeSetItem' })\nexport class AttributeSetItem {\n @Field()\n name: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field({ nullable: true })\n tag?: string\n\n @Field({ nullable: true })\n active?: boolean\n\n @Field({ nullable: true })\n hidden?: boolean\n\n @Field({ nullable: true })\n type?: AttributeSetItemType\n\n @Field(type => ScalarObject, { nullable: true })\n options?: { [option: string]: any }\n}\n\n@InputType()\nexport class AttributeSetItemPatch {\n @Field({ nullable: true })\n name?: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field({ nullable: true })\n tag?: string\n\n @Field(type => AttributeSetItemType, { nullable: true })\n type?: AttributeSetItemType\n\n @Field(type => ScalarObject, { nullable: true })\n options?: { [option: string]: any }\n\n @Field({ nullable: true })\n active?: boolean\n\n @Field({ nullable: true })\n hidden?: boolean\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import { AttributeSet } from './attribute-set';
2
+ import { NewAttributeSet, AttributeSetPatch } from './attribute-set-type';
3
+ export declare class AttributeSetMutation {
4
+ createAttributeSet(attribute: NewAttributeSet, context: any): Promise<AttributeSet>;
5
+ updateAttributeSet(id: string, patch: AttributeSetPatch, context: any): Promise<AttributeSet>;
6
+ updateMultipleAttributeSet(patches: AttributeSetPatch[], context: any): Promise<AttributeSet[]>;
7
+ deleteAttributeSet(id: string, context: any): Promise<boolean>;
8
+ deleteAttributeSets(ids: string[], context: any): Promise<boolean>;
9
+ importAttributeSets(attributes: AttributeSetPatch[], context: any): Promise<boolean>;
10
+ }
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AttributeSetMutation = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const type_graphql_1 = require("type-graphql");
6
+ const typeorm_1 = require("typeorm");
7
+ const attribute_set_1 = require("./attribute-set");
8
+ const attribute_set_type_1 = require("./attribute-set-type");
9
+ let AttributeSetMutation = class AttributeSetMutation {
10
+ async createAttributeSet(attribute, context) {
11
+ const { tx } = context.state;
12
+ return await tx.getRepository(attribute_set_1.AttributeSet).save(Object.assign({}, attribute));
13
+ }
14
+ async updateAttributeSet(id, patch, context) {
15
+ const { tx } = context.state;
16
+ const repository = tx.getRepository(attribute_set_1.AttributeSet);
17
+ const attribute = await repository.findOne({
18
+ where: { id }
19
+ });
20
+ return await repository.save(Object.assign(Object.assign({}, attribute), patch));
21
+ }
22
+ async updateMultipleAttributeSet(patches, context) {
23
+ const { tx } = context.state;
24
+ let results = [];
25
+ const _createRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === '+');
26
+ const _updateRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === 'M');
27
+ const attributeRepo = tx.getRepository(attribute_set_1.AttributeSet);
28
+ if (_createRecords.length > 0) {
29
+ for (let i = 0; i < _createRecords.length; i++) {
30
+ const newRecord = _createRecords[i];
31
+ const result = await attributeRepo.save(Object.assign({}, newRecord));
32
+ results.push(Object.assign(Object.assign({}, result), { cuFlag: '+' }));
33
+ }
34
+ }
35
+ if (_updateRecords.length > 0) {
36
+ for (let i = 0; i < _updateRecords.length; i++) {
37
+ const updateRecord = _updateRecords[i];
38
+ const attribute = await attributeRepo.findOneBy({ id: updateRecord.id });
39
+ const result = await attributeRepo.save(Object.assign(Object.assign({}, attribute), updateRecord));
40
+ results.push(Object.assign(Object.assign({}, result), { cuFlag: 'M' }));
41
+ }
42
+ }
43
+ return results;
44
+ }
45
+ async deleteAttributeSet(id, context) {
46
+ const { tx } = context.state;
47
+ await tx.getRepository(attribute_set_1.AttributeSet).delete({ id });
48
+ return true;
49
+ }
50
+ async deleteAttributeSets(ids, context) {
51
+ const { tx } = context.state;
52
+ await tx.getRepository(attribute_set_1.AttributeSet).delete({
53
+ id: (0, typeorm_1.In)(ids)
54
+ });
55
+ return true;
56
+ }
57
+ async importAttributeSets(attributes, context) {
58
+ const { tx } = context.state;
59
+ await Promise.all(attributes.map(async (attribute) => {
60
+ await tx.getRepository(attribute_set_1.AttributeSet).save(attribute);
61
+ }));
62
+ return true;
63
+ }
64
+ };
65
+ tslib_1.__decorate([
66
+ (0, type_graphql_1.Directive)('@transaction'),
67
+ (0, type_graphql_1.Directive)('@privilege(superUserGranted: true)'),
68
+ (0, type_graphql_1.Mutation)(returns => attribute_set_1.AttributeSet, { description: 'To create new AttributeSet' }),
69
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('attribute')),
70
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
71
+ tslib_1.__metadata("design:type", Function),
72
+ tslib_1.__metadata("design:paramtypes", [attribute_set_type_1.NewAttributeSet, Object]),
73
+ tslib_1.__metadata("design:returntype", Promise)
74
+ ], AttributeSetMutation.prototype, "createAttributeSet", null);
75
+ tslib_1.__decorate([
76
+ (0, type_graphql_1.Directive)('@transaction'),
77
+ (0, type_graphql_1.Directive)('@privilege(superUserGranted: true)'),
78
+ (0, type_graphql_1.Mutation)(returns => attribute_set_1.AttributeSet, { description: 'To modify AttributeSet information' }),
79
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
80
+ tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
81
+ tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
82
+ tslib_1.__metadata("design:type", Function),
83
+ tslib_1.__metadata("design:paramtypes", [String, attribute_set_type_1.AttributeSetPatch, Object]),
84
+ tslib_1.__metadata("design:returntype", Promise)
85
+ ], AttributeSetMutation.prototype, "updateAttributeSet", null);
86
+ tslib_1.__decorate([
87
+ (0, type_graphql_1.Directive)('@transaction'),
88
+ (0, type_graphql_1.Directive)('@privilege(superUserGranted: true)'),
89
+ (0, type_graphql_1.Mutation)(returns => [attribute_set_1.AttributeSet], { description: "To modify multiple AttributeSets' information" }),
90
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [attribute_set_type_1.AttributeSetPatch])),
91
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
92
+ tslib_1.__metadata("design:type", Function),
93
+ tslib_1.__metadata("design:paramtypes", [Array, Object]),
94
+ tslib_1.__metadata("design:returntype", Promise)
95
+ ], AttributeSetMutation.prototype, "updateMultipleAttributeSet", null);
96
+ tslib_1.__decorate([
97
+ (0, type_graphql_1.Directive)('@transaction'),
98
+ (0, type_graphql_1.Directive)('@privilege(superUserGranted: true)'),
99
+ (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete AttributeSet' }),
100
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
101
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
102
+ tslib_1.__metadata("design:type", Function),
103
+ tslib_1.__metadata("design:paramtypes", [String, Object]),
104
+ tslib_1.__metadata("design:returntype", Promise)
105
+ ], AttributeSetMutation.prototype, "deleteAttributeSet", null);
106
+ tslib_1.__decorate([
107
+ (0, type_graphql_1.Directive)('@transaction'),
108
+ (0, type_graphql_1.Directive)('@privilege(superUserGranted: true)'),
109
+ (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple AttributeSets' }),
110
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
111
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
112
+ tslib_1.__metadata("design:type", Function),
113
+ tslib_1.__metadata("design:paramtypes", [Array, Object]),
114
+ tslib_1.__metadata("design:returntype", Promise)
115
+ ], AttributeSetMutation.prototype, "deleteAttributeSets", null);
116
+ tslib_1.__decorate([
117
+ (0, type_graphql_1.Directive)('@transaction'),
118
+ (0, type_graphql_1.Directive)('@privilege(superUserGranted: true)'),
119
+ (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To import multiple AttributeSets' }),
120
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('attributes', type => [attribute_set_type_1.AttributeSetPatch])),
121
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
122
+ tslib_1.__metadata("design:type", Function),
123
+ tslib_1.__metadata("design:paramtypes", [Array, Object]),
124
+ tslib_1.__metadata("design:returntype", Promise)
125
+ ], AttributeSetMutation.prototype, "importAttributeSets", null);
126
+ AttributeSetMutation = tslib_1.__decorate([
127
+ (0, type_graphql_1.Resolver)(attribute_set_1.AttributeSet)
128
+ ], AttributeSetMutation);
129
+ exports.AttributeSetMutation = AttributeSetMutation;
130
+ //# sourceMappingURL=attribute-set-mutation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file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kBAAG,EAAC,YAAY,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,sCAAiB,CAAC,CAAC,CAAA;IAC9C,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;+DAWP;AApHU,oBAAoB;IADhC,IAAA,uBAAQ,EAAC,4BAAY,CAAC;GACV,oBAAoB,CAqHhC;AArHY,oDAAoB","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { AttributeSet } from './attribute-set'\nimport { NewAttributeSet, AttributeSetPatch } from './attribute-set-type'\n\n@Resolver(AttributeSet)\nexport class AttributeSetMutation {\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => AttributeSet, { description: 'To create new AttributeSet' })\n async createAttributeSet(@Arg('attribute') attribute: NewAttributeSet, @Ctx() context: any): Promise<AttributeSet> {\n const { tx } = context.state\n\n return await tx.getRepository(AttributeSet).save({\n ...attribute\n })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => AttributeSet, { description: 'To modify AttributeSet information' })\n async updateAttributeSet(\n @Arg('id') id: string,\n @Arg('patch') patch: AttributeSetPatch,\n @Ctx() context: any\n ): Promise<AttributeSet> {\n const { tx } = context.state\n\n const repository = tx.getRepository(AttributeSet)\n const attribute = await repository.findOne({\n where: { id }\n })\n\n return await repository.save({\n ...attribute,\n ...patch\n })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => [AttributeSet], { description: \"To modify multiple AttributeSets' information\" })\n async updateMultipleAttributeSet(\n @Arg('patches', type => [AttributeSetPatch]) patches: AttributeSetPatch[],\n @Ctx() context: any\n ): Promise<AttributeSet[]> {\n const { tx } = context.state\n\n let results = []\n const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')\n const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')\n const attributeRepo = tx.getRepository(AttributeSet)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n const newRecord = _createRecords[i]\n\n const result = await attributeRepo.save({\n ...newRecord\n })\n\n results.push({ ...result, cuFlag: '+' })\n }\n }\n\n if (_updateRecords.length > 0) {\n for (let i = 0; i < _updateRecords.length; i++) {\n const updateRecord = _updateRecords[i]\n const attribute = await attributeRepo.findOneBy({ id: updateRecord.id })\n\n const result = await attributeRepo.save({\n ...attribute,\n ...updateRecord\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete AttributeSet' })\n async deleteAttributeSet(@Arg('id') id: string, @Ctx() context: any): Promise<boolean> {\n const { tx } = context.state\n\n await tx.getRepository(AttributeSet).delete({ id })\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete multiple AttributeSets' })\n async deleteAttributeSets(@Arg('ids', type => [String]) ids: string[], @Ctx() context: any): Promise<boolean> {\n const { tx } = context.state\n\n await tx.getRepository(AttributeSet).delete({\n id: In(ids)\n })\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Boolean, { description: 'To import multiple AttributeSets' })\n async importAttributeSets(\n @Arg('attributes', type => [AttributeSetPatch]) attributes: AttributeSetPatch[],\n @Ctx() context: any\n ): Promise<boolean> {\n const { tx } = context.state\n\n await Promise.all(\n attributes.map(async (attribute: AttributeSetPatch) => {\n await tx.getRepository(AttributeSet).save(attribute)\n })\n )\n\n return true\n }\n}\n"]}
@@ -0,0 +1,8 @@
1
+ import { AttributeSet } from './attribute-set';
2
+ import { AttributeSetList } from './attribute-set-type';
3
+ import { ListParam } from '../common-types';
4
+ export declare class AttributeSetQuery {
5
+ attributeSet(id: string, context: any): Promise<AttributeSet>;
6
+ attributeSetByEntity(entity: string, context: any): Promise<AttributeSet>;
7
+ attributeSets(params: ListParam, context: any): Promise<AttributeSetList>;
8
+ }
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AttributeSetQuery = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const type_graphql_1 = require("type-graphql");
6
+ const attribute_set_1 = require("./attribute-set");
7
+ const attribute_set_type_1 = require("./attribute-set-type");
8
+ const common_types_1 = require("../common-types");
9
+ const database_1 = require("../../initializers/database");
10
+ const utils_1 = require("../../utils");
11
+ let AttributeSetQuery = class AttributeSetQuery {
12
+ async attributeSet(id, context) {
13
+ return await (0, database_1.getRepository)(attribute_set_1.AttributeSet).findOne({
14
+ where: { id }
15
+ });
16
+ }
17
+ async attributeSetByEntity(entity, context) {
18
+ return await (0, database_1.getRepository)(attribute_set_1.AttributeSet).findOne({
19
+ where: { entity }
20
+ });
21
+ }
22
+ async attributeSets(params, context) {
23
+ const queryBuilder = (0, utils_1.getQueryBuilderFromListParams)({
24
+ params,
25
+ repository: await (0, database_1.getRepository)(attribute_set_1.AttributeSet),
26
+ searchables: ['entity', 'description']
27
+ });
28
+ const [items, total] = await queryBuilder.getManyAndCount();
29
+ return { items, total };
30
+ }
31
+ };
32
+ tslib_1.__decorate([
33
+ (0, type_graphql_1.Query)(returns => attribute_set_1.AttributeSet, { nullable: true, description: 'To fetch a AttributeSet' }),
34
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
35
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
36
+ tslib_1.__metadata("design:type", Function),
37
+ tslib_1.__metadata("design:paramtypes", [String, Object]),
38
+ tslib_1.__metadata("design:returntype", Promise)
39
+ ], AttributeSetQuery.prototype, "attributeSet", null);
40
+ tslib_1.__decorate([
41
+ (0, type_graphql_1.Query)(returns => attribute_set_1.AttributeSet, { nullable: true, description: 'To fetch a AttributeSet by Entity name' }),
42
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('entity')),
43
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
44
+ tslib_1.__metadata("design:type", Function),
45
+ tslib_1.__metadata("design:paramtypes", [String, Object]),
46
+ tslib_1.__metadata("design:returntype", Promise)
47
+ ], AttributeSetQuery.prototype, "attributeSetByEntity", null);
48
+ tslib_1.__decorate([
49
+ (0, type_graphql_1.Query)(returns => attribute_set_type_1.AttributeSetList, { description: 'To fetch multiple AttributeSets' }),
50
+ tslib_1.__param(0, (0, type_graphql_1.Args)()),
51
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
52
+ tslib_1.__metadata("design:type", Function),
53
+ tslib_1.__metadata("design:paramtypes", [common_types_1.ListParam, Object]),
54
+ tslib_1.__metadata("design:returntype", Promise)
55
+ ], AttributeSetQuery.prototype, "attributeSets", null);
56
+ AttributeSetQuery = tslib_1.__decorate([
57
+ (0, type_graphql_1.Resolver)(attribute_set_1.AttributeSet)
58
+ ], AttributeSetQuery);
59
+ exports.AttributeSetQuery = AttributeSetQuery;
60
+ //# sourceMappingURL=attribute-set-query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attribute-set-query.js","sourceRoot":"","sources":["../../../server/service/attribute-set/attribute-set-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,mDAA8C;AAC9C,6DAAuD;AACvD,kDAA2C;AAC3C,0DAA2D;AAC3D,uCAA2D;AAGpD,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAEtB,AAAN,KAAK,CAAC,YAAY,CAAY,EAAU,EAAS,OAAY;QAC3D,OAAO,MAAM,IAAA,wBAAa,EAAC,4BAAY,CAAC,CAAC,OAAO,CAAC;YAC/C,KAAK,EAAE,EAAE,EAAE,EAAE;SACd,CAAC,CAAA;IACJ,CAAC;IAGK,AAAN,KAAK,CAAC,oBAAoB,CAAgB,MAAc,EAAS,OAAY;QAC3E,OAAO,MAAM,IAAA,wBAAa,EAAC,4BAAY,CAAC,CAAC,OAAO,CAAC;YAC/C,KAAK,EAAE,EAAE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FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'\nimport { AttributeSet } from './attribute-set'\nimport { AttributeSetList } from './attribute-set-type'\nimport { ListParam } from '../common-types'\nimport { getRepository } from '../../initializers/database'\nimport { getQueryBuilderFromListParams } from '../../utils'\n\n@Resolver(AttributeSet)\nexport class AttributeSetQuery {\n @Query(returns => AttributeSet!, { nullable: true, description: 'To fetch a AttributeSet' })\n async attributeSet(@Arg('id') id: string, @Ctx() context: any): Promise<AttributeSet> {\n return await getRepository(AttributeSet).findOne({\n where: { id }\n })\n }\n\n @Query(returns => AttributeSet!, { nullable: true, description: 'To fetch a AttributeSet by Entity name' })\n async attributeSetByEntity(@Arg('entity') entity: string, @Ctx() context: any): Promise<AttributeSet> {\n return await getRepository(AttributeSet).findOne({\n where: { entity }\n })\n }\n\n @Query(returns => AttributeSetList, { description: 'To fetch multiple AttributeSets' })\n async attributeSets(@Args() params: ListParam, @Ctx() context: any): Promise<AttributeSetList> {\n const queryBuilder = getQueryBuilderFromListParams({\n params,\n repository: await getRepository(AttributeSet),\n searchables: ['entity', 'description']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n}\n"]}
@@ -0,0 +1,19 @@
1
+ import { AttributeSet } from './attribute-set';
2
+ import { AttributeSetItemPatch } from './attribute-set-item-type';
3
+ export declare class NewAttributeSet {
4
+ entity: string;
5
+ description?: string;
6
+ items?: AttributeSetItemPatch[];
7
+ active?: boolean;
8
+ }
9
+ export declare class AttributeSetPatch {
10
+ id?: string;
11
+ entity?: string;
12
+ description?: string;
13
+ items?: AttributeSetItemPatch[];
14
+ cuFlag?: string;
15
+ }
16
+ export declare class AttributeSetList {
17
+ items: AttributeSet[];
18
+ total: number;
19
+ }
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AttributeSetList = exports.AttributeSetPatch = exports.NewAttributeSet = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const type_graphql_1 = require("type-graphql");
6
+ const attribute_set_1 = require("./attribute-set");
7
+ const attribute_set_item_type_1 = require("./attribute-set-item-type");
8
+ let NewAttributeSet = class NewAttributeSet {
9
+ };
10
+ tslib_1.__decorate([
11
+ (0, type_graphql_1.Field)(),
12
+ tslib_1.__metadata("design:type", String)
13
+ ], NewAttributeSet.prototype, "entity", void 0);
14
+ tslib_1.__decorate([
15
+ (0, type_graphql_1.Field)({ nullable: true }),
16
+ tslib_1.__metadata("design:type", String)
17
+ ], NewAttributeSet.prototype, "description", void 0);
18
+ tslib_1.__decorate([
19
+ (0, type_graphql_1.Field)(type => [attribute_set_item_type_1.AttributeSetItemPatch], { nullable: true }),
20
+ tslib_1.__metadata("design:type", Array)
21
+ ], NewAttributeSet.prototype, "items", void 0);
22
+ tslib_1.__decorate([
23
+ (0, type_graphql_1.Field)({ nullable: true }),
24
+ tslib_1.__metadata("design:type", Boolean)
25
+ ], NewAttributeSet.prototype, "active", void 0);
26
+ NewAttributeSet = tslib_1.__decorate([
27
+ (0, type_graphql_1.InputType)()
28
+ ], NewAttributeSet);
29
+ exports.NewAttributeSet = NewAttributeSet;
30
+ let AttributeSetPatch = class AttributeSetPatch {
31
+ };
32
+ tslib_1.__decorate([
33
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
34
+ tslib_1.__metadata("design:type", String)
35
+ ], AttributeSetPatch.prototype, "id", void 0);
36
+ tslib_1.__decorate([
37
+ (0, type_graphql_1.Field)({ nullable: true }),
38
+ tslib_1.__metadata("design:type", String)
39
+ ], AttributeSetPatch.prototype, "entity", void 0);
40
+ tslib_1.__decorate([
41
+ (0, type_graphql_1.Field)({ nullable: true }),
42
+ tslib_1.__metadata("design:type", String)
43
+ ], AttributeSetPatch.prototype, "description", void 0);
44
+ tslib_1.__decorate([
45
+ (0, type_graphql_1.Field)(type => [attribute_set_item_type_1.AttributeSetItemPatch], { nullable: true }),
46
+ tslib_1.__metadata("design:type", Array)
47
+ ], AttributeSetPatch.prototype, "items", void 0);
48
+ tslib_1.__decorate([
49
+ (0, type_graphql_1.Field)({ nullable: true }),
50
+ tslib_1.__metadata("design:type", String)
51
+ ], AttributeSetPatch.prototype, "cuFlag", void 0);
52
+ AttributeSetPatch = tslib_1.__decorate([
53
+ (0, type_graphql_1.InputType)()
54
+ ], AttributeSetPatch);
55
+ exports.AttributeSetPatch = AttributeSetPatch;
56
+ let AttributeSetList = class AttributeSetList {
57
+ };
58
+ tslib_1.__decorate([
59
+ (0, type_graphql_1.Field)(type => [attribute_set_1.AttributeSet]),
60
+ tslib_1.__metadata("design:type", Array)
61
+ ], AttributeSetList.prototype, "items", void 0);
62
+ tslib_1.__decorate([
63
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int),
64
+ tslib_1.__metadata("design:type", Number)
65
+ ], AttributeSetList.prototype, "total", void 0);
66
+ AttributeSetList = tslib_1.__decorate([
67
+ (0, type_graphql_1.ObjectType)()
68
+ ], AttributeSetList);
69
+ exports.AttributeSetList = AttributeSetList;
70
+ //# sourceMappingURL=attribute-set-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attribute-set-type.js","sourceRoot":"","sources":["../../../server/service/attribute-set/attribute-set-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAoE;AAEpE,mDAA8C;AAC9C,uEAAiE;AAG1D,IAAM,eAAe,GAArB,MAAM,eAAe;CAY3B,CAAA;AAXC;IAAC,IAAA,oBAAK,GAAE;;+CACM;AAEd;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;oDACN;AAEpB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,+CAAqB,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CAC5B;AAE/B;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACV;AAXL,eAAe;IAD3B,IAAA,wBAAS,GAAE;GACC,eAAe,CAY3B;AAZY,0CAAe;AAerB,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;CAe7B,CAAA;AAdC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CAC3B;AAEX;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACX;AAEf;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;sDACN;AAEpB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,+CAAqB,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDAC5B;AAE/B;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACX;AAdJ,iBAAiB;IAD7B,IAAA,wBAAS,GAAE;GACC,iBAAiB,CAe7B;AAfY,8CAAiB;AAkBvB,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAM5B,CAAA;AALC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,4BAAY,CAAC,CAAC;;+CACT;AAErB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;+CACN;AALF,gBAAgB;IAD5B,IAAA,yBAAU,GAAE;GACA,gBAAgB,CAM5B;AANY,4CAAgB","sourcesContent":["import { ObjectType, Field, InputType, Int, ID } from 'type-graphql'\n\nimport { AttributeSet } from './attribute-set'\nimport { AttributeSetItemPatch } from './attribute-set-item-type'\n\n@InputType()\nexport class NewAttributeSet {\n @Field()\n entity: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field(type => [AttributeSetItemPatch], { nullable: true })\n items?: AttributeSetItemPatch[]\n\n @Field({ nullable: true })\n active?: boolean\n}\n\n@InputType()\nexport class AttributeSetPatch {\n @Field(type => ID, { nullable: true })\n id?: string\n\n @Field({ nullable: true })\n entity?: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field(type => [AttributeSetItemPatch], { nullable: true })\n items?: AttributeSetItemPatch[]\n\n @Field({ nullable: true })\n cuFlag?: string\n}\n\n@ObjectType()\nexport class AttributeSetList {\n @Field(type => [AttributeSet])\n items: AttributeSet[]\n\n @Field(type => Int)\n total: number\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import { AttributeSetItem } from './attribute-set-item-type';
2
+ export declare class AttributeSet {
3
+ readonly id: string;
4
+ entity: string;
5
+ description: string;
6
+ items: AttributeSetItem[];
7
+ createdAt?: Date;
8
+ updatedAt?: Date;
9
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AttributeSet = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const typeorm_1 = require("typeorm");
6
+ const type_graphql_1 = require("type-graphql");
7
+ const attribute_set_item_type_1 = require("./attribute-set-item-type");
8
+ let AttributeSet = class AttributeSet {
9
+ constructor() {
10
+ this.entity = '';
11
+ this.description = '';
12
+ }
13
+ };
14
+ tslib_1.__decorate([
15
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
16
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID),
17
+ tslib_1.__metadata("design:type", String)
18
+ ], AttributeSet.prototype, "id", void 0);
19
+ tslib_1.__decorate([
20
+ (0, typeorm_1.Column)({ nullable: true, default: '' }),
21
+ (0, type_graphql_1.Field)({ nullable: true }),
22
+ tslib_1.__metadata("design:type", String)
23
+ ], AttributeSet.prototype, "entity", void 0);
24
+ tslib_1.__decorate([
25
+ (0, typeorm_1.Column)({ nullable: true, default: '' }),
26
+ (0, type_graphql_1.Field)({ nullable: true }),
27
+ tslib_1.__metadata("design:type", String)
28
+ ], AttributeSet.prototype, "description", void 0);
29
+ tslib_1.__decorate([
30
+ (0, typeorm_1.Column)('simple-json', { nullable: true }),
31
+ (0, type_graphql_1.Field)(type => [attribute_set_item_type_1.AttributeSetItem], { nullable: true }),
32
+ tslib_1.__metadata("design:type", Array)
33
+ ], AttributeSet.prototype, "items", void 0);
34
+ tslib_1.__decorate([
35
+ (0, typeorm_1.CreateDateColumn)(),
36
+ (0, type_graphql_1.Field)({ nullable: true }),
37
+ tslib_1.__metadata("design:type", Date)
38
+ ], AttributeSet.prototype, "createdAt", void 0);
39
+ tslib_1.__decorate([
40
+ (0, typeorm_1.UpdateDateColumn)(),
41
+ (0, type_graphql_1.Field)({ nullable: true }),
42
+ tslib_1.__metadata("design:type", Date)
43
+ ], AttributeSet.prototype, "updatedAt", void 0);
44
+ AttributeSet = tslib_1.__decorate([
45
+ (0, typeorm_1.Entity)(),
46
+ (0, typeorm_1.Index)('ix_attribute_set_0', (attributeSet) => [attributeSet.entity], {
47
+ unique: true
48
+ }),
49
+ (0, type_graphql_1.ObjectType)({ description: 'Entity for AttributeSet' })
50
+ ], AttributeSet);
51
+ exports.AttributeSet = AttributeSet;
52
+ //# sourceMappingURL=attribute-set.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attribute-set.js","sourceRoot":"","sources":["../../../server/service/attribute-set/attribute-set.ts"],"names":[],"mappings":";;;;AAAA,qCAA2G;AAC3G,+CAAoD;AAEpD,uEAA4D;AAOrD,IAAM,YAAY,GAAlB,MAAM,YAAY;IAAlB;QAOL,WAAM,GAAW,EAAE,CAAA;QAInB,gBAAW,GAAW,EAAE,CAAA;IAa1B,CAAC;CAAA,CAAA;AAvBC;IAAC,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;wCACC;AAEnB;IAAC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACvC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACP;AAEnB;IAAC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACvC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACF;AAExB;IAAC,IAAA,gBAAM,EAAC,aAAa,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACzC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,0CAAgB,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CAC7B;AAEzB;IAAC,IAAA,0BAAgB,GAAE;IAClB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACd,IAAI;+CAAA;AAEhB;IAAC,IAAA,0BAAgB,GAAE;IAClB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACd,IAAI;+CAAA;AAvBL,YAAY;IALxB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,oBAAoB,EAAE,CAAC,YAA0B,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE;QAClF,MAAM,EAAE,IAAI;KACb,CAAC;IACD,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,yBAAyB,EAAE,CAAC;GAC1C,YAAY,CAwBxB;AAxBY,oCAAY","sourcesContent":["import { CreateDateColumn, UpdateDateColumn, Entity, Index, Column, PrimaryGeneratedColumn } from 'typeorm'\nimport { ObjectType, Field, ID } from 'type-graphql'\n\nimport { AttributeSetItem } from './attribute-set-item-type'\n\n@Entity()\n@Index('ix_attribute_set_0', (attributeSet: AttributeSet) => [attributeSet.entity], {\n unique: true\n})\n@ObjectType({ description: 'Entity for AttributeSet' })\nexport class AttributeSet {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @Column({ nullable: true, default: '' })\n @Field({ nullable: true })\n entity: string = ''\n\n @Column({ nullable: true, default: '' })\n @Field({ nullable: true })\n description: string = ''\n\n @Column('simple-json', { nullable: true })\n @Field(type => [AttributeSetItem], { nullable: true })\n items: AttributeSetItem[]\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt?: Date\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import { AttributeSet } from './attribute-set';
2
+ import { AttributeSetQuery } from './attribute-set-query';
3
+ import { AttributeSetMutation } from './attribute-set-mutation';
4
+ export declare const entities: (typeof AttributeSet)[];
5
+ export declare const resolvers: (typeof AttributeSetQuery | typeof AttributeSetMutation)[];
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolvers = exports.entities = void 0;
4
+ const attribute_set_1 = require("./attribute-set");
5
+ const attribute_set_query_1 = require("./attribute-set-query");
6
+ const attribute_set_mutation_1 = require("./attribute-set-mutation");
7
+ exports.entities = [attribute_set_1.AttributeSet];
8
+ exports.resolvers = [attribute_set_query_1.AttributeSetQuery, attribute_set_mutation_1.AttributeSetMutation];
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/attribute-set/index.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;AAC9C,+DAAyD;AACzD,qEAA+D;AAElD,QAAA,QAAQ,GAAG,CAAC,4BAAY,CAAC,CAAA;AACzB,QAAA,SAAS,GAAG,CAAC,uCAAiB,EAAE,6CAAoB,CAAC,CAAA","sourcesContent":["import { AttributeSet } from './attribute-set'\nimport { AttributeSetQuery } from './attribute-set-query'\nimport { AttributeSetMutation } from './attribute-set-mutation'\n\nexport const entities = [AttributeSet]\nexport const resolvers = [AttributeSetQuery, AttributeSetMutation]\n"]}
@@ -2,7 +2,7 @@ import { ListParam } from '../common-types/list-param';
2
2
  import { Domain } from './domain';
3
3
  import { DomainList, DomainPatch } from './domain-types';
4
4
  export declare class DomainResolver {
5
- domain(id: string): Promise<Domain>;
5
+ domain(id: string, context: any): Promise<Domain>;
6
6
  domains(params: ListParam, context: any): Promise<DomainList>;
7
7
  createDomain(domainInput: DomainPatch): Promise<{
8
8
  name: string;
@@ -11,7 +11,7 @@ const list_param_1 = require("../common-types/list-param");
11
11
  const domain_1 = require("./domain");
12
12
  const domain_types_1 = require("./domain-types");
13
13
  let DomainResolver = class DomainResolver {
14
- async domain(id) {
14
+ async domain(id, context) {
15
15
  const repository = (0, database_1.getRepository)(domain_1.Domain);
16
16
  return await repository.findOneBy({ id });
17
17
  }
@@ -77,8 +77,9 @@ tslib_1.__decorate([
77
77
  (0, type_graphql_1.Directive)('@privilege(category: "system", privilege: "query", domainOwnerGranted: true, superUserGranted: true)'),
78
78
  (0, type_graphql_1.Query)(returns => domain_1.Domain, { description: 'To fetch domain' }),
79
79
  tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
80
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
80
81
  tslib_1.__metadata("design:type", Function),
81
- tslib_1.__metadata("design:paramtypes", [String]),
82
+ tslib_1.__metadata("design:paramtypes", [String, Object]),
82
83
  tslib_1.__metadata("design:returntype", Promise)
83
84
  ], DomainResolver.prototype, "domain", null);
84
85
  tslib_1.__decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"domain-resolver.js","sourceRoot":"","sources":["../../../server/service/domain/domain-resolver.ts"],"names":[],"mappings":";;;;AAAA,+CAAmF;AACnF,qCAAwC;AAExC,iDAA+C;AAE/C,0DAA2D;AAC3D,uGAA8F;AAE9F,2DAAsD;AACtD,qCAAiC;AACjC,iDAAwD;AAGjD,IAAM,cAAc,GAApB,MAAM,cAAc;IAGnB,AAAN,KAAK,CAAC,MAAM,CAAY,EAAU;QAChC,MAAM,UAAU,GAAG,IAAA,wBAAa,EAAC,eAAM,CAAC,CAAA;QAExC,OAAO,MAAM,UAAU,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC,CAAA;I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IALL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,oCAAoC,CAAC;IAC/C,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE;QAC5B,WAAW,EAAE,wEAAwE;KACtF,CAAC;IACmB,mBAAA,IAAA,kBAAG,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;;;;mDAKhD;AAOK;IALL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,oCAAoC,CAAC;IAC/C,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,eAAM,EAAE;QAC3B,WAAW,EAAE,8DAA8D;KAC5E,CAAC;IACkB,mBAAA,IAAA,kBAAG,EAAC,MAAM,CAAC,CAAA;IAAgB,mBAAA,IAAA,kBAAG,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,0BAAW,CAAC,CAAA;;qDAAQ,0BAAW;;kDAQhG;AAOK;IALL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,oCAAoC,CAAC;IAC/C,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE;QAC5B,WAAW,EAAE,wEAAwE;KACtF,CAAC;IACmB,mBAAA,IAAA,kBAAG,EAAC,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC,0BAAW,CAAC,CAAC,CAAA;;;;mDAqBvD;AAjHU,cAAc;IAD1B,IAAA,uBAAQ,EAAC,eAAM,CAAC;GACJ,cAAc,CAkH1B;AAlHY,wCAAc","sourcesContent":["import { Arg, Args, Ctx, Directive, Mutation, Query, Resolver } from 'type-graphql'\nimport { In, Repository } from 'typeorm'\n\nimport { slugger } from '@things-factory/utils'\n\nimport { getRepository } from '../../initializers/database'\nimport { getQueryBuilderFromListParams } from '../../utils/get-query-builder-from-list-params'\n\nimport { ListParam } from '../common-types/list-param'\nimport { Domain } from './domain'\nimport { DomainList, DomainPatch } from './domain-types'\n\n@Resolver(Domain)\nexport class DomainResolver {\n @Directive('@privilege(category: \"system\", privilege: \"query\", domainOwnerGranted: true, superUserGranted: true)')\n @Query(returns => Domain, { description: 'To fetch domain' })\n async domain(@Arg('id') id: string): Promise<Domain> {\n const repository = getRepository(Domain)\n\n return await repository.findOneBy({ id })\n }\n\n @Directive('@privilege(superUserGranted: true)')\n @Query(returns => DomainList, { description: 'To fetch all domains (Only superuser is granted this privilege.)' })\n async domains(@Args() params: ListParam, @Ctx() context: any): Promise<DomainList> {\n const queryBuilder = await getQueryBuilderFromListParams({\n repository: getRepository(Domain),\n alias: 'ContactPoint',\n params,\n searchables: ['name', 'description', 'subdomain']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n // @Query(returns => Boolean, { description: 'To check if given domain is exist' })\n // async checkExistsDomain(@Arg('name') name: string) {\n // const domainRepository: Repository<Domain> = getRepository(Domain)\n // const targetSubdomain: string = slugger(name)\n\n // const oldDomain = await domainRepository.findOneBy({ subdomain: targetSubdomain })\n // if (oldDomain) {\n // throw new Error('domain is duplicated')\n // }\n\n // return true\n // }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Domain, { description: 'To create domain (Only superuser is granted this privilege.)' })\n async createDomain(@Arg('domainInput') domainInput: DomainPatch) {\n const { name, description } = domainInput\n const domainRepo: Repository<Domain> = getRepository(Domain)\n const subdomain: string = slugger(name)\n\n const domain: Domain = await domainRepo.findOneBy({ subdomain })\n if (domain) {\n throw new Error('domain is duplicated')\n }\n\n return await domainRepo.save({ name, description, subdomain })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Domain, { description: 'To delete domain (Only superuser is granted this privilege.)' })\n async deleteDomain(@Arg('name') name: string) {\n return await getRepository(Domain).delete({ name })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Boolean, {\n description: 'To delete multiple domains (Only superuser is granted this privilege.)'\n })\n async deleteDomains(@Arg('names', () => [String]) names: string[]) {\n const domains: Domain[] = await getRepository(Domain).find({ where: { name: In(names) } })\n const domainIds: string[] = domains.map(domain => domain.id)\n\n await getRepository(Domain).delete({ id: In(domainIds) })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Domain, {\n description: 'To update domain (Only superuser is granted this privilege.)'\n })\n async updateDomain(@Arg('name') name: string, @Arg('patch', () => DomainPatch) patch: DomainPatch) {\n const repository = getRepository(Domain)\n const domain: Domain = await repository.findOneBy({ name })\n\n return await repository.save({\n ...domain,\n ...patch\n } as any)\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Boolean, {\n description: 'To update multiple domains (Only superuser is granted this privilege.)'\n })\n async updateDomains(@Arg('patches', () => [DomainPatch]) patches: DomainPatch[]): Promise<boolean> {\n const domainRepo: Repository<Domain> = getRepository(Domain)\n\n const patchIds = patches.filter((patch: any) => patch.id)\n\n if (patchIds.length > 0) {\n patchIds.forEach(async updateRecord => {\n const domain: Domain = await domainRepo.findOne({ where: { id: updateRecord.id } })\n\n if (updateRecord.name) {\n updateRecord.subdomain = slugger(updateRecord.name)\n }\n\n await domainRepo.save({\n ...domain,\n ...updateRecord\n } as any)\n })\n }\n\n return true\n }\n}\n"]}
1
+ {"version":3,"file":"domain-resolver.js","sourceRoot":"","sources":["../../../server/service/domain/domain-resolver.ts"],"names":[],"mappings":";;;;AAAA,+CAAmF;AACnF,qCAAwC;AAExC,iDAA+C;AAE/C,0DAA2D;AAC3D,uGAA8F;AAE9F,2DAAsD;AACtD,qCAAiC;AACjC,iDAAwD;AAGjD,IAAM,cAAc,GAApB,MAAM,cAAc;IAGnB,AAAN,KAAK,CAAC,MAAM,CAAY,EAAU,EAAS,OAAY;QACrD,MAAM,UAAU,GAAG,IAAA,wBAAa,EAAC,eAAM,CAAC,CAAA;QAExC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,EAAE,WAAW,EAAE,8DAA8D,EAAE,CAAC;IACzF,mBAAA,IAAA,kBAAG,EAAC,MAAM,CAAC,CAAA;;;;kDAE9B;AAOK;IALL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,oCAAoC,CAAC;IAC/C,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE;QAC5B,WAAW,EAAE,wEAAwE;KACtF,CAAC;IACmB,mBAAA,IAAA,kBAAG,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;;;;mDAKhD;AAOK;IALL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,oCAAoC,CAAC;IAC/C,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,eAAM,EAAE;QAC3B,WAAW,EAAE,8DAA8D;KAC5E,CAAC;IACkB,mBAAA,IAAA,kBAAG,EAAC,MAAM,CAAC,CAAA;IAAgB,mBAAA,IAAA,kBAAG,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,0BAAW,CAAC,CAAA;;qDAAQ,0BAAW;;kDAQhG;AAOK;IALL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,oCAAoC,CAAC;IAC/C,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE;QAC5B,WAAW,EAAE,wEAAwE;KACtF,CAAC;IACmB,mBAAA,IAAA,kBAAG,EAAC,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC,0BAAW,CAAC,CAAC,CAAA;;;;mDAqBvD;AAjHU,cAAc;IAD1B,IAAA,uBAAQ,EAAC,eAAM,CAAC;GACJ,cAAc,CAkH1B;AAlHY,wCAAc","sourcesContent":["import { Arg, Args, Ctx, Directive, Mutation, Query, Resolver } from 'type-graphql'\nimport { In, Repository } from 'typeorm'\n\nimport { slugger } from '@things-factory/utils'\n\nimport { getRepository } from '../../initializers/database'\nimport { getQueryBuilderFromListParams } from '../../utils/get-query-builder-from-list-params'\n\nimport { ListParam } from '../common-types/list-param'\nimport { Domain } from './domain'\nimport { DomainList, DomainPatch } from './domain-types'\n\n@Resolver(Domain)\nexport class DomainResolver {\n @Directive('@privilege(category: \"system\", privilege: \"query\", domainOwnerGranted: true, superUserGranted: true)')\n @Query(returns => Domain, { description: 'To fetch domain' })\n async domain(@Arg('id') id: string, @Ctx() context: any): Promise<Domain> {\n const repository = getRepository(Domain)\n\n return await repository.findOneBy({ id })\n }\n\n @Directive('@privilege(superUserGranted: true)')\n @Query(returns => DomainList, { description: 'To fetch all domains (Only superuser is granted this privilege.)' })\n async domains(@Args() params: ListParam, @Ctx() context: any): Promise<DomainList> {\n const queryBuilder = await getQueryBuilderFromListParams({\n repository: getRepository(Domain),\n alias: 'ContactPoint',\n params,\n searchables: ['name', 'description', 'subdomain']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n // @Query(returns => Boolean, { description: 'To check if given domain is exist' })\n // async checkExistsDomain(@Arg('name') name: string) {\n // const domainRepository: Repository<Domain> = getRepository(Domain)\n // const targetSubdomain: string = slugger(name)\n\n // const oldDomain = await domainRepository.findOneBy({ subdomain: targetSubdomain })\n // if (oldDomain) {\n // throw new Error('domain is duplicated')\n // }\n\n // return true\n // }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Domain, { description: 'To create domain (Only superuser is granted this privilege.)' })\n async createDomain(@Arg('domainInput') domainInput: DomainPatch) {\n const { name, description } = domainInput\n const domainRepo: Repository<Domain> = getRepository(Domain)\n const subdomain: string = slugger(name)\n\n const domain: Domain = await domainRepo.findOneBy({ subdomain })\n if (domain) {\n throw new Error('domain is duplicated')\n }\n\n return await domainRepo.save({ name, description, subdomain })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Domain, { description: 'To delete domain (Only superuser is granted this privilege.)' })\n async deleteDomain(@Arg('name') name: string) {\n return await getRepository(Domain).delete({ name })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Boolean, {\n description: 'To delete multiple domains (Only superuser is granted this privilege.)'\n })\n async deleteDomains(@Arg('names', () => [String]) names: string[]) {\n const domains: Domain[] = await getRepository(Domain).find({ where: { name: In(names) } })\n const domainIds: string[] = domains.map(domain => domain.id)\n\n await getRepository(Domain).delete({ id: In(domainIds) })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Domain, {\n description: 'To update domain (Only superuser is granted this privilege.)'\n })\n async updateDomain(@Arg('name') name: string, @Arg('patch', () => DomainPatch) patch: DomainPatch) {\n const repository = getRepository(Domain)\n const domain: Domain = await repository.findOneBy({ name })\n\n return await repository.save({\n ...domain,\n ...patch\n } as any)\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Boolean, {\n description: 'To update multiple domains (Only superuser is granted this privilege.)'\n })\n async updateDomains(@Arg('patches', () => [DomainPatch]) patches: DomainPatch[]): Promise<boolean> {\n const domainRepo: Repository<Domain> = getRepository(Domain)\n\n const patchIds = patches.filter((patch: any) => patch.id)\n\n if (patchIds.length > 0) {\n patchIds.forEach(async updateRecord => {\n const domain: Domain = await domainRepo.findOne({ where: { id: updateRecord.id } })\n\n if (updateRecord.name) {\n updateRecord.subdomain = slugger(updateRecord.name)\n }\n\n await domainRepo.save({\n ...domain,\n ...updateRecord\n } as any)\n })\n }\n\n return true\n }\n}\n"]}
@@ -13,6 +13,7 @@ export declare class DomainPatch {
13
13
  brandName?: string;
14
14
  brandImage?: string;
15
15
  contentImage?: string;
16
+ attributes?: any;
16
17
  theme?: string;
17
18
  }
18
19
  export declare class DomainList {