@things-factory/code-base 5.0.7 → 6.0.0-alpha.0

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 (29) hide show
  1. package/dist-server/index.js +3 -16
  2. package/dist-server/index.js.map +1 -1
  3. package/dist-server/migrations/index.js.map +1 -1
  4. package/dist-server/service/common-code/common-code-mutation.js +49 -57
  5. package/dist-server/service/common-code/common-code-mutation.js.map +1 -1
  6. package/dist-server/service/common-code/common-code-query.js +51 -64
  7. package/dist-server/service/common-code/common-code-query.js.map +1 -1
  8. package/dist-server/service/common-code/common-code-type.js +24 -32
  9. package/dist-server/service/common-code/common-code-type.js.map +1 -1
  10. package/dist-server/service/common-code/common-code.js +26 -35
  11. package/dist-server/service/common-code/common-code.js.map +1 -1
  12. package/dist-server/service/common-code/index.js.map +1 -1
  13. package/dist-server/service/common-code-detail/common-code-detail-mutation.js +47 -58
  14. package/dist-server/service/common-code-detail/common-code-detail-mutation.js.map +1 -1
  15. package/dist-server/service/common-code-detail/common-code-detail-query.js +40 -53
  16. package/dist-server/service/common-code-detail/common-code-detail-query.js.map +1 -1
  17. package/dist-server/service/common-code-detail/common-code-detail-type.js +28 -37
  18. package/dist-server/service/common-code-detail/common-code-detail-type.js.map +1 -1
  19. package/dist-server/service/common-code-detail/common-code-detail.js +30 -39
  20. package/dist-server/service/common-code-detail/common-code-detail.js.map +1 -1
  21. package/dist-server/service/common-code-detail/index.js.map +1 -1
  22. package/dist-server/service/index.js +3 -16
  23. package/dist-server/service/index.js.map +1 -1
  24. package/dist-server/tsconfig.tsbuildinfo +1 -0
  25. package/package.json +3 -3
  26. package/server/service/common-code/common-code-mutation.ts +24 -14
  27. package/server/service/common-code/common-code-query.ts +11 -12
  28. package/server/service/common-code-detail/common-code-detail-mutation.ts +17 -14
  29. package/server/service/common-code-detail/common-code-detail-query.ts +8 -9
@@ -1,19 +1,6 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
2
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./migrations"), exports);
18
- __exportStar(require("./service"), exports);
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./migrations"), exports);
5
+ tslib_1.__exportStar(require("./service"), exports);
19
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../server/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA4B;AAC5B,4CAAyB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../server/index.ts"],"names":[],"mappings":";;;AAAA,uDAA4B;AAC5B,oDAAyB","sourcesContent":["export * from './migrations'\nexport * from './service'\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/migrations/index.ts"],"names":[],"mappings":";;;AAAA,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AAC5B,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AAEjB,QAAA,UAAU,GAAG,EAAE,CAAA;AAE1B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,UAAS,IAAI;IACzE,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAAE,OAAM;IAC3C,kBAAU,GAAG,kBAAU,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;AAClF,CAAC,CAAC,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/migrations/index.ts"],"names":[],"mappings":";;;AAAA,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AAC5B,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AAEjB,QAAA,UAAU,GAAG,EAAE,CAAA;AAE1B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,UAAS,IAAI;IACzE,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAAE,OAAM;IAC3C,kBAAU,GAAG,kBAAU,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;AAClF,CAAC,CAAC,CAAA","sourcesContent":["const glob = require('glob')\nconst path = require('path')\n\nexport var migrations = []\n\nglob.sync(path.resolve(__dirname, '.', '**', '*.js')).forEach(function(file) {\n if (file.indexOf('index.js') !== -1) return\n migrations = migrations.concat(Object.values(require(path.resolve(file))) || [])\n})\n"]}
@@ -1,27 +1,17 @@
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
- };
11
- var __param = (this && this.__param) || function (paramIndex, decorator) {
12
- return function (target, key) { decorator(target, key, paramIndex); }
13
- };
14
2
  Object.defineProperty(exports, "__esModule", { value: true });
15
3
  exports.CommonCodeMutation = void 0;
4
+ const tslib_1 = require("tslib");
16
5
  const type_graphql_1 = require("type-graphql");
17
6
  const typeorm_1 = require("typeorm");
7
+ const shell_1 = require("@things-factory/shell");
18
8
  const common_code_detail_1 = require("../common-code-detail/common-code-detail");
19
9
  const common_code_1 = require("./common-code");
20
10
  const common_code_type_1 = require("./common-code-type");
21
11
  let CommonCodeMutation = class CommonCodeMutation {
22
12
  async createCommonCode(commonCode, context) {
23
13
  const { domain, user, tx } = context.state;
24
- const details = await (0, typeorm_1.getRepository)(common_code_detail_1.CommonCodeDetail).findByIds(commonCode.details || []);
14
+ const details = await (0, shell_1.getRepository)(common_code_detail_1.CommonCodeDetail).findByIds(commonCode.details || []);
25
15
  return await tx.getRepository(common_code_1.CommonCode).save(Object.assign(Object.assign({}, commonCode), { details,
26
16
  domain, creator: user, updater: user }));
27
17
  }
@@ -29,7 +19,7 @@ let CommonCodeMutation = class CommonCodeMutation {
29
19
  const { domain, user, tx } = context.state;
30
20
  const repository = tx.getRepository(common_code_1.CommonCode);
31
21
  const commonCode = await repository.findOne({
32
- where: { domain, name },
22
+ where: { domain: { id: domain.id }, name },
33
23
  relations: ['details']
34
24
  });
35
25
  const detailIds = commonCode.details.map(detail => detail.id);
@@ -40,7 +30,7 @@ let CommonCodeMutation = class CommonCodeMutation {
40
30
  }
41
31
  });
42
32
  }
43
- return await repository.save(Object.assign(Object.assign(Object.assign({}, commonCode), patch), { details: await (0, typeorm_1.getRepository)(common_code_detail_1.CommonCodeDetail).findByIds(detailIds), updater: user }));
33
+ return await repository.save(Object.assign(Object.assign(Object.assign({}, commonCode), patch), { details: await (0, shell_1.getRepository)(common_code_detail_1.CommonCodeDetail).findByIds(detailIds), updater: user }));
44
34
  }
45
35
  async updateMultipleCommonCode(patches, context) {
46
36
  const { domain, user, tx } = context.state;
@@ -58,7 +48,7 @@ let CommonCodeMutation = class CommonCodeMutation {
58
48
  if (_updateRecords.length > 0) {
59
49
  for (let i = 0; i < _updateRecords.length; i++) {
60
50
  const newRecord = _updateRecords[i];
61
- const commonCode = await commonCodeRepo.findOne(newRecord.id);
51
+ const commonCode = await commonCodeRepo.findOneBy({ id: newRecord.id });
62
52
  const result = await commonCodeRepo.save(Object.assign(Object.assign(Object.assign({}, commonCode), newRecord), { updater: user }));
63
53
  results.push(Object.assign(Object.assign({}, result), { cuFlag: 'M' }));
64
54
  }
@@ -67,13 +57,13 @@ let CommonCodeMutation = class CommonCodeMutation {
67
57
  }
68
58
  async deleteCommonCode(id, context) {
69
59
  const { domain, tx } = context.state;
70
- await tx.getRepository(common_code_1.CommonCode).delete({ domain, id });
60
+ await tx.getRepository(common_code_1.CommonCode).delete({ domain: { id: domain.id }, id });
71
61
  return true;
72
62
  }
73
63
  async deleteCommonCodes(ids, context) {
74
64
  const { domain, tx } = context.state;
75
65
  await tx.getRepository(common_code_1.CommonCode).delete({
76
- domain,
66
+ domain: { id: domain.id },
77
67
  id: (0, typeorm_1.In)(ids)
78
68
  });
79
69
  return true;
@@ -81,67 +71,69 @@ let CommonCodeMutation = class CommonCodeMutation {
81
71
  async importCommonCodes(commonCodes, context) {
82
72
  const { domain, tx } = context.state;
83
73
  await Promise.all(commonCodes.map(async (commonCode) => {
84
- const createdCommonCode = await tx.getRepository(common_code_1.CommonCode).save(Object.assign({ domain }, commonCode));
74
+ const createdCommonCode = await tx
75
+ .getRepository(common_code_1.CommonCode)
76
+ .save(Object.assign({ domain }, commonCode));
85
77
  }));
86
78
  return true;
87
79
  }
88
80
  };
89
- __decorate([
81
+ tslib_1.__decorate([
90
82
  (0, type_graphql_1.Directive)('@transaction'),
91
83
  (0, type_graphql_1.Mutation)(returns => common_code_1.CommonCode, { description: 'To create new CommonCode' }),
92
- __param(0, (0, type_graphql_1.Arg)('commonCode')),
93
- __param(1, (0, type_graphql_1.Ctx)()),
94
- __metadata("design:type", Function),
95
- __metadata("design:paramtypes", [common_code_type_1.NewCommonCode, Object]),
96
- __metadata("design:returntype", Promise)
84
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('commonCode')),
85
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
86
+ tslib_1.__metadata("design:type", Function),
87
+ tslib_1.__metadata("design:paramtypes", [common_code_type_1.NewCommonCode, Object]),
88
+ tslib_1.__metadata("design:returntype", Promise)
97
89
  ], CommonCodeMutation.prototype, "createCommonCode", null);
98
- __decorate([
90
+ tslib_1.__decorate([
99
91
  (0, type_graphql_1.Directive)('@transaction'),
100
92
  (0, type_graphql_1.Mutation)(returns => common_code_1.CommonCode, { description: 'To modify CommonCode information' }),
101
- __param(0, (0, type_graphql_1.Arg)('name')),
102
- __param(1, (0, type_graphql_1.Arg)('patch')),
103
- __param(2, (0, type_graphql_1.Ctx)()),
104
- __metadata("design:type", Function),
105
- __metadata("design:paramtypes", [String, common_code_type_1.CommonCodePatch, Object]),
106
- __metadata("design:returntype", Promise)
93
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('name')),
94
+ tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
95
+ tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
96
+ tslib_1.__metadata("design:type", Function),
97
+ tslib_1.__metadata("design:paramtypes", [String, common_code_type_1.CommonCodePatch, Object]),
98
+ tslib_1.__metadata("design:returntype", Promise)
107
99
  ], CommonCodeMutation.prototype, "updateCommonCode", null);
108
- __decorate([
100
+ tslib_1.__decorate([
109
101
  (0, type_graphql_1.Directive)('@transaction'),
110
102
  (0, type_graphql_1.Mutation)(returns => [common_code_1.CommonCode], { description: "To modify multiple CommonCodes' information" }),
111
- __param(0, (0, type_graphql_1.Arg)('patches', type => [common_code_type_1.CommonCodePatch])),
112
- __param(1, (0, type_graphql_1.Ctx)()),
113
- __metadata("design:type", Function),
114
- __metadata("design:paramtypes", [Array, Object]),
115
- __metadata("design:returntype", Promise)
103
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [common_code_type_1.CommonCodePatch])),
104
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
105
+ tslib_1.__metadata("design:type", Function),
106
+ tslib_1.__metadata("design:paramtypes", [Array, Object]),
107
+ tslib_1.__metadata("design:returntype", Promise)
116
108
  ], CommonCodeMutation.prototype, "updateMultipleCommonCode", null);
117
- __decorate([
109
+ tslib_1.__decorate([
118
110
  (0, type_graphql_1.Directive)('@transaction'),
119
111
  (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete CommonCode' }),
120
- __param(0, (0, type_graphql_1.Arg)('id')),
121
- __param(1, (0, type_graphql_1.Ctx)()),
122
- __metadata("design:type", Function),
123
- __metadata("design:paramtypes", [String, Object]),
124
- __metadata("design:returntype", Promise)
112
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
113
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
114
+ tslib_1.__metadata("design:type", Function),
115
+ tslib_1.__metadata("design:paramtypes", [String, Object]),
116
+ tslib_1.__metadata("design:returntype", Promise)
125
117
  ], CommonCodeMutation.prototype, "deleteCommonCode", null);
126
- __decorate([
118
+ tslib_1.__decorate([
127
119
  (0, type_graphql_1.Directive)('@transaction'),
128
120
  (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple CommonCodes' }),
129
- __param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
130
- __param(1, (0, type_graphql_1.Ctx)()),
131
- __metadata("design:type", Function),
132
- __metadata("design:paramtypes", [Array, Object]),
133
- __metadata("design:returntype", Promise)
121
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
122
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
123
+ tslib_1.__metadata("design:type", Function),
124
+ tslib_1.__metadata("design:paramtypes", [Array, Object]),
125
+ tslib_1.__metadata("design:returntype", Promise)
134
126
  ], CommonCodeMutation.prototype, "deleteCommonCodes", null);
135
- __decorate([
127
+ tslib_1.__decorate([
136
128
  (0, type_graphql_1.Directive)('@transaction'),
137
129
  (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To import multiple CommonCodes' }),
138
- __param(0, (0, type_graphql_1.Arg)('commonCodes', type => [common_code_type_1.CommonCodePatch])),
139
- __param(1, (0, type_graphql_1.Ctx)()),
140
- __metadata("design:type", Function),
141
- __metadata("design:paramtypes", [Array, Object]),
142
- __metadata("design:returntype", Promise)
130
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('commonCodes', type => [common_code_type_1.CommonCodePatch])),
131
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
132
+ tslib_1.__metadata("design:type", Function),
133
+ tslib_1.__metadata("design:paramtypes", [Array, Object]),
134
+ tslib_1.__metadata("design:returntype", Promise)
143
135
  ], CommonCodeMutation.prototype, "importCommonCodes", null);
144
- CommonCodeMutation = __decorate([
136
+ CommonCodeMutation = tslib_1.__decorate([
145
137
  (0, type_graphql_1.Resolver)(common_code_1.CommonCode)
146
138
  ], CommonCodeMutation);
147
139
  exports.CommonCodeMutation = CommonCodeMutation;
@@ -1 +1 @@
1
- {"version":3,"file":"common-code-mutation.js","sourceRoot":"","sources":["../../../server/service/common-code/common-code-mutation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+CAAsE;AACtE,qCAA2C;AAE3C,iFAA2E;AAC3E,+CAA0C;AAC1C,yDAAmE;AAGnE,IAAa,kBAAkB,GAA/B,MAAa,kBAAkB;IAG7B,KAAK,CAAC,gBAAgB,CAAoB,UAAyB,EAAS,OAAY;QACtF,MAAM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AAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,gCAAgC,EAAE,CAAC;IACvD,WAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAAiB,WAAA,IAAA,kBAAG,GAAE,CAAA;;;;2DAS1E;AAID;IAFC,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,gCAAgC,EAAE,CAAC;IAE7E,WAAA,IAAA,kBAAG,EAAC,aAAa,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,kCAAe,CAAC,CAAC,CAAA;IAC7C,WAAA,IAAA,kBAAG,GAAE,CAAA;;;;2DAWP;AApIU,kBAAkB;IAD9B,IAAA,uBAAQ,EAAC,wBAAU,CAAC;GACR,kBAAkB,CAqI9B;AArIY,gDAAkB"}
1
+ {"version":3,"file":"common-code-mutation.js","sourceRoot":"","sources":["../../../server/service/common-code/common-code-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,iDAAqD;AAErD,iFAA2E;AAC3E,+CAA0C;AAC1C,yDAAmE;AAGnE,IAAa,kBAAkB,GAA/B,MAAa,kBAAkB;IAG7B,KAAK,CAAC,gBAAgB,CACD,UAAyB,EACrC,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,OAAO,GAAG,MAAM,IAAA,qBAAa,EAAC,qCAAgB,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,OAAO,IAAI,EAAE,CAAC,CAAA;QAEzF,OAAO,MAAM,EAAE,CAAC,aAAa,CAAC,wBAAU,CAAC,CAAC,IAAI,iCACzC,UAAU,KACb,OAAO;YACP,MAAM,EAC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7E,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;2DAUP;AAID;IAFC,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,gCAAgC,EAAE,CAAC;IAE7E,mBAAA,IAAA,kBAAG,EAAC,aAAa,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,kCAAe,CAAC,CAAC,CAAA;IAC7C,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;2DAaP;AA5IU,kBAAkB;IAD9B,IAAA,uBAAQ,EAAC,wBAAU,CAAC;GACR,kBAAkB,CA6I9B;AA7IY,gDAAkB","sourcesContent":["import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { getRepository } from '@things-factory/shell'\n\nimport { CommonCodeDetail } from '../common-code-detail/common-code-detail'\nimport { CommonCode } from './common-code'\nimport { CommonCodePatch, NewCommonCode } from './common-code-type'\n\n@Resolver(CommonCode)\nexport class CommonCodeMutation {\n @Directive('@transaction')\n @Mutation(returns => CommonCode, { description: 'To create new CommonCode' })\n async createCommonCode(\n @Arg('commonCode') commonCode: NewCommonCode,\n @Ctx() context: ResolverContext\n ): Promise<CommonCode> {\n const { domain, user, tx } = context.state\n\n const details = await getRepository(CommonCodeDetail).findByIds(commonCode.details || [])\n\n return await tx.getRepository(CommonCode).save({\n ...commonCode,\n details,\n domain,\n creator: user,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => CommonCode, { description: 'To modify CommonCode information' })\n async updateCommonCode(\n @Arg('name') name: string,\n @Arg('patch') patch: CommonCodePatch,\n @Ctx() context: ResolverContext\n ): Promise<CommonCode> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(CommonCode)\n const commonCode = await repository.findOne({\n where: { domain: { id: domain.id }, name },\n relations: ['details']\n })\n\n const detailIds = commonCode.details.map(detail => detail.id)\n if (patch.details && patch.details.length) {\n patch.details.forEach((detailId: string) => {\n if (!detailIds.includes(detailId)) {\n detailIds.push(detailId)\n }\n })\n }\n\n return await repository.save({\n ...commonCode,\n ...patch,\n details: await getRepository(CommonCodeDetail).findByIds(detailIds),\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => [CommonCode], { description: \"To modify multiple CommonCodes' information\" })\n async updateMultipleCommonCode(\n @Arg('patches', type => [CommonCodePatch]) patches: CommonCodePatch[],\n @Ctx() context: ResolverContext\n ): Promise<CommonCode[]> {\n const { domain, user, 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 commonCodeRepo = tx.getRepository(CommonCode)\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 commonCodeRepo.save({\n ...(newRecord as any),\n domain,\n creator: user,\n updater: user\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 newRecord = _updateRecords[i]\n const commonCode = await commonCodeRepo.findOneBy({ id: newRecord.id })\n\n const result = await commonCodeRepo.save({\n ...commonCode,\n ...(newRecord as any),\n updater: user\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete CommonCode' })\n async deleteCommonCode(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(CommonCode).delete({ domain: { id: domain.id }, id })\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple CommonCodes' })\n async deleteCommonCodes(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(CommonCode).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To import multiple CommonCodes' })\n async importCommonCodes(\n @Arg('commonCodes', type => [CommonCodePatch]) commonCodes: CommonCodePatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n commonCodes.map(async (commonCode: CommonCodePatch) => {\n const createdCommonCode: CommonCode = await tx\n .getRepository(CommonCode)\n .save({ domain, ...(commonCode as any) })\n })\n )\n\n return true\n }\n}\n"]}
@@ -1,21 +1,8 @@
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
- };
11
- var __param = (this && this.__param) || function (paramIndex, decorator) {
12
- return function (target, key) { decorator(target, key, paramIndex); }
13
- };
14
- var _a;
15
2
  Object.defineProperty(exports, "__esModule", { value: true });
16
3
  exports.CommonCodeQuery = void 0;
4
+ const tslib_1 = require("tslib");
17
5
  const type_graphql_1 = require("type-graphql");
18
- const typeorm_1 = require("typeorm");
19
6
  const auth_base_1 = require("@things-factory/auth-base");
20
7
  const shell_1 = require("@things-factory/shell");
21
8
  const common_code_detail_1 = require("../common-code-detail/common-code-detail");
@@ -24,8 +11,8 @@ const common_code_type_1 = require("./common-code-type");
24
11
  let CommonCodeQuery = class CommonCodeQuery {
25
12
  async commonCode(name, context) {
26
13
  const { domain } = context.state;
27
- return await (0, typeorm_1.getRepository)(common_code_1.CommonCode).findOne({
28
- where: { domain, name }
14
+ return await (0, shell_1.getRepository)(common_code_1.CommonCode).findOne({
15
+ where: { domain: { id: domain.id }, name }
29
16
  });
30
17
  }
31
18
  async commonCodes(params, context) {
@@ -33,86 +20,86 @@ let CommonCodeQuery = class CommonCodeQuery {
33
20
  const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
34
21
  domain,
35
22
  params,
36
- repository: await (0, typeorm_1.getRepository)(common_code_1.CommonCode),
23
+ repository: await (0, shell_1.getRepository)(common_code_1.CommonCode),
37
24
  searchables: ['name', 'description']
38
25
  });
39
26
  const [items, total] = await queryBuilder.getManyAndCount();
40
27
  return { items, total };
41
28
  }
42
29
  async partnerCommonCode(name, partnerDomainId, context) {
43
- return await (0, typeorm_1.getRepository)(common_code_1.CommonCode).findOne({
44
- where: { domain: partnerDomainId, name }
30
+ return await (0, shell_1.getRepository)(common_code_1.CommonCode).findOne({
31
+ where: { domain: { id: partnerDomainId }, name }
45
32
  });
46
33
  }
47
34
  async details(commonCode) {
48
- return await (0, typeorm_1.getRepository)(common_code_detail_1.CommonCodeDetail).find({
49
- commonCode
35
+ return await (0, shell_1.getRepository)(common_code_detail_1.CommonCodeDetail).findBy({
36
+ commonCode: { id: commonCode.id }
50
37
  });
51
38
  }
52
39
  async domain(commonCode) {
53
- return await (0, typeorm_1.getRepository)(shell_1.Domain).findOne(commonCode.domainId);
40
+ return await (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: commonCode.domainId });
54
41
  }
55
42
  async updater(commonCode) {
56
- return await (0, typeorm_1.getRepository)(auth_base_1.User).findOne(commonCode.updaterId);
43
+ return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: commonCode.updaterId });
57
44
  }
58
45
  async creator(commonCode) {
59
- return await (0, typeorm_1.getRepository)(auth_base_1.User).findOne(commonCode.creatorId);
46
+ return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: commonCode.creatorId });
60
47
  }
61
48
  };
62
- __decorate([
49
+ tslib_1.__decorate([
63
50
  (0, type_graphql_1.Query)(returns => common_code_1.CommonCode, { nullable: true, description: 'To fetch a CommonCode' }),
64
- __param(0, (0, type_graphql_1.Arg)('name')),
65
- __param(1, (0, type_graphql_1.Ctx)()),
66
- __metadata("design:type", Function),
67
- __metadata("design:paramtypes", [String, Object]),
68
- __metadata("design:returntype", Promise)
51
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('name')),
52
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
53
+ tslib_1.__metadata("design:type", Function),
54
+ tslib_1.__metadata("design:paramtypes", [String, Object]),
55
+ tslib_1.__metadata("design:returntype", Promise)
69
56
  ], CommonCodeQuery.prototype, "commonCode", null);
70
- __decorate([
57
+ tslib_1.__decorate([
71
58
  (0, type_graphql_1.Query)(returns => common_code_type_1.CommonCodeList, { description: 'To fetch multiple CommonCodes' }),
72
- __param(0, (0, type_graphql_1.Args)()),
73
- __param(1, (0, type_graphql_1.Ctx)()),
74
- __metadata("design:type", Function),
75
- __metadata("design:paramtypes", [typeof (_a = typeof shell_1.ListParam !== "undefined" && shell_1.ListParam) === "function" ? _a : Object, Object]),
76
- __metadata("design:returntype", Promise)
59
+ tslib_1.__param(0, (0, type_graphql_1.Args)()),
60
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
61
+ tslib_1.__metadata("design:type", Function),
62
+ tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
63
+ tslib_1.__metadata("design:returntype", Promise)
77
64
  ], CommonCodeQuery.prototype, "commonCodes", null);
78
- __decorate([
65
+ tslib_1.__decorate([
79
66
  (0, type_graphql_1.Query)(returns => common_code_1.CommonCode, { description: "To fetch specific domain's CommonCodes by given name" }),
80
- __param(0, (0, type_graphql_1.Arg)('name')),
81
- __param(1, (0, type_graphql_1.Arg)('partnerDomainId')),
82
- __param(2, (0, type_graphql_1.Ctx)()),
83
- __metadata("design:type", Function),
84
- __metadata("design:paramtypes", [String, String, Object]),
85
- __metadata("design:returntype", Promise)
67
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('name')),
68
+ tslib_1.__param(1, (0, type_graphql_1.Arg)('partnerDomainId')),
69
+ tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
70
+ tslib_1.__metadata("design:type", Function),
71
+ tslib_1.__metadata("design:paramtypes", [String, String, Object]),
72
+ tslib_1.__metadata("design:returntype", Promise)
86
73
  ], CommonCodeQuery.prototype, "partnerCommonCode", null);
87
- __decorate([
74
+ tslib_1.__decorate([
88
75
  (0, type_graphql_1.FieldResolver)(type => [common_code_detail_1.CommonCodeDetail]),
89
- __param(0, (0, type_graphql_1.Root)()),
90
- __metadata("design:type", Function),
91
- __metadata("design:paramtypes", [common_code_1.CommonCode]),
92
- __metadata("design:returntype", Promise)
76
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
77
+ tslib_1.__metadata("design:type", Function),
78
+ tslib_1.__metadata("design:paramtypes", [common_code_1.CommonCode]),
79
+ tslib_1.__metadata("design:returntype", Promise)
93
80
  ], CommonCodeQuery.prototype, "details", null);
94
- __decorate([
81
+ tslib_1.__decorate([
95
82
  (0, type_graphql_1.FieldResolver)(type => shell_1.Domain),
96
- __param(0, (0, type_graphql_1.Root)()),
97
- __metadata("design:type", Function),
98
- __metadata("design:paramtypes", [common_code_1.CommonCode]),
99
- __metadata("design:returntype", Promise)
83
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
84
+ tslib_1.__metadata("design:type", Function),
85
+ tslib_1.__metadata("design:paramtypes", [common_code_1.CommonCode]),
86
+ tslib_1.__metadata("design:returntype", Promise)
100
87
  ], CommonCodeQuery.prototype, "domain", null);
101
- __decorate([
88
+ tslib_1.__decorate([
102
89
  (0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
103
- __param(0, (0, type_graphql_1.Root)()),
104
- __metadata("design:type", Function),
105
- __metadata("design:paramtypes", [common_code_1.CommonCode]),
106
- __metadata("design:returntype", Promise)
90
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
91
+ tslib_1.__metadata("design:type", Function),
92
+ tslib_1.__metadata("design:paramtypes", [common_code_1.CommonCode]),
93
+ tslib_1.__metadata("design:returntype", Promise)
107
94
  ], CommonCodeQuery.prototype, "updater", null);
108
- __decorate([
95
+ tslib_1.__decorate([
109
96
  (0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
110
- __param(0, (0, type_graphql_1.Root)()),
111
- __metadata("design:type", Function),
112
- __metadata("design:paramtypes", [common_code_1.CommonCode]),
113
- __metadata("design:returntype", Promise)
97
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
98
+ tslib_1.__metadata("design:type", Function),
99
+ tslib_1.__metadata("design:paramtypes", [common_code_1.CommonCode]),
100
+ tslib_1.__metadata("design:returntype", Promise)
114
101
  ], CommonCodeQuery.prototype, "creator", null);
115
- CommonCodeQuery = __decorate([
102
+ CommonCodeQuery = tslib_1.__decorate([
116
103
  (0, type_graphql_1.Resolver)(common_code_1.CommonCode)
117
104
  ], CommonCodeQuery);
118
105
  exports.CommonCodeQuery = CommonCodeQuery;
@@ -1 +1 @@
1
- {"version":3,"file":"common-code-query.js","sourceRoot":"","sources":["../../../server/service/common-code/common-code-query.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAAmF;AACnF,qCAAuC;AAEvC,yDAAgD;AAChD,iDAAwF;AAExF,iFAA2E;AAC3E,+CAA0C;AAC1C,yDAAmD;AAGnD,IAAa,eAAe,GAA5B,MAAa,eAAe;IAE1B,KAAK,CAAC,UAAU,CAAc,IAAY,EAAS,OAAY;QAC7D,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,uBAAa,EAAC,wBAAU,CAAC,CAAC,OAA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,CAAC,iCAAc,EAAE,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;IAChE,mBAAA,IAAA,mBAAI,GAAE,CAAA;IAAqB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAAjB,iBAAS;;kDAa1C;AAGD;IADC,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,wBAAU,EAAE,EAAE,WAAW,EAAE,sDAAsD,EAAE,CAAC;IAEnG,mBAAA,IAAA,kBAAG,EAAC,MAAM,CAAC,CAAA;IACX,mBAAA,IAAA,kBAAG,EAAC,iBAAiB,CAAC,CAAA;IACtB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;wDAKP;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,qCAAgB,CAAC,CAAC;IAC3B,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAa,wBAAU;;8CAI3C;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAa,wBAAU;;6CAE1C;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAa,wBAAU;;8CAE3C;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAa,wBAAU;;8CAE3C;AAzDU,eAAe;IAD3B,IAAA,uBAAQ,EAAC,wBAAU,CAAC;GACR,eAAe,CA0D3B;AA1DY,0CAAe","sourcesContent":["import { Arg, Args, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'\n\nimport { User } from '@things-factory/auth-base'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\n\nimport { CommonCodeDetail } from '../common-code-detail/common-code-detail'\nimport { CommonCode } from './common-code'\nimport { CommonCodeList } from './common-code-type'\n\n@Resolver(CommonCode)\nexport class CommonCodeQuery {\n @Query(returns => CommonCode!, { nullable: true, description: 'To fetch a CommonCode' })\n async commonCode(@Arg('name') name: string, @Ctx() context: ResolverContext): Promise<CommonCode> {\n const { domain } = context.state\n\n return await getRepository(CommonCode).findOne({\n where: { domain: { id: domain.id }, name }\n })\n }\n\n @Query(returns => CommonCodeList, { description: 'To fetch multiple CommonCodes' })\n async commonCodes(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<CommonCodeList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(CommonCode),\n searchables: ['name', 'description']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @Query(returns => CommonCode, { description: \"To fetch specific domain's CommonCodes by given name\" })\n async partnerCommonCode(\n @Arg('name') name: string,\n @Arg('partnerDomainId') partnerDomainId: string,\n @Ctx() context: ResolverContext\n ): Promise<CommonCode> {\n return await getRepository(CommonCode).findOne({\n where: { domain: { id: partnerDomainId }, name }\n })\n }\n\n @FieldResolver(type => [CommonCodeDetail])\n async details(@Root() commonCode: CommonCode): Promise<CommonCodeDetail[]> {\n return await getRepository(CommonCodeDetail).findBy({\n commonCode: { id: commonCode.id }\n })\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() commonCode: CommonCode): Promise<Domain> {\n return await getRepository(Domain).findOneBy({ id: commonCode.domainId })\n }\n\n @FieldResolver(type => User)\n async updater(@Root() commonCode: CommonCode): Promise<User> {\n return await getRepository(User).findOneBy({ id: commonCode.updaterId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() commonCode: CommonCode): Promise<User> {\n return await getRepository(User).findOneBy({ id: commonCode.creatorId })\n }\n}\n"]}
@@ -1,72 +1,64 @@
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
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.CommonCodeList = exports.CommonCodePatch = exports.NewCommonCode = void 0;
4
+ const tslib_1 = require("tslib");
13
5
  const type_graphql_1 = require("type-graphql");
14
6
  const common_code_1 = require("./common-code");
15
7
  let NewCommonCode = class NewCommonCode {
16
8
  };
17
- __decorate([
9
+ tslib_1.__decorate([
18
10
  (0, type_graphql_1.Field)(),
19
- __metadata("design:type", String)
11
+ tslib_1.__metadata("design:type", String)
20
12
  ], NewCommonCode.prototype, "name", void 0);
21
- __decorate([
13
+ tslib_1.__decorate([
22
14
  (0, type_graphql_1.Field)({ nullable: true }),
23
- __metadata("design:type", String)
15
+ tslib_1.__metadata("design:type", String)
24
16
  ], NewCommonCode.prototype, "description", void 0);
25
- __decorate([
17
+ tslib_1.__decorate([
26
18
  (0, type_graphql_1.Field)(type => [String], { nullable: true }),
27
- __metadata("design:type", Array)
19
+ tslib_1.__metadata("design:type", Array)
28
20
  ], NewCommonCode.prototype, "details", void 0);
29
- NewCommonCode = __decorate([
21
+ NewCommonCode = tslib_1.__decorate([
30
22
  (0, type_graphql_1.InputType)()
31
23
  ], NewCommonCode);
32
24
  exports.NewCommonCode = NewCommonCode;
33
25
  let CommonCodePatch = class CommonCodePatch {
34
26
  };
35
- __decorate([
27
+ tslib_1.__decorate([
36
28
  (0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
37
- __metadata("design:type", String)
29
+ tslib_1.__metadata("design:type", String)
38
30
  ], CommonCodePatch.prototype, "id", void 0);
39
- __decorate([
31
+ tslib_1.__decorate([
40
32
  (0, type_graphql_1.Field)({ nullable: true }),
41
- __metadata("design:type", String)
33
+ tslib_1.__metadata("design:type", String)
42
34
  ], CommonCodePatch.prototype, "name", void 0);
43
- __decorate([
35
+ tslib_1.__decorate([
44
36
  (0, type_graphql_1.Field)({ nullable: true }),
45
- __metadata("design:type", String)
37
+ tslib_1.__metadata("design:type", String)
46
38
  ], CommonCodePatch.prototype, "description", void 0);
47
- __decorate([
39
+ tslib_1.__decorate([
48
40
  (0, type_graphql_1.Field)(type => [String], { nullable: true }),
49
- __metadata("design:type", Array)
41
+ tslib_1.__metadata("design:type", Array)
50
42
  ], CommonCodePatch.prototype, "details", void 0);
51
- __decorate([
43
+ tslib_1.__decorate([
52
44
  (0, type_graphql_1.Field)({ nullable: true }),
53
- __metadata("design:type", String)
45
+ tslib_1.__metadata("design:type", String)
54
46
  ], CommonCodePatch.prototype, "cuFlag", void 0);
55
- CommonCodePatch = __decorate([
47
+ CommonCodePatch = tslib_1.__decorate([
56
48
  (0, type_graphql_1.InputType)()
57
49
  ], CommonCodePatch);
58
50
  exports.CommonCodePatch = CommonCodePatch;
59
51
  let CommonCodeList = class CommonCodeList {
60
52
  };
61
- __decorate([
53
+ tslib_1.__decorate([
62
54
  (0, type_graphql_1.Field)(type => [common_code_1.CommonCode]),
63
- __metadata("design:type", Array)
55
+ tslib_1.__metadata("design:type", Array)
64
56
  ], CommonCodeList.prototype, "items", void 0);
65
- __decorate([
57
+ tslib_1.__decorate([
66
58
  (0, type_graphql_1.Field)(type => type_graphql_1.Int),
67
- __metadata("design:type", Number)
59
+ tslib_1.__metadata("design:type", Number)
68
60
  ], CommonCodeList.prototype, "total", void 0);
69
- CommonCodeList = __decorate([
61
+ CommonCodeList = tslib_1.__decorate([
70
62
  (0, type_graphql_1.ObjectType)()
71
63
  ], CommonCodeList);
72
64
  exports.CommonCodeList = CommonCodeList;
@@ -1 +1 @@
1
- {"version":3,"file":"common-code-type.js","sourceRoot":"","sources":["../../../server/service/common-code/common-code-type.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAAoE;AAEpE,+CAA0C;AAG1C,IAAa,aAAa,GAA1B,MAAa,aAAa;CASzB,CAAA;AAPC;IADC,IAAA,oBAAK,GAAE;;2CACI;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDACN;AAGpB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CAC1B;AARP,aAAa;IADzB,IAAA,wBAAS,GAAE;GACC,aAAa,CASzB;AATY,sCAAa;AAY1B,IAAa,eAAe,GAA5B,MAAa,eAAe;CAe3B,CAAA;AAbC;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CAC3B;AAGX;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACb;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;oDACN;AAGpB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDAC1B;AAGlB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACX;AAdJ,eAAe;IAD3B,IAAA,wBAAS,GAAE;GACC,eAAe,CAe3B;AAfY,0CAAe;AAkB5B,IAAa,cAAc,GAA3B,MAAa,cAAc;CAM1B,CAAA;AAJC;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,wBAAU,CAAC,CAAC;;6CACT;AAGnB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;6CACN;AALF,cAAc;IAD1B,IAAA,yBAAU,GAAE;GACA,cAAc,CAM1B;AANY,wCAAc"}
1
+ {"version":3,"file":"common-code-type.js","sourceRoot":"","sources":["../../../server/service/common-code/common-code-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAoE;AAEpE,+CAA0C;AAG1C,IAAa,aAAa,GAA1B,MAAa,aAAa;CASzB,CAAA;AAPC;IADC,IAAA,oBAAK,GAAE;;2CACI;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDACN;AAGpB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CAC1B;AARP,aAAa;IADzB,IAAA,wBAAS,GAAE;GACC,aAAa,CASzB;AATY,sCAAa;AAY1B,IAAa,eAAe,GAA5B,MAAa,eAAe;CAe3B,CAAA;AAbC;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CAC3B;AAGX;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACb;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;oDACN;AAGpB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDAC1B;AAGlB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACX;AAdJ,eAAe;IAD3B,IAAA,wBAAS,GAAE;GACC,eAAe,CAe3B;AAfY,0CAAe;AAkB5B,IAAa,cAAc,GAA3B,MAAa,cAAc;CAM1B,CAAA;AAJC;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,wBAAU,CAAC,CAAC;;6CACT;AAGnB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;6CACN;AALF,cAAc;IAD1B,IAAA,yBAAU,GAAE;GACA,cAAc,CAM1B;AANY,wCAAc","sourcesContent":["import { Field, ID, InputType, Int, ObjectType } from 'type-graphql'\n\nimport { CommonCode } from './common-code'\n\n@InputType()\nexport class NewCommonCode {\n @Field()\n name: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field(type => [String], { nullable: true })\n details?: string[]\n}\n\n@InputType()\nexport class CommonCodePatch {\n @Field(type => ID, { nullable: true })\n id?: string\n\n @Field({ nullable: true })\n name?: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field(type => [String], { nullable: true })\n details?: string[]\n\n @Field({ nullable: true })\n cuFlag?: string\n}\n\n@ObjectType()\nexport class CommonCodeList {\n @Field(type => [CommonCode])\n items: CommonCode[]\n\n @Field(type => Int)\n total: number\n}\n"]}