@things-factory/dataset 5.0.11 → 5.0.14

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.
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.DataItemMutation = void 0;
16
+ const type_graphql_1 = require("type-graphql");
17
+ const typeorm_1 = require("typeorm");
18
+ const data_set_1 = require("../data-set/data-set");
19
+ const data_item_1 = require("./data-item");
20
+ const data_item_type_1 = require("./data-item-type");
21
+ let DataItemMutation = class DataItemMutation {
22
+ async updateMultipleDataItem(dataSetId, patches, context) {
23
+ const { domain, user, tx } = context.state;
24
+ let results = [];
25
+ const dataItemRepo = tx.getRepository(data_item_1.DataItem);
26
+ const dataSet = await tx.getRepository(data_set_1.DataSet).findOne(dataSetId);
27
+ await dataItemRepo.delete({ domain, dataSet: dataSetId });
28
+ for (let i = 0; i < patches.length; i++) {
29
+ const result = await dataItemRepo.save(Object.assign(Object.assign({ quota: 1 }, patches[i]), { sequence: i, dataSet,
30
+ domain, creator: user, updater: user }));
31
+ results.push(Object.assign(Object.assign({}, result), { cuFlag: '+' }));
32
+ }
33
+ return results;
34
+ }
35
+ async deleteDataItems(ids, context) {
36
+ const { domain, tx } = context.state;
37
+ await tx.getRepository(data_item_1.DataItem).delete({
38
+ domain,
39
+ id: (0, typeorm_1.In)(ids)
40
+ });
41
+ return true;
42
+ }
43
+ };
44
+ __decorate([
45
+ (0, type_graphql_1.Directive)('@privilege(category: "data-set", privilege: "mutation", domainOwnerGranted: true)'),
46
+ (0, type_graphql_1.Directive)('@transaction'),
47
+ (0, type_graphql_1.Mutation)(returns => [data_item_1.DataItem], { description: "To modify multiple DataItems' information" }),
48
+ __param(0, (0, type_graphql_1.Arg)('dataSetId')),
49
+ __param(1, (0, type_graphql_1.Arg)('patches', type => [data_item_type_1.DataItemPatch])),
50
+ __param(2, (0, type_graphql_1.Ctx)()),
51
+ __metadata("design:type", Function),
52
+ __metadata("design:paramtypes", [String, Array, Object]),
53
+ __metadata("design:returntype", Promise)
54
+ ], DataItemMutation.prototype, "updateMultipleDataItem", null);
55
+ __decorate([
56
+ (0, type_graphql_1.Directive)('@privilege(category: "data-set", privilege: "mutation", domainOwnerGranted: true)'),
57
+ (0, type_graphql_1.Directive)('@transaction'),
58
+ (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple dataItems' }),
59
+ __param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
60
+ __param(1, (0, type_graphql_1.Ctx)()),
61
+ __metadata("design:type", Function),
62
+ __metadata("design:paramtypes", [Array, Object]),
63
+ __metadata("design:returntype", Promise)
64
+ ], DataItemMutation.prototype, "deleteDataItems", null);
65
+ DataItemMutation = __decorate([
66
+ (0, type_graphql_1.Resolver)(data_item_1.DataItem)
67
+ ], DataItemMutation);
68
+ exports.DataItemMutation = DataItemMutation;
69
+ //# sourceMappingURL=data-item-mutation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-item-mutation.js","sourceRoot":"","sources":["../../../server/service/data-item/data-item-mutation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+CAAsE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AC,CAAA;QAEF,OAAO,IAAI,CAAA;IACb,CAAC;CACF,CAAA;AA3CC;IAHC,IAAA,wBAAS,EAAC,mFAAmF,CAAC;IAC9F,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,CAAC,oBAAQ,CAAC,EAAE,EAAE,WAAW,EAAE,2CAA2C,EAAE,CAAC;IAE3F,WAAA,IAAA,kBAAG,EAAC,WAAW,CAAC,CAAA;IAChB,WAAA,IAAA,kBAAG,EAAC,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,8BAAa,CAAC,CAAC,CAAA;IACvC,WAAA,IAAA,kBAAG,GAAE,CAAA;;;;8DAyBP;AAKD;IAHC,IAAA,wBAAS,EAAC,mFAAmF,CAAC;IAC9F,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,8BAA8B,EAAE,CAAC;IACvD,WAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAAiB,WAAA,IAAA,kBAAG,GAAE,CAAA;;;;uDASxE;AA9CU,gBAAgB;IAD5B,IAAA,uBAAQ,EAAC,oBAAQ,CAAC;GACN,gBAAgB,CA+C5B;AA/CY,4CAAgB"}
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ var _a;
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.DataItemQuery = void 0;
17
+ const type_graphql_1 = require("type-graphql");
18
+ const typeorm_1 = require("typeorm");
19
+ const auth_base_1 = require("@things-factory/auth-base");
20
+ const shell_1 = require("@things-factory/shell");
21
+ const data_set_1 = require("../data-set/data-set");
22
+ const data_item_1 = require("./data-item");
23
+ const data_item_type_1 = require("./data-item-type");
24
+ let DataItemQuery = class DataItemQuery {
25
+ async dataItem(id, context) {
26
+ const { domain } = context.state;
27
+ return await (0, typeorm_1.getRepository)(data_item_1.DataItem).findOne({
28
+ where: { domain, id }
29
+ });
30
+ }
31
+ async dataItems(params, context) {
32
+ const { domain } = context.state;
33
+ const convertedParams = (0, shell_1.convertListParams)(params, domain.id);
34
+ const [items, total] = await (0, typeorm_1.getRepository)(data_item_1.DataItem).findAndCount(convertedParams);
35
+ return { items, total };
36
+ }
37
+ async dataSet(dataItem) {
38
+ return await (0, typeorm_1.getRepository)(data_set_1.DataSet).findOne(dataItem.dataSetId);
39
+ }
40
+ async domain(dataItem) {
41
+ return await (0, typeorm_1.getRepository)(shell_1.Domain).findOne(dataItem.domainId);
42
+ }
43
+ async updater(dataItem) {
44
+ return await (0, typeorm_1.getRepository)(auth_base_1.User).findOne(dataItem.updaterId);
45
+ }
46
+ async creator(dataItem) {
47
+ return await (0, typeorm_1.getRepository)(auth_base_1.User).findOne(dataItem.creatorId);
48
+ }
49
+ };
50
+ __decorate([
51
+ (0, type_graphql_1.Directive)('@privilege(category: "data-set", privilege: "query", domainOwnerGranted: true)'),
52
+ (0, type_graphql_1.Query)(returns => data_item_1.DataItem, { description: 'To fetch a DataItem' }),
53
+ __param(0, (0, type_graphql_1.Arg)('id')),
54
+ __param(1, (0, type_graphql_1.Ctx)()),
55
+ __metadata("design:type", Function),
56
+ __metadata("design:paramtypes", [String, Object]),
57
+ __metadata("design:returntype", Promise)
58
+ ], DataItemQuery.prototype, "dataItem", null);
59
+ __decorate([
60
+ (0, type_graphql_1.Directive)('@privilege(category: "data-set", privilege: "query", domainOwnerGranted: true)'),
61
+ (0, type_graphql_1.Query)(returns => data_item_type_1.DataItemList, { description: 'To fetch multiple DataItems' }),
62
+ __param(0, (0, type_graphql_1.Args)()),
63
+ __param(1, (0, type_graphql_1.Ctx)()),
64
+ __metadata("design:type", Function),
65
+ __metadata("design:paramtypes", [typeof (_a = typeof shell_1.ListParam !== "undefined" && shell_1.ListParam) === "function" ? _a : Object, Object]),
66
+ __metadata("design:returntype", Promise)
67
+ ], DataItemQuery.prototype, "dataItems", null);
68
+ __decorate([
69
+ (0, type_graphql_1.FieldResolver)(type => data_set_1.DataSet),
70
+ __param(0, (0, type_graphql_1.Root)()),
71
+ __metadata("design:type", Function),
72
+ __metadata("design:paramtypes", [data_item_1.DataItem]),
73
+ __metadata("design:returntype", Promise)
74
+ ], DataItemQuery.prototype, "dataSet", null);
75
+ __decorate([
76
+ (0, type_graphql_1.FieldResolver)(type => shell_1.Domain),
77
+ __param(0, (0, type_graphql_1.Root)()),
78
+ __metadata("design:type", Function),
79
+ __metadata("design:paramtypes", [data_item_1.DataItem]),
80
+ __metadata("design:returntype", Promise)
81
+ ], DataItemQuery.prototype, "domain", null);
82
+ __decorate([
83
+ (0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
84
+ __param(0, (0, type_graphql_1.Root)()),
85
+ __metadata("design:type", Function),
86
+ __metadata("design:paramtypes", [data_item_1.DataItem]),
87
+ __metadata("design:returntype", Promise)
88
+ ], DataItemQuery.prototype, "updater", null);
89
+ __decorate([
90
+ (0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
91
+ __param(0, (0, type_graphql_1.Root)()),
92
+ __metadata("design:type", Function),
93
+ __metadata("design:paramtypes", [data_item_1.DataItem]),
94
+ __metadata("design:returntype", Promise)
95
+ ], DataItemQuery.prototype, "creator", null);
96
+ DataItemQuery = __decorate([
97
+ (0, type_graphql_1.Resolver)(data_item_1.DataItem)
98
+ ], DataItemQuery);
99
+ exports.DataItemQuery = DataItemQuery;
100
+ //# sourceMappingURL=data-item-query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-item-query.js","sourceRoot":"","sources":["../../../server/service/data-item/data-item-query.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA8F;AAC9F,qCAAuC;AAEvC,yDAAgD;AAChD,iDAA4E;AAE5E,mDAA8C;AAC9C,2CAAsC;AACtC,qDAA+C;AAG/C,IAAa,aAAa,GAA1B,MAAa,aAAa;IAGxB,KAAK,CAAC,QAAQ,CAAY,EAAU,EAAS,OAAY;QACvD,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,uBAAa,EAAC,oBAAQ,CAAC,CAAC,OAAO,CAAC;YAC3C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;SACtB,CAAC,CAAA;IACJ,CAAC;IAID,KAAK,CAAC,SAAS,CAAS,MAAiB,EAAS,OAAY;QAC5D,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,MAAM,eAAe,GAAG,IAAA,yBAAiB,EAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,CAAA;QAC5D,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,MAAM,IAAA,uBAAa,EAAC,oBAAQ,CAAC,CAAC,YAAY,CAAC,eAAe,CAAC,CAAA;QAElF,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;IACzB,CAAC;IAGD,KAAK,CAAC,OAAO,CAAS,QAAkB;QACtC,OAAO,MAAM,IAAA,uBAAa,EAAC,kBAAO,CAA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AAC;IAChB,WAAA,IAAA,mBAAI,GAAE,CAAA;;qCAAW,oBAAQ;;2CAEtC;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,WAAA,IAAA,mBAAI,GAAE,CAAA;;qCAAW,oBAAQ;;4CAEvC;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,WAAA,IAAA,mBAAI,GAAE,CAAA;;qCAAW,oBAAQ;;4CAEvC;AAxCU,aAAa;IADzB,IAAA,uBAAQ,EAAC,oBAAQ,CAAC;GACN,aAAa,CAyCzB;AAzCY,sCAAa"}
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.DataItemList = exports.DataItemPatch = void 0;
13
+ const type_graphql_1 = require("type-graphql");
14
+ const shell_1 = require("@things-factory/shell");
15
+ const data_item_1 = require("./data-item");
16
+ let DataItemPatch = class DataItemPatch {
17
+ };
18
+ __decorate([
19
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
20
+ __metadata("design:type", String)
21
+ ], DataItemPatch.prototype, "id", void 0);
22
+ __decorate([
23
+ (0, type_graphql_1.Field)({ nullable: true }),
24
+ __metadata("design:type", String)
25
+ ], DataItemPatch.prototype, "dataSetId", void 0);
26
+ __decorate([
27
+ (0, type_graphql_1.Field)({ nullable: true }),
28
+ __metadata("design:type", String)
29
+ ], DataItemPatch.prototype, "name", void 0);
30
+ __decorate([
31
+ (0, type_graphql_1.Field)({ nullable: true }),
32
+ __metadata("design:type", String)
33
+ ], DataItemPatch.prototype, "description", void 0);
34
+ __decorate([
35
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true }),
36
+ __metadata("design:type", Number)
37
+ ], DataItemPatch.prototype, "sequence", void 0);
38
+ __decorate([
39
+ (0, type_graphql_1.Field)(type => data_item_1.DataItemType, { nullable: true }),
40
+ __metadata("design:type", String)
41
+ ], DataItemPatch.prototype, "type", void 0);
42
+ __decorate([
43
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true }),
44
+ __metadata("design:type", Number)
45
+ ], DataItemPatch.prototype, "quota", void 0);
46
+ __decorate([
47
+ (0, type_graphql_1.Field)({ nullable: true }),
48
+ __metadata("design:type", String)
49
+ ], DataItemPatch.prototype, "options", void 0);
50
+ __decorate([
51
+ (0, type_graphql_1.Field)({ nullable: true }),
52
+ __metadata("design:type", Boolean)
53
+ ], DataItemPatch.prototype, "active", void 0);
54
+ __decorate([
55
+ (0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true }),
56
+ __metadata("design:type", Object)
57
+ ], DataItemPatch.prototype, "spec", void 0);
58
+ __decorate([
59
+ (0, type_graphql_1.Field)({ nullable: true }),
60
+ __metadata("design:type", String)
61
+ ], DataItemPatch.prototype, "cuFlag", void 0);
62
+ DataItemPatch = __decorate([
63
+ (0, type_graphql_1.InputType)()
64
+ ], DataItemPatch);
65
+ exports.DataItemPatch = DataItemPatch;
66
+ let DataItemList = class DataItemList {
67
+ };
68
+ __decorate([
69
+ (0, type_graphql_1.Field)(type => [data_item_1.DataItem]),
70
+ __metadata("design:type", Array)
71
+ ], DataItemList.prototype, "items", void 0);
72
+ __decorate([
73
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int),
74
+ __metadata("design:type", Number)
75
+ ], DataItemList.prototype, "total", void 0);
76
+ DataItemList = __decorate([
77
+ (0, type_graphql_1.ObjectType)()
78
+ ], DataItemList);
79
+ exports.DataItemList = DataItemList;
80
+ //# sourceMappingURL=data-item-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-item-type.js","sourceRoot":"","sources":["../../../server/service/data-item/data-item-type.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAAoE;AAEpE,iDAAoD;AAEpD,2CAAoD;AAGpD,IAAa,aAAa,GAA1B,MAAa,aAAa;CAiCzB,CAAA;AA/BC;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCAC3B;AAGX;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACR;AAGlB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CACb;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDACN;AAGpB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACtB;AAGjB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,wBAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CAC7B;AAGnB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACzB;AAGd;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACV;AAGhB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACV;AAGhB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,oBAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CACnC;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACX;AAhCJ,aAAa;IADzB,IAAA,wBAAS,GAAE;GACC,aAAa,CAiCzB;AAjCY,sCAAa;AAoC1B,IAAa,YAAY,GAAzB,MAAa,YAAY;CAMxB,CAAA;AAJC;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,oBAAQ,CAAC,CAAC;;2CACT;AAGjB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;2CACN;AALF,YAAY;IADxB,IAAA,yBAAU,GAAE;GACA,YAAY,CAMxB;AANY,oCAAY"}
@@ -1,8 +1,16 @@
1
1
  "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
2
11
  var _a, _b, _c;
3
12
  Object.defineProperty(exports, "__esModule", { value: true });
4
13
  exports.DataItem = exports.DataItemType = void 0;
5
- const tslib_1 = require("tslib");
6
14
  const type_graphql_1 = require("type-graphql");
7
15
  const typeorm_1 = require("typeorm");
8
16
  const auth_base_1 = require("@things-factory/auth-base");
@@ -14,7 +22,6 @@ var DataItemType;
14
22
  DataItemType["text"] = "text";
15
23
  DataItemType["boolean"] = "boolean";
16
24
  DataItemType["select"] = "select";
17
- DataItemType["file"] = "file";
18
25
  })(DataItemType = exports.DataItemType || (exports.DataItemType = {}));
19
26
  (0, type_graphql_1.registerEnumType)(DataItemType, {
20
27
  name: 'DataItemType',
@@ -22,131 +29,105 @@ var DataItemType;
22
29
  });
23
30
  let DataItem = class DataItem {
24
31
  };
25
- tslib_1.__decorate([
32
+ __decorate([
26
33
  (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
27
34
  (0, type_graphql_1.Field)(type => type_graphql_1.ID),
28
- tslib_1.__metadata("design:type", String)
35
+ __metadata("design:type", String)
29
36
  ], DataItem.prototype, "id", void 0);
30
- tslib_1.__decorate([
37
+ __decorate([
31
38
  (0, typeorm_1.ManyToOne)(type => shell_1.Domain),
32
39
  (0, type_graphql_1.Field)({ nullable: true }),
33
- tslib_1.__metadata("design:type", typeof (_a = typeof shell_1.Domain !== "undefined" && shell_1.Domain) === "function" ? _a : Object)
40
+ __metadata("design:type", typeof (_a = typeof shell_1.Domain !== "undefined" && shell_1.Domain) === "function" ? _a : Object)
34
41
  ], DataItem.prototype, "domain", void 0);
35
- tslib_1.__decorate([
42
+ __decorate([
36
43
  (0, typeorm_1.RelationId)((dataItem) => dataItem.domain),
37
- tslib_1.__metadata("design:type", String)
44
+ __metadata("design:type", String)
38
45
  ], DataItem.prototype, "domainId", void 0);
39
- tslib_1.__decorate([
46
+ __decorate([
40
47
  (0, typeorm_1.Column)(),
41
48
  (0, type_graphql_1.Field)(),
42
- tslib_1.__metadata("design:type", String)
49
+ __metadata("design:type", String)
43
50
  ], DataItem.prototype, "name", void 0);
44
- tslib_1.__decorate([
51
+ __decorate([
45
52
  (0, typeorm_1.Column)({
46
53
  nullable: true
47
54
  }),
48
55
  (0, type_graphql_1.Field)({ nullable: true }),
49
- tslib_1.__metadata("design:type", String)
56
+ __metadata("design:type", String)
50
57
  ], DataItem.prototype, "description", void 0);
51
- tslib_1.__decorate([
58
+ __decorate([
52
59
  (0, typeorm_1.ManyToOne)(type => data_set_1.DataSet, dataSet => dataSet.dataItems, { onDelete: 'CASCADE' }),
53
- (0, type_graphql_1.Field)(type => data_set_1.DataSet, { nullable: false }),
54
- tslib_1.__metadata("design:type", data_set_1.DataSet)
60
+ (0, type_graphql_1.Field)(type => data_set_1.DataSet, { nullable: true }),
61
+ __metadata("design:type", data_set_1.DataSet)
55
62
  ], DataItem.prototype, "dataSet", void 0);
56
- tslib_1.__decorate([
63
+ __decorate([
57
64
  (0, typeorm_1.RelationId)((dataItem) => dataItem.dataSet),
58
- tslib_1.__metadata("design:type", String)
65
+ __metadata("design:type", String)
59
66
  ], DataItem.prototype, "dataSetId", void 0);
60
- tslib_1.__decorate([
67
+ __decorate([
61
68
  (0, typeorm_1.Column)(),
62
69
  (0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true }),
63
- tslib_1.__metadata("design:type", Number)
70
+ __metadata("design:type", Number)
64
71
  ], DataItem.prototype, "sequence", void 0);
65
- tslib_1.__decorate([
66
- (0, typeorm_1.Column)({
67
- nullable: true
68
- }),
69
- (0, type_graphql_1.Field)({ nullable: true }),
70
- tslib_1.__metadata("design:type", String)
71
- ], DataItem.prototype, "tag", void 0);
72
- tslib_1.__decorate([
72
+ __decorate([
73
73
  (0, typeorm_1.Column)({
74
74
  nullable: true
75
75
  }),
76
76
  (0, type_graphql_1.Field)({ nullable: true }),
77
- tslib_1.__metadata("design:type", Boolean)
77
+ __metadata("design:type", Boolean)
78
78
  ], DataItem.prototype, "active", void 0);
79
- tslib_1.__decorate([
80
- (0, typeorm_1.Column)({
81
- nullable: true
82
- }),
83
- (0, type_graphql_1.Field)({ nullable: true }),
84
- tslib_1.__metadata("design:type", Boolean)
85
- ], DataItem.prototype, "hidden", void 0);
86
- tslib_1.__decorate([
79
+ __decorate([
87
80
  (0, typeorm_1.Column)({
88
81
  nullable: true
89
82
  }),
90
83
  (0, type_graphql_1.Field)({ nullable: true }),
91
- tslib_1.__metadata("design:type", String)
84
+ __metadata("design:type", String)
92
85
  ], DataItem.prototype, "type", void 0);
93
- tslib_1.__decorate([
94
- (0, typeorm_1.Column)('simple-json', { nullable: true }),
95
- (0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true }),
96
- tslib_1.__metadata("design:type", Object)
97
- ], DataItem.prototype, "options", void 0);
98
- tslib_1.__decorate([
99
- (0, typeorm_1.Column)({
100
- nullable: true
101
- }),
102
- (0, type_graphql_1.Field)({ nullable: true }),
103
- tslib_1.__metadata("design:type", String)
104
- ], DataItem.prototype, "unit", void 0);
105
- tslib_1.__decorate([
86
+ __decorate([
106
87
  (0, typeorm_1.Column)({
107
88
  nullable: true
108
89
  }),
109
90
  (0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true }),
110
- tslib_1.__metadata("design:type", Number)
91
+ __metadata("design:type", Number)
111
92
  ], DataItem.prototype, "quota", void 0);
112
- tslib_1.__decorate([
93
+ __decorate([
113
94
  (0, typeorm_1.Column)('simple-json', { nullable: true }),
114
95
  (0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true }),
115
- tslib_1.__metadata("design:type", Object)
96
+ __metadata("design:type", Object)
116
97
  ], DataItem.prototype, "spec", void 0);
117
- tslib_1.__decorate([
98
+ __decorate([
118
99
  (0, typeorm_1.CreateDateColumn)(),
119
100
  (0, type_graphql_1.Field)({ nullable: true }),
120
- tslib_1.__metadata("design:type", Date)
101
+ __metadata("design:type", Date)
121
102
  ], DataItem.prototype, "createdAt", void 0);
122
- tslib_1.__decorate([
103
+ __decorate([
123
104
  (0, typeorm_1.UpdateDateColumn)(),
124
105
  (0, type_graphql_1.Field)({ nullable: true }),
125
- tslib_1.__metadata("design:type", Date)
106
+ __metadata("design:type", Date)
126
107
  ], DataItem.prototype, "updatedAt", void 0);
127
- tslib_1.__decorate([
108
+ __decorate([
128
109
  (0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
129
110
  nullable: true
130
111
  }),
131
112
  (0, type_graphql_1.Field)({ nullable: true }),
132
- tslib_1.__metadata("design:type", typeof (_b = typeof auth_base_1.User !== "undefined" && auth_base_1.User) === "function" ? _b : Object)
113
+ __metadata("design:type", typeof (_b = typeof auth_base_1.User !== "undefined" && auth_base_1.User) === "function" ? _b : Object)
133
114
  ], DataItem.prototype, "creator", void 0);
134
- tslib_1.__decorate([
115
+ __decorate([
135
116
  (0, typeorm_1.RelationId)((dataItem) => dataItem.creator),
136
- tslib_1.__metadata("design:type", String)
117
+ __metadata("design:type", String)
137
118
  ], DataItem.prototype, "creatorId", void 0);
138
- tslib_1.__decorate([
119
+ __decorate([
139
120
  (0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
140
121
  nullable: true
141
122
  }),
142
123
  (0, type_graphql_1.Field)({ nullable: true }),
143
- tslib_1.__metadata("design:type", typeof (_c = typeof auth_base_1.User !== "undefined" && auth_base_1.User) === "function" ? _c : Object)
124
+ __metadata("design:type", typeof (_c = typeof auth_base_1.User !== "undefined" && auth_base_1.User) === "function" ? _c : Object)
144
125
  ], DataItem.prototype, "updater", void 0);
145
- tslib_1.__decorate([
126
+ __decorate([
146
127
  (0, typeorm_1.RelationId)((dataItem) => dataItem.creator),
147
- tslib_1.__metadata("design:type", String)
128
+ __metadata("design:type", String)
148
129
  ], DataItem.prototype, "updaterId", void 0);
149
- DataItem = tslib_1.__decorate([
130
+ DataItem = __decorate([
150
131
  (0, typeorm_1.Entity)(),
151
132
  (0, typeorm_1.Index)('ix_data_item_0', (dataItem) => [dataItem.domain, dataItem.dataSet, dataItem.name], { unique: true }),
152
133
  (0, type_graphql_1.ObjectType)({ description: 'Entity for DataItem' })
@@ -1 +1 @@
1
- {"version":3,"file":"data-item.js","sourceRoot":"","sources":["../../../server/service/data-item/data-item.ts"],"names":[],"mappings":";;;;;AAAA,+CAA2E;AAC3E,qCASgB;AAEhB,yDAAgD;AAChD,iDAA4D;AAE5D,mDAA8C;AAE9C,IAAY,Y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AAE,IAAI,EAAE,CAAC;IACrH,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,qBAAqB,EAAE,CAAC;GACtC,QAAQ,CAsGpB;AAtGY,4BAAQ","sourcesContent":["import { Field, ID, Int, ObjectType, registerEnumType } from 'type-graphql'\nimport {\n Column,\n CreateDateColumn,\n Entity,\n Index,\n ManyToOne,\n PrimaryGeneratedColumn,\n RelationId,\n UpdateDateColumn\n} from 'typeorm'\n\nimport { User } from '@things-factory/auth-base'\nimport { Domain, ScalarObject } from '@things-factory/shell'\n\nimport { DataSet } from '../data-set/data-set'\n\nexport enum DataItemType {\n number = 'number',\n text = 'text',\n boolean = 'boolean',\n select = 'select',\n file = 'file'\n}\n\nregisterEnumType(DataItemType, {\n name: 'DataItemType',\n description: 'state enumeration of a data-item'\n})\n\n@Entity()\n@Index('ix_data_item_0', (dataItem: DataItem) => [dataItem.domain, dataItem.dataSet, dataItem.name], { unique: true })\n@ObjectType({ description: 'Entity for DataItem' })\nexport class DataItem {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @ManyToOne(type => Domain)\n @Field({ nullable: true })\n domain?: Domain\n\n @RelationId((dataItem: DataItem) => dataItem.domain)\n domainId?: string\n\n @Column()\n @Field()\n name: string\n\n @Column({\n nullable: true\n })\n @Field({ nullable: true })\n description?: string\n\n @ManyToOne(type => DataSet, dataSet => dataSet.dataItems, { onDelete: 'CASCADE' })\n @Field(type => DataSet, { nullable: false })\n dataSet?: DataSet\n\n @RelationId((dataItem: DataItem) => dataItem.dataSet)\n dataSetId?: string\n\n @Column()\n @Field(type => Int, { nullable: true })\n sequence: number\n\n @Column({\n nullable: true\n })\n @Field({ nullable: true })\n tag?: string\n\n @Column({\n nullable: true\n })\n @Field({ nullable: true })\n active?: boolean\n\n @Column({\n nullable: true\n })\n @Field({ nullable: true })\n hidden?: boolean\n\n @Column({\n nullable: true\n })\n @Field({ nullable: true })\n type?: DataItemType\n\n @Column('simple-json', { nullable: true })\n @Field(type => ScalarObject, { nullable: true })\n options?: { [option: string]: any }\n\n @Column({\n nullable: true\n })\n @Field({ nullable: true })\n unit?: string\n\n @Column({\n nullable: true\n })\n @Field(type => Int, { nullable: true })\n quota: number\n\n @Column('simple-json', { nullable: true })\n @Field(type => ScalarObject, { nullable: true })\n spec?: { [key: string]: any }\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt?: Date\n\n @ManyToOne(type => User, {\n nullable: true\n })\n @Field({ nullable: true })\n creator?: User\n\n @RelationId((dataItem: DataItem) => dataItem.creator)\n creatorId?: string\n\n @ManyToOne(type => User, {\n nullable: true\n })\n @Field({ nullable: true })\n updater?: User\n\n @RelationId((dataItem: DataItem) => dataItem.creator)\n updaterId?: string\n}\n"]}
1
+ {"version":3,"file":"data-item.js","sourceRoot":"","sources":["../../../server/service/data-item/data-item.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,+CAA2E;AAC3E,qCASgB;AAEhB,yDAAgD;AAChD,iDAA4D;AAE5D,mDAA8C;AAE9C,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,iCAAiB,CAAA;IACjB,6BAAa,CAAA;IACb,mCAAmB,CAAA;IACnB,iCAAiB,CAAA;AACnB,CAAC,EALW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAKvB;AAED,IAAA,+BAAgB,EAAC,YAAY,EAAE;IAC7B,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,kCAAkC;CAChD,CAAC,CAAA;AAKF,IAAa,QAAQ,GAArB,MAAa,QAAQ;CAgFpB,CAAA;AA7EC;IAFC,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;oCACC;AAInB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IACzB,IAAA,oBAAK,EAAC,EAAE,QAA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AAM,EAAE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACrH,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,qBAAqB,EAAE,CAAC;GACtC,QAAQ,CAgFpB;AAhFY,4BAAQ"}
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.entities = void 0;
3
+ exports.resolvers = exports.entities = void 0;
4
4
  const data_item_1 = require("./data-item");
5
+ const data_item_query_1 = require("./data-item-query");
6
+ const data_item_mutation_1 = require("./data-item-mutation");
5
7
  exports.entities = [data_item_1.DataItem];
8
+ exports.resolvers = [data_item_query_1.DataItemQuery, data_item_mutation_1.DataItemMutation];
6
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/data-item/index.ts"],"names":[],"mappings":";;;AAAA,2CAAsC;AAEzB,QAAA,QAAQ,GAAG,CAAC,oBAAQ,CAAC,CAAA","sourcesContent":["import { DataItem } from './data-item'\n\nexport const entities = [DataItem]\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/data-item/index.ts"],"names":[],"mappings":";;;AAAA,2CAAsC;AACtC,uDAAiD;AACjD,6DAAuD;AAE1C,QAAA,QAAQ,GAAG,CAAC,oBAAQ,CAAC,CAAA;AACrB,QAAA,SAAS,GAAG,CAAC,+BAAa,EAAE,qCAAgB,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"data-item-type.js","sourceRoot":"","sources":["../../../server/service/data-set/data-item-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAkF;AAElF,iDAAoD;AAEpD,IAAY,YAMX;AAND,WAAY,YAAY;IACtB,iCAAiB,CAAA;IACjB,6BAAa,CAAA;IACb,mCAAmB,CAAA;IACnB,iCAAiB,CAAA;IACjB,6BAAa,CAAA;AACf,CAAC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oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CACb;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDACN;AAGpB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CACd;AAGZ;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,YAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CAC7B;AAGnB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,oBAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACb;AAGnC;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CACb;AAGb;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACzB;AAGd;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACV;AAGhB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACV;AAGhB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,oBAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CACnB;AA7BlB,aAAa;IADzB,IAAA,wBAAS,GAAE;GACC,aAAa,CA8BzB;AA9BY,sCAAa","sourcesContent":["import { Field, InputType, Int, ObjectType, registerEnumType } from 'type-graphql'\n\nimport { ScalarObject } from '@things-factory/shell'\n\nexport enum DataItemType {\n number = 'number',\n text = 'text',\n boolean = 'boolean',\n select = 'select',\n file = 'file'\n}\n\nregisterEnumType(DataItemType, {\n name: 'DataItemType',\n description: 'type enumeration of a data-item'\n})\n\n@ObjectType({ description: 'Entity for DataItem' })\nexport class DataItem {\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?: DataItemType\n\n @Field(type => ScalarObject, { nullable: true })\n options?: { [option: string]: any }\n\n @Field({ nullable: true })\n unit?: string\n\n @Field(type => Int, { nullable: true })\n quota: number\n\n @Field(type => ScalarObject, { nullable: true })\n spec?: { [key: string]: any }\n}\n\n@InputType()\nexport class DataItemPatch {\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 => DataItemType, { nullable: true })\n type?: DataItemType\n\n @Field(type => ScalarObject, { nullable: true })\n options?: { [option: string]: any }\n\n @Field({ nullable: true })\n unit?: string\n\n @Field(type => Int, { nullable: true })\n quota?: number\n\n @Field({ nullable: true })\n active?: boolean\n\n @Field({ nullable: true })\n hidden?: boolean\n\n @Field(type => ScalarObject, { nullable: true })\n spec?: { [key: string]: any }\n}\n"]}
1
+ {"version":3,"file":"data-item-type.js","sourceRoot":"","sources":["../../../server/service/data-set/data-item-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAkF;AAElF,iDAAoD;AAEpD,IAAY,YAMX;AAND,WAAY,YAAY;IACtB,iCAAiB,CAAA;IACjB,6BAAa,CAAA;IACb,mCAAmB,CAAA;IACnB,iCAAiB,CAAA;IACjB,6BAAa,CAAA;AACf,CAAC,EANW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAMvB;AAED,IAAA,+BAAgB,EAAC,YAAY,EAAE;IAC7B,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,iCAAiC;CAC/C,CAAC,CAAA;AAGF,IAAa,QAAQ,GAArB,MAAa,QAAQ;CA8BpB,CAAA;AA5BC;IADC,IAAA,oBAAK,GAAE;;sCACI;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;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7B;AAGnB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,oBAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACb;AAGnC;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CACb;AAGb;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACzB;AAGd;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACV;AAGhB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACV;AAGhB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,oBAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CACnB;AA7BlB,aAAa;IADzB,IAAA,wBAAS,GAAE;GACC,aAAa,CA8BzB;AA9BY,sCAAa","sourcesContent":["import { Field, InputType, Int, ObjectType, registerEnumType } from 'type-graphql'\n\nimport { ScalarObject } from '@things-factory/shell'\n\nexport enum DataItemType {\n number = 'number',\n text = 'text',\n boolean = 'boolean',\n select = 'select',\n file = 'file'\n}\n\nregisterEnumType(DataItemType, {\n name: 'DataItemType',\n description: 'type enumeration of a data-item'\n})\n\n@ObjectType({ description: 'Entity for DataItem' })\nexport class DataItem {\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?: DataItemType\n\n @Field(type => ScalarObject, { nullable: true })\n options?: { [option: string]: any }\n\n @Field({ nullable: true })\n unit?: string\n\n @Field(type => Int, { nullable: true })\n quota?: number\n\n @Field(type => ScalarObject, { nullable: true })\n spec?: { [key: string]: any }\n}\n\n@InputType()\nexport class DataItemPatch {\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 => DataItemType, { nullable: true })\n type?: DataItemType\n\n @Field(type => ScalarObject, { nullable: true })\n options?: { [option: string]: any }\n\n @Field({ nullable: true })\n unit?: string\n\n @Field(type => Int, { nullable: true })\n quota?: number\n\n @Field({ nullable: true })\n active?: boolean\n\n @Field({ nullable: true })\n hidden?: boolean\n\n @Field(type => ScalarObject, { nullable: true })\n spec?: { [key: string]: any }\n}\n"]}
@@ -20,7 +20,9 @@ let DataSetMutation = class DataSetMutation {
20
20
  const { domain, user, tx } = context.state;
21
21
  const dataSetRepo = tx.getRepository(data_set_1.DataSet);
22
22
  const dataSet = await dataSetRepo.findOne({
23
- where: { domain, id }
23
+ where: { domain, id },
24
+ relations: ['domain', 'dataKeySet', 'entryRole', 'supervisoryRole', 'creator', 'updater']
25
+ /* history에 항상 반영될 수 있도록 relations가 있어야 함. */
24
26
  });
25
27
  const result = await dataSetRepo.save(Object.assign(Object.assign(Object.assign({}, dataSet), patch), { updater: user }));
26
28
  await this._createAttachment(context, dataSet.reportTemplate, { ref: result, cuFlag: 'M' });
@@ -38,21 +40,20 @@ let DataSetMutation = class DataSetMutation {
38
40
  const newRecord = _createRecords[i];
39
41
  const result = await dataSetRepo.save(Object.assign(Object.assign({}, newRecord), { domain, creator: user, updater: user }));
40
42
  await this._createAttachment(context, newRecord.reportTemplate, { ref: result, cuFlag });
41
- results.push(Object.assign(Object.assign({}, (await dataSetRepo.findOne(result.id, {
42
- relations: ['domain', 'creator', 'updater', 'supervisoryRole', 'entryRole']
43
- }))), { cuFlag }));
43
+ results.push(Object.assign(Object.assign({}, result), { cuFlag }));
44
44
  }
45
45
  }
46
46
  if (_updateRecords.length > 0) {
47
47
  const cuFlag = 'M';
48
48
  for (let i = 0; i < _updateRecords.length; i++) {
49
49
  const newRecord = _updateRecords[i];
50
- const dataSet = await dataSetRepo.findOne(newRecord.id);
50
+ const dataSet = await dataSetRepo.findOne(newRecord.id, {
51
+ /* history에 항상 반영될 수 있도록 relations가 있어야 함. */
52
+ relations: ['domain', 'dataKeySet', 'entryRole', 'supervisoryRole', 'creator', 'updater']
53
+ });
51
54
  const result = await dataSetRepo.save(Object.assign(Object.assign(Object.assign({}, dataSet), newRecord), { updater: user }));
52
55
  await this._createAttachment(context, newRecord.reportTemplate, { ref: result, cuFlag });
53
- results.push(Object.assign(Object.assign({}, (await dataSetRepo.findOne(result.id, {
54
- relations: ['domain', 'creator', 'updater', 'supervisoryRole', 'entryRole']
55
- }))), { cuFlag }));
56
+ results.push(Object.assign(Object.assign({}, result), { cuFlag }));
56
57
  }
57
58
  }
58
59
  return results;
@@ -88,14 +89,14 @@ let DataSetMutation = class DataSetMutation {
88
89
  id: (0, typeorm_1.In)(ids),
89
90
  domain
90
91
  },
91
- relations: ['domain', 'supervisoryRole', 'entryRole']
92
+ relations: ['domain', 'supervisoryRole', 'entryRole', 'dataKeySet']
92
93
  });
93
94
  if (originals.length == 0) {
94
95
  return [];
95
96
  }
96
97
  var newCopys = originals.map(dataSet => {
97
98
  let dataSetId = crypto.randomUUID();
98
- return Object.assign(Object.assign({}, dataSet), { id: dataSetId, name: dataSet.name + ' (' + dataSetId + ')', active: false, domain, creator: user, updater: user });
99
+ return Object.assign(Object.assign({}, dataSet), { id: dataSetId, name: dataSet.name + ' (' + dataSetId + ')', active: false, version: 1, domain, creator: user, updater: user, updatedAt: undefined, createdAt: undefined });
99
100
  });
100
101
  var copiedDataSets = await dataSetRepo.save(newCopys);
101
102
  return copiedDataSets;