@things-factory/kpi 1.0.0-alpha.5

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 (259) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/assets/images/hatiolab-logo.png +0 -0
  3. package/client/index.ts +0 -0
  4. package/client/pages/kpe-metric/kpe-metric-importer.ts +90 -0
  5. package/client/pages/kpe-metric/kpe-metric-list-page.ts +398 -0
  6. package/client/pages/kpi/kpi-importer.ts +90 -0
  7. package/client/pages/kpi/kpi-list-page.ts +398 -0
  8. package/client/pages/kpi-category/kpi-category-importer.ts +90 -0
  9. package/client/pages/kpi-category/kpi-category-list-page.ts +398 -0
  10. package/client/pages/kpi-formula/kpi-formula-importer.ts +90 -0
  11. package/client/pages/kpi-formula/kpi-formula-list-page.ts +398 -0
  12. package/client/pages/kpi-grade/kpi-grade-importer.ts +90 -0
  13. package/client/pages/kpi-grade/kpi-grade-list-page.ts +398 -0
  14. package/client/pages/kpi-metric/kpi-metric-importer.ts +90 -0
  15. package/client/pages/kpi-metric/kpi-metric-list-page.ts +398 -0
  16. package/client/pages/kpi-value/kpi-value-importer.ts +90 -0
  17. package/client/pages/kpi-value/kpi-value-list-page.ts +398 -0
  18. package/client/pages/metric/metric-importer.ts +90 -0
  19. package/client/pages/metric/metric-list-page.ts +398 -0
  20. package/client/route.ts +4 -0
  21. package/client/tsconfig.json +11 -0
  22. package/design-entities.md +97 -0
  23. package/dist-client/index.d.ts +0 -0
  24. package/dist-client/index.js +2 -0
  25. package/dist-client/index.js.map +1 -0
  26. package/dist-client/pages/kpe-metric/kpe-metric-importer.d.ts +23 -0
  27. package/dist-client/pages/kpe-metric/kpe-metric-importer.js +93 -0
  28. package/dist-client/pages/kpe-metric/kpe-metric-importer.js.map +1 -0
  29. package/dist-client/pages/kpe-metric/kpe-metric-list-page.d.ts +66 -0
  30. package/dist-client/pages/kpe-metric/kpe-metric-list-page.js +370 -0
  31. package/dist-client/pages/kpe-metric/kpe-metric-list-page.js.map +1 -0
  32. package/dist-client/pages/kpi/kpi-importer.d.ts +23 -0
  33. package/dist-client/pages/kpi/kpi-importer.js +93 -0
  34. package/dist-client/pages/kpi/kpi-importer.js.map +1 -0
  35. package/dist-client/pages/kpi/kpi-list-page.d.ts +66 -0
  36. package/dist-client/pages/kpi/kpi-list-page.js +370 -0
  37. package/dist-client/pages/kpi/kpi-list-page.js.map +1 -0
  38. package/dist-client/pages/kpi-category/kpi-category-importer.d.ts +23 -0
  39. package/dist-client/pages/kpi-category/kpi-category-importer.js +93 -0
  40. package/dist-client/pages/kpi-category/kpi-category-importer.js.map +1 -0
  41. package/dist-client/pages/kpi-category/kpi-category-list-page.d.ts +66 -0
  42. package/dist-client/pages/kpi-category/kpi-category-list-page.js +370 -0
  43. package/dist-client/pages/kpi-category/kpi-category-list-page.js.map +1 -0
  44. package/dist-client/pages/kpi-formula/kpi-formula-importer.d.ts +23 -0
  45. package/dist-client/pages/kpi-formula/kpi-formula-importer.js +93 -0
  46. package/dist-client/pages/kpi-formula/kpi-formula-importer.js.map +1 -0
  47. package/dist-client/pages/kpi-formula/kpi-formula-list-page.d.ts +66 -0
  48. package/dist-client/pages/kpi-formula/kpi-formula-list-page.js +370 -0
  49. package/dist-client/pages/kpi-formula/kpi-formula-list-page.js.map +1 -0
  50. package/dist-client/pages/kpi-grade/kpi-grade-importer.d.ts +23 -0
  51. package/dist-client/pages/kpi-grade/kpi-grade-importer.js +93 -0
  52. package/dist-client/pages/kpi-grade/kpi-grade-importer.js.map +1 -0
  53. package/dist-client/pages/kpi-grade/kpi-grade-list-page.d.ts +66 -0
  54. package/dist-client/pages/kpi-grade/kpi-grade-list-page.js +370 -0
  55. package/dist-client/pages/kpi-grade/kpi-grade-list-page.js.map +1 -0
  56. package/dist-client/pages/kpi-metric/kpi-metric-importer.d.ts +23 -0
  57. package/dist-client/pages/kpi-metric/kpi-metric-importer.js +93 -0
  58. package/dist-client/pages/kpi-metric/kpi-metric-importer.js.map +1 -0
  59. package/dist-client/pages/kpi-metric/kpi-metric-list-page.d.ts +66 -0
  60. package/dist-client/pages/kpi-metric/kpi-metric-list-page.js +370 -0
  61. package/dist-client/pages/kpi-metric/kpi-metric-list-page.js.map +1 -0
  62. package/dist-client/pages/kpi-value/kpi-value-importer.d.ts +23 -0
  63. package/dist-client/pages/kpi-value/kpi-value-importer.js +93 -0
  64. package/dist-client/pages/kpi-value/kpi-value-importer.js.map +1 -0
  65. package/dist-client/pages/kpi-value/kpi-value-list-page.d.ts +66 -0
  66. package/dist-client/pages/kpi-value/kpi-value-list-page.js +370 -0
  67. package/dist-client/pages/kpi-value/kpi-value-list-page.js.map +1 -0
  68. package/dist-client/pages/metric/metric-importer.d.ts +23 -0
  69. package/dist-client/pages/metric/metric-importer.js +93 -0
  70. package/dist-client/pages/metric/metric-importer.js.map +1 -0
  71. package/dist-client/pages/metric/metric-list-page.d.ts +66 -0
  72. package/dist-client/pages/metric/metric-list-page.js +370 -0
  73. package/dist-client/pages/metric/metric-list-page.js.map +1 -0
  74. package/dist-client/route.d.ts +1 -0
  75. package/dist-client/route.js +5 -0
  76. package/dist-client/route.js.map +1 -0
  77. package/dist-client/tsconfig.tsbuildinfo +1 -0
  78. package/dist-server/index.d.ts +2 -0
  79. package/dist-server/index.js +6 -0
  80. package/dist-server/index.js.map +1 -0
  81. package/dist-server/routes.d.ts +0 -0
  82. package/dist-server/routes.js +24 -0
  83. package/dist-server/routes.js.map +1 -0
  84. package/dist-server/service/index.d.ts +16 -0
  85. package/dist-server/service/index.js +45 -0
  86. package/dist-server/service/index.js.map +1 -0
  87. package/dist-server/service/kpi/event-subscriber.d.ts +7 -0
  88. package/dist-server/service/kpi/event-subscriber.js +21 -0
  89. package/dist-server/service/kpi/event-subscriber.js.map +1 -0
  90. package/dist-server/service/kpi/index.d.ts +7 -0
  91. package/dist-server/service/kpi/index.js +12 -0
  92. package/dist-server/service/kpi/index.js.map +1 -0
  93. package/dist-server/service/kpi/kpi-history.d.ts +25 -0
  94. package/dist-server/service/kpi/kpi-history.js +128 -0
  95. package/dist-server/service/kpi/kpi-history.js.map +1 -0
  96. package/dist-server/service/kpi/kpi-mutation.d.ts +10 -0
  97. package/dist-server/service/kpi/kpi-mutation.js +169 -0
  98. package/dist-server/service/kpi/kpi-mutation.js.map +1 -0
  99. package/dist-server/service/kpi/kpi-query.d.ts +12 -0
  100. package/dist-server/service/kpi/kpi-query.js +97 -0
  101. package/dist-server/service/kpi/kpi-query.js.map +1 -0
  102. package/dist-server/service/kpi/kpi-type.d.ts +23 -0
  103. package/dist-server/service/kpi/kpi-type.js +86 -0
  104. package/dist-server/service/kpi/kpi-type.js.map +1 -0
  105. package/dist-server/service/kpi/kpi.d.ts +25 -0
  106. package/dist-server/service/kpi/kpi.js +113 -0
  107. package/dist-server/service/kpi/kpi.js.map +1 -0
  108. package/dist-server/service/kpi-category/index.d.ts +6 -0
  109. package/dist-server/service/kpi-category/index.js +10 -0
  110. package/dist-server/service/kpi-category/index.js.map +1 -0
  111. package/dist-server/service/kpi-category/kpi-category-mutation.d.ts +10 -0
  112. package/dist-server/service/kpi-category/kpi-category-mutation.js +128 -0
  113. package/dist-server/service/kpi-category/kpi-category-mutation.js.map +1 -0
  114. package/dist-server/service/kpi-category/kpi-category-query.d.ts +11 -0
  115. package/dist-server/service/kpi-category/kpi-category-query.js +79 -0
  116. package/dist-server/service/kpi-category/kpi-category-query.js.map +1 -0
  117. package/dist-server/service/kpi-category/kpi-category-type.d.ts +20 -0
  118. package/dist-server/service/kpi-category/kpi-category-type.js +77 -0
  119. package/dist-server/service/kpi-category/kpi-category-type.js.map +1 -0
  120. package/dist-server/service/kpi-category/kpi-category.d.ts +22 -0
  121. package/dist-server/service/kpi-category/kpi-category.js +95 -0
  122. package/dist-server/service/kpi-category/kpi-category.js.map +1 -0
  123. package/dist-server/service/kpi-formula/event-subscriber.d.ts +7 -0
  124. package/dist-server/service/kpi-formula/event-subscriber.js +21 -0
  125. package/dist-server/service/kpi-formula/event-subscriber.js.map +1 -0
  126. package/dist-server/service/kpi-formula/index.d.ts +7 -0
  127. package/dist-server/service/kpi-formula/index.js +12 -0
  128. package/dist-server/service/kpi-formula/index.js.map +1 -0
  129. package/dist-server/service/kpi-formula/kpi-formula-history.d.ts +25 -0
  130. package/dist-server/service/kpi-formula/kpi-formula-history.js +128 -0
  131. package/dist-server/service/kpi-formula/kpi-formula-history.js.map +1 -0
  132. package/dist-server/service/kpi-formula/kpi-formula-mutation.d.ts +10 -0
  133. package/dist-server/service/kpi-formula/kpi-formula-mutation.js +128 -0
  134. package/dist-server/service/kpi-formula/kpi-formula-mutation.js.map +1 -0
  135. package/dist-server/service/kpi-formula/kpi-formula-query.d.ts +11 -0
  136. package/dist-server/service/kpi-formula/kpi-formula-query.js +79 -0
  137. package/dist-server/service/kpi-formula/kpi-formula-query.js.map +1 -0
  138. package/dist-server/service/kpi-formula/kpi-formula-type.d.ts +20 -0
  139. package/dist-server/service/kpi-formula/kpi-formula-type.js +77 -0
  140. package/dist-server/service/kpi-formula/kpi-formula-type.js.map +1 -0
  141. package/dist-server/service/kpi-formula/kpi-formula.d.ts +24 -0
  142. package/dist-server/service/kpi-formula/kpi-formula.js +109 -0
  143. package/dist-server/service/kpi-formula/kpi-formula.js.map +1 -0
  144. package/dist-server/service/kpi-grade/event-subscriber.d.ts +7 -0
  145. package/dist-server/service/kpi-grade/event-subscriber.js +21 -0
  146. package/dist-server/service/kpi-grade/event-subscriber.js.map +1 -0
  147. package/dist-server/service/kpi-grade/index.d.ts +7 -0
  148. package/dist-server/service/kpi-grade/index.js +12 -0
  149. package/dist-server/service/kpi-grade/index.js.map +1 -0
  150. package/dist-server/service/kpi-grade/kpi-grade-history.d.ts +25 -0
  151. package/dist-server/service/kpi-grade/kpi-grade-history.js +128 -0
  152. package/dist-server/service/kpi-grade/kpi-grade-history.js.map +1 -0
  153. package/dist-server/service/kpi-grade/kpi-grade-mutation.d.ts +10 -0
  154. package/dist-server/service/kpi-grade/kpi-grade-mutation.js +128 -0
  155. package/dist-server/service/kpi-grade/kpi-grade-mutation.js.map +1 -0
  156. package/dist-server/service/kpi-grade/kpi-grade-query.d.ts +11 -0
  157. package/dist-server/service/kpi-grade/kpi-grade-query.js +79 -0
  158. package/dist-server/service/kpi-grade/kpi-grade-query.js.map +1 -0
  159. package/dist-server/service/kpi-grade/kpi-grade-type.d.ts +20 -0
  160. package/dist-server/service/kpi-grade/kpi-grade-type.js +77 -0
  161. package/dist-server/service/kpi-grade/kpi-grade-type.js.map +1 -0
  162. package/dist-server/service/kpi-grade/kpi-grade.d.ts +24 -0
  163. package/dist-server/service/kpi-grade/kpi-grade.js +109 -0
  164. package/dist-server/service/kpi-grade/kpi-grade.js.map +1 -0
  165. package/dist-server/service/kpi-metric/event-subscriber.d.ts +7 -0
  166. package/dist-server/service/kpi-metric/event-subscriber.js +21 -0
  167. package/dist-server/service/kpi-metric/event-subscriber.js.map +1 -0
  168. package/dist-server/service/kpi-metric/index.d.ts +7 -0
  169. package/dist-server/service/kpi-metric/index.js +12 -0
  170. package/dist-server/service/kpi-metric/index.js.map +1 -0
  171. package/dist-server/service/kpi-metric/kpi-metric-history.d.ts +25 -0
  172. package/dist-server/service/kpi-metric/kpi-metric-history.js +128 -0
  173. package/dist-server/service/kpi-metric/kpi-metric-history.js.map +1 -0
  174. package/dist-server/service/kpi-metric/kpi-metric-mutation.d.ts +10 -0
  175. package/dist-server/service/kpi-metric/kpi-metric-mutation.js +169 -0
  176. package/dist-server/service/kpi-metric/kpi-metric-mutation.js.map +1 -0
  177. package/dist-server/service/kpi-metric/kpi-metric-query.d.ts +12 -0
  178. package/dist-server/service/kpi-metric/kpi-metric-query.js +97 -0
  179. package/dist-server/service/kpi-metric/kpi-metric-query.js.map +1 -0
  180. package/dist-server/service/kpi-metric/kpi-metric-type.d.ts +23 -0
  181. package/dist-server/service/kpi-metric/kpi-metric-type.js +86 -0
  182. package/dist-server/service/kpi-metric/kpi-metric-type.js.map +1 -0
  183. package/dist-server/service/kpi-metric/kpi-metric.d.ts +25 -0
  184. package/dist-server/service/kpi-metric/kpi-metric.js +113 -0
  185. package/dist-server/service/kpi-metric/kpi-metric.js.map +1 -0
  186. package/dist-server/service/kpi-value/index.d.ts +6 -0
  187. package/dist-server/service/kpi-value/index.js +10 -0
  188. package/dist-server/service/kpi-value/index.js.map +1 -0
  189. package/dist-server/service/kpi-value/kpi-value-mutation.d.ts +10 -0
  190. package/dist-server/service/kpi-value/kpi-value-mutation.js +128 -0
  191. package/dist-server/service/kpi-value/kpi-value-mutation.js.map +1 -0
  192. package/dist-server/service/kpi-value/kpi-value-query.d.ts +11 -0
  193. package/dist-server/service/kpi-value/kpi-value-query.js +79 -0
  194. package/dist-server/service/kpi-value/kpi-value-query.js.map +1 -0
  195. package/dist-server/service/kpi-value/kpi-value-type.d.ts +20 -0
  196. package/dist-server/service/kpi-value/kpi-value-type.js +77 -0
  197. package/dist-server/service/kpi-value/kpi-value-type.js.map +1 -0
  198. package/dist-server/service/kpi-value/kpi-value.d.ts +22 -0
  199. package/dist-server/service/kpi-value/kpi-value.js +95 -0
  200. package/dist-server/service/kpi-value/kpi-value.js.map +1 -0
  201. package/dist-server/tsconfig.tsbuildinfo +1 -0
  202. package/helps/kpi/kpe-metric.md +160 -0
  203. package/helps/kpi/kpi-category.md +160 -0
  204. package/helps/kpi/kpi-formula.md +160 -0
  205. package/helps/kpi/kpi-grade.md +160 -0
  206. package/helps/kpi/kpi-metric.md +160 -0
  207. package/helps/kpi/kpi-value.md +160 -0
  208. package/helps/kpi/kpi.md +160 -0
  209. package/helps/kpi/metric.md +160 -0
  210. package/kpi-grade.csv +41 -0
  211. package/package.json +36 -0
  212. package/server/index.ts +3 -0
  213. package/server/routes.ts +26 -0
  214. package/server/service/index.ts +43 -0
  215. package/server/service/kpi/event-subscriber.ts +17 -0
  216. package/server/service/kpi/index.ts +9 -0
  217. package/server/service/kpi/kpi-history.ts +116 -0
  218. package/server/service/kpi/kpi-mutation.ts +198 -0
  219. package/server/service/kpi/kpi-query.ts +62 -0
  220. package/server/service/kpi/kpi-type.ts +61 -0
  221. package/server/service/kpi/kpi.ts +98 -0
  222. package/server/service/kpi-category/index.ts +7 -0
  223. package/server/service/kpi-category/kpi-category-mutation.ts +137 -0
  224. package/server/service/kpi-category/kpi-category-query.ts +48 -0
  225. package/server/service/kpi-category/kpi-category-type.ts +55 -0
  226. package/server/service/kpi-category/kpi-category.ts +84 -0
  227. package/server/service/kpi-formula/event-subscriber.ts +17 -0
  228. package/server/service/kpi-formula/index.ts +9 -0
  229. package/server/service/kpi-formula/kpi-formula-history.ts +116 -0
  230. package/server/service/kpi-formula/kpi-formula-mutation.ts +137 -0
  231. package/server/service/kpi-formula/kpi-formula-query.ts +48 -0
  232. package/server/service/kpi-formula/kpi-formula-type.ts +55 -0
  233. package/server/service/kpi-formula/kpi-formula.ts +95 -0
  234. package/server/service/kpi-grade/event-subscriber.ts +17 -0
  235. package/server/service/kpi-grade/index.ts +9 -0
  236. package/server/service/kpi-grade/kpi-grade-history.ts +116 -0
  237. package/server/service/kpi-grade/kpi-grade-mutation.ts +137 -0
  238. package/server/service/kpi-grade/kpi-grade-query.ts +48 -0
  239. package/server/service/kpi-grade/kpi-grade-type.ts +55 -0
  240. package/server/service/kpi-grade/kpi-grade.ts +95 -0
  241. package/server/service/kpi-metric/event-subscriber.ts +17 -0
  242. package/server/service/kpi-metric/index.ts +9 -0
  243. package/server/service/kpi-metric/kpi-metric-history.ts +116 -0
  244. package/server/service/kpi-metric/kpi-metric-mutation.ts +198 -0
  245. package/server/service/kpi-metric/kpi-metric-query.ts +62 -0
  246. package/server/service/kpi-metric/kpi-metric-type.ts +61 -0
  247. package/server/service/kpi-metric/kpi-metric.ts +98 -0
  248. package/server/service/kpi-value/index.ts +7 -0
  249. package/server/service/kpi-value/kpi-value-mutation.ts +137 -0
  250. package/server/service/kpi-value/kpi-value-query.ts +48 -0
  251. package/server/service/kpi-value/kpi-value-type.ts +55 -0
  252. package/server/service/kpi-value/kpi-value.ts +84 -0
  253. package/server/tsconfig.json +10 -0
  254. package/things-factory.config.js +10 -0
  255. package/translations/en.json +1 -0
  256. package/translations/ja.json +1 -0
  257. package/translations/ko.json +1 -0
  258. package/translations/ms.json +1 -0
  259. package/translations/zh.json +1 -0
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KpiValueMutation = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const type_graphql_1 = require("type-graphql");
6
+ const typeorm_1 = require("typeorm");
7
+ const shell_1 = require("@things-factory/shell");
8
+ const kpi_value_1 = require("./kpi-value");
9
+ const kpi_value_type_1 = require("./kpi-value-type");
10
+ let KpiValueMutation = class KpiValueMutation {
11
+ async createKpiValue(kpiValue, context) {
12
+ const { domain, user, tx } = context.state;
13
+ const result = await (0, shell_1.getRepository)(kpi_value_1.KpiValue, tx).save(Object.assign(Object.assign({}, kpiValue), { domain, creator: user, updater: user }));
14
+ return result;
15
+ }
16
+ async updateKpiValue(id, patch, context) {
17
+ const { domain, user, tx } = context.state;
18
+ const repository = (0, shell_1.getRepository)(kpi_value_1.KpiValue, tx);
19
+ const kpiValue = await repository.findOne({
20
+ where: { domain: { id: domain.id }, id }
21
+ });
22
+ const result = await repository.save(Object.assign(Object.assign(Object.assign({}, kpiValue), patch), { updater: user }));
23
+ return result;
24
+ }
25
+ async updateMultipleKpiValue(patches, context) {
26
+ const { domain, user, tx } = context.state;
27
+ let results = [];
28
+ const _createRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === '+');
29
+ const _updateRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === 'M');
30
+ const kpiValueRepo = (0, shell_1.getRepository)(kpi_value_1.KpiValue, tx);
31
+ if (_createRecords.length > 0) {
32
+ for (let i = 0; i < _createRecords.length; i++) {
33
+ const newRecord = _createRecords[i];
34
+ const result = await kpiValueRepo.save(Object.assign(Object.assign({}, newRecord), { domain, creator: user, updater: user }));
35
+ results.push(Object.assign(Object.assign({}, result), { cuFlag: '+' }));
36
+ }
37
+ }
38
+ if (_updateRecords.length > 0) {
39
+ for (let i = 0; i < _updateRecords.length; i++) {
40
+ const updateRecord = _updateRecords[i];
41
+ const kpiValue = await kpiValueRepo.findOneBy({ id: updateRecord.id });
42
+ const result = await kpiValueRepo.save(Object.assign(Object.assign(Object.assign({}, kpiValue), updateRecord), { updater: user }));
43
+ results.push(Object.assign(Object.assign({}, result), { cuFlag: 'M' }));
44
+ }
45
+ }
46
+ return results;
47
+ }
48
+ async deleteKpiValue(id, context) {
49
+ const { domain, tx } = context.state;
50
+ await (0, shell_1.getRepository)(kpi_value_1.KpiValue, tx).delete({ domain: { id: domain.id }, id });
51
+ return true;
52
+ }
53
+ async deleteKpiValues(ids, context) {
54
+ const { domain, tx } = context.state;
55
+ await (0, shell_1.getRepository)(kpi_value_1.KpiValue, tx).delete({
56
+ domain: { id: domain.id },
57
+ id: (0, typeorm_1.In)(ids)
58
+ });
59
+ return true;
60
+ }
61
+ async importKpiValues(kpiValues, context) {
62
+ const { domain, tx } = context.state;
63
+ await Promise.all(kpiValues.map(async (kpiValue) => {
64
+ const createdKpiValue = await (0, shell_1.getRepository)(kpi_value_1.KpiValue, tx).save(Object.assign({ domain }, kpiValue));
65
+ }));
66
+ return true;
67
+ }
68
+ };
69
+ exports.KpiValueMutation = KpiValueMutation;
70
+ tslib_1.__decorate([
71
+ (0, type_graphql_1.Directive)('@transaction'),
72
+ (0, type_graphql_1.Mutation)(returns => kpi_value_1.KpiValue, { description: 'To create new KpiValue' }),
73
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('kpiValue')),
74
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
75
+ tslib_1.__metadata("design:type", Function),
76
+ tslib_1.__metadata("design:paramtypes", [kpi_value_type_1.NewKpiValue, Object]),
77
+ tslib_1.__metadata("design:returntype", Promise)
78
+ ], KpiValueMutation.prototype, "createKpiValue", null);
79
+ tslib_1.__decorate([
80
+ (0, type_graphql_1.Directive)('@transaction'),
81
+ (0, type_graphql_1.Mutation)(returns => kpi_value_1.KpiValue, { description: 'To modify KpiValue information' }),
82
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
83
+ tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
84
+ tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
85
+ tslib_1.__metadata("design:type", Function),
86
+ tslib_1.__metadata("design:paramtypes", [String, kpi_value_type_1.KpiValuePatch, Object]),
87
+ tslib_1.__metadata("design:returntype", Promise)
88
+ ], KpiValueMutation.prototype, "updateKpiValue", null);
89
+ tslib_1.__decorate([
90
+ (0, type_graphql_1.Directive)('@transaction'),
91
+ (0, type_graphql_1.Mutation)(returns => [kpi_value_1.KpiValue], { description: "To modify multiple KpiValues' information" }),
92
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [kpi_value_type_1.KpiValuePatch])),
93
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
94
+ tslib_1.__metadata("design:type", Function),
95
+ tslib_1.__metadata("design:paramtypes", [Array, Object]),
96
+ tslib_1.__metadata("design:returntype", Promise)
97
+ ], KpiValueMutation.prototype, "updateMultipleKpiValue", null);
98
+ tslib_1.__decorate([
99
+ (0, type_graphql_1.Directive)('@transaction'),
100
+ (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete KpiValue' }),
101
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
102
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
103
+ tslib_1.__metadata("design:type", Function),
104
+ tslib_1.__metadata("design:paramtypes", [String, Object]),
105
+ tslib_1.__metadata("design:returntype", Promise)
106
+ ], KpiValueMutation.prototype, "deleteKpiValue", null);
107
+ tslib_1.__decorate([
108
+ (0, type_graphql_1.Directive)('@transaction'),
109
+ (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple KpiValues' }),
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
+ ], KpiValueMutation.prototype, "deleteKpiValues", null);
116
+ tslib_1.__decorate([
117
+ (0, type_graphql_1.Directive)('@transaction'),
118
+ (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To import multiple KpiValues' }),
119
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('kpiValues', type => [kpi_value_type_1.KpiValuePatch])),
120
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
121
+ tslib_1.__metadata("design:type", Function),
122
+ tslib_1.__metadata("design:paramtypes", [Array, Object]),
123
+ tslib_1.__metadata("design:returntype", Promise)
124
+ ], KpiValueMutation.prototype, "importKpiValues", null);
125
+ exports.KpiValueMutation = KpiValueMutation = tslib_1.__decorate([
126
+ (0, type_graphql_1.Resolver)(kpi_value_1.KpiValue)
127
+ ], KpiValueMutation);
128
+ //# sourceMappingURL=kpi-value-mutation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kpi-value-mutation.js","sourceRoot":"","sources":["../../../server/service/kpi-value/kpi-value-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAC5B,iDAAqD;AAErD,2CAAsC;AACtC,qDAA6D;AAGtD,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAGrB,AAAN,KAAK,CAAC,cAAc,CAAkB,QAAqB,EAAS,OAAwB;QAC1F,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAa,EAAC,oBAAQ,EAAE,EAAE,CAAC,CAAC,IAAI,iCAChD,QAAQ,KACX,MAAM,EACN,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,IAAI,IACb,CAAA;QAEF,OAAO,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,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;uDAWP;2BA/HU,gBAAgB;IAD5B,IAAA,uBAAQ,EAAC,oBAAQ,CAAC;GACN,gBAAgB,CAgI5B","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\nimport { getRepository } from '@things-factory/shell'\n\nimport { KpiValue } from './kpi-value'\nimport { NewKpiValue, KpiValuePatch } from './kpi-value-type'\n\n@Resolver(KpiValue)\nexport class KpiValueMutation {\n @Directive('@transaction')\n @Mutation(returns => KpiValue, { description: 'To create new KpiValue' })\n async createKpiValue(@Arg('kpiValue') kpiValue: NewKpiValue, @Ctx() context: ResolverContext): Promise<KpiValue> {\n const { domain, user, tx } = context.state\n\n const result = await getRepository(KpiValue, tx).save({\n ...kpiValue,\n domain,\n creator: user,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => KpiValue, { description: 'To modify KpiValue information' })\n async updateKpiValue(\n @Arg('id') id: string,\n @Arg('patch') patch: KpiValuePatch,\n @Ctx() context: ResolverContext\n ): Promise<KpiValue> {\n const { domain, user, tx } = context.state\n\n const repository = getRepository(KpiValue, tx)\n const kpiValue = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...kpiValue,\n ...patch,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => [KpiValue], { description: \"To modify multiple KpiValues' information\" })\n async updateMultipleKpiValue(\n @Arg('patches', type => [KpiValuePatch]) patches: KpiValuePatch[],\n @Ctx() context: ResolverContext\n ): Promise<KpiValue[]> {\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 kpiValueRepo = getRepository(KpiValue, tx)\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 kpiValueRepo.save({\n ...newRecord,\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 updateRecord = _updateRecords[i]\n const kpiValue = await kpiValueRepo.findOneBy({ id: updateRecord.id })\n\n const result = await kpiValueRepo.save({\n ...kpiValue,\n ...updateRecord,\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 KpiValue' })\n async deleteKpiValue(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(KpiValue, tx).delete({ domain: { id: domain.id }, id })\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple KpiValues' })\n async deleteKpiValues(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(KpiValue, tx).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To import multiple KpiValues' })\n async importKpiValues(\n @Arg('kpiValues', type => [KpiValuePatch]) kpiValues: KpiValuePatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n kpiValues.map(async (kpiValue: KpiValuePatch) => {\n const createdKpiValue: KpiValue = await getRepository(KpiValue, tx).save({ domain, ...kpiValue })\n })\n )\n\n return true\n }\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import { Domain, ListParam } from '@things-factory/shell';
2
+ import { User } from '@things-factory/auth-base';
3
+ import { KpiValue } from './kpi-value';
4
+ import { KpiValueList } from './kpi-value-type';
5
+ export declare class KpiValueQuery {
6
+ kpiValue(id: string, context: ResolverContext): Promise<KpiValue>;
7
+ kpiValues(params: ListParam, context: ResolverContext): Promise<KpiValueList>;
8
+ domain(kpiValue: KpiValue): Promise<Domain>;
9
+ updater(kpiValue: KpiValue): Promise<User>;
10
+ creator(kpiValue: KpiValue): Promise<User>;
11
+ }
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KpiValueQuery = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const type_graphql_1 = require("type-graphql");
6
+ const shell_1 = require("@things-factory/shell");
7
+ const auth_base_1 = require("@things-factory/auth-base");
8
+ const kpi_value_1 = require("./kpi-value");
9
+ const kpi_value_type_1 = require("./kpi-value-type");
10
+ let KpiValueQuery = class KpiValueQuery {
11
+ async kpiValue(id, context) {
12
+ const { domain } = context.state;
13
+ return await (0, shell_1.getRepository)(kpi_value_1.KpiValue).findOne({
14
+ where: { domain: { id: domain.id }, id }
15
+ });
16
+ }
17
+ async kpiValues(params, context) {
18
+ const { domain } = context.state;
19
+ const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
20
+ domain,
21
+ params,
22
+ repository: await (0, shell_1.getRepository)(kpi_value_1.KpiValue),
23
+ searchables: ['name', 'description']
24
+ });
25
+ const [items, total] = await queryBuilder.getManyAndCount();
26
+ return { items, total };
27
+ }
28
+ async domain(kpiValue) {
29
+ return kpiValue.domainId && (await (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: kpiValue.domainId }));
30
+ }
31
+ async updater(kpiValue) {
32
+ return kpiValue.updaterId && (await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: kpiValue.updaterId }));
33
+ }
34
+ async creator(kpiValue) {
35
+ return kpiValue.creatorId && (await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: kpiValue.creatorId }));
36
+ }
37
+ };
38
+ exports.KpiValueQuery = KpiValueQuery;
39
+ tslib_1.__decorate([
40
+ (0, type_graphql_1.Query)(returns => kpi_value_1.KpiValue, { nullable: true, description: 'To fetch a KpiValue' }),
41
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
42
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
43
+ tslib_1.__metadata("design:type", Function),
44
+ tslib_1.__metadata("design:paramtypes", [String, Object]),
45
+ tslib_1.__metadata("design:returntype", Promise)
46
+ ], KpiValueQuery.prototype, "kpiValue", null);
47
+ tslib_1.__decorate([
48
+ (0, type_graphql_1.Query)(returns => kpi_value_type_1.KpiValueList, { description: 'To fetch multiple KpiValues' }),
49
+ tslib_1.__param(0, (0, type_graphql_1.Args)(type => shell_1.ListParam)),
50
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
51
+ tslib_1.__metadata("design:type", Function),
52
+ tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
53
+ tslib_1.__metadata("design:returntype", Promise)
54
+ ], KpiValueQuery.prototype, "kpiValues", null);
55
+ tslib_1.__decorate([
56
+ (0, type_graphql_1.FieldResolver)(type => shell_1.Domain),
57
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
58
+ tslib_1.__metadata("design:type", Function),
59
+ tslib_1.__metadata("design:paramtypes", [kpi_value_1.KpiValue]),
60
+ tslib_1.__metadata("design:returntype", Promise)
61
+ ], KpiValueQuery.prototype, "domain", null);
62
+ tslib_1.__decorate([
63
+ (0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
64
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
65
+ tslib_1.__metadata("design:type", Function),
66
+ tslib_1.__metadata("design:paramtypes", [kpi_value_1.KpiValue]),
67
+ tslib_1.__metadata("design:returntype", Promise)
68
+ ], KpiValueQuery.prototype, "updater", null);
69
+ tslib_1.__decorate([
70
+ (0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
71
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
72
+ tslib_1.__metadata("design:type", Function),
73
+ tslib_1.__metadata("design:paramtypes", [kpi_value_1.KpiValue]),
74
+ tslib_1.__metadata("design:returntype", Promise)
75
+ ], KpiValueQuery.prototype, "creator", null);
76
+ exports.KpiValueQuery = KpiValueQuery = tslib_1.__decorate([
77
+ (0, type_graphql_1.Resolver)(kpi_value_1.KpiValue)
78
+ ], KpiValueQuery);
79
+ //# sourceMappingURL=kpi-value-query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kpi-value-query.js","sourceRoot":"","sources":["../../../server/service/kpi-value/kpi-value-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,iDAAuG;AACvG,yDAAgD;AAChD,2CAAsC;AACtC,qDAA+C;AAGxC,IAAM,aAAa,GAAnB,MAAM,aAAa;IAElB,AAAN,KAAK,CAAC,QAAQ,CAAY,EAAU,EAAS,OAAwB;QACnE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,qBAAa,EAAC,oBAAQ,CAAC,CAAC,OAAO,CAAC;YAC3C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;SACzC,CAAC,CAAA;IACJ,CAAC;IAGK,AAAN,KAAK,CAAC,SAAS,CAA0B,MAAiB,EAAS,OAAwB;QACzF,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,MAAM,YAAY,GAAG,IAAA,qCAA6B,EAAC;YACjD,MAAM;YACN,MAAM;YACN,UAAU,EAAE,MAAM,IAAA,qBAAa,EAAC,oBAAQ,CAAC;YACzC,WAAW,EAAE,CAAC,MAAM,EAAE,aAAa,CAAC;SACrC,CAAC,CAAA;QAEF,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,MAAM,YAAY,CAAC,eAAe,EAAE,CAAA;QAE3D,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;IACzB,CAAC;IAGK,AAAN,KAAK,CAAC,MAAM,CAAS,QAAkB;QACrC,OAAO,QAAQ,CAAC,QAAQ,IAAI,CA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,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAW,oBAAQ;;4CAEvC;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAW,oBAAQ;;4CAEvC;wBAvCU,aAAa;IADzB,IAAA,uBAAQ,EAAC,oBAAQ,CAAC;GACN,aAAa,CAwCzB","sourcesContent":["import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { KpiValue } from './kpi-value'\nimport { KpiValueList } from './kpi-value-type'\n\n@Resolver(KpiValue)\nexport class KpiValueQuery {\n @Query(returns => KpiValue!, { nullable: true, description: 'To fetch a KpiValue' })\n async kpiValue(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<KpiValue> {\n const { domain } = context.state\n\n return await getRepository(KpiValue).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Query(returns => KpiValueList, { description: 'To fetch multiple KpiValues' })\n async kpiValues(@Args(type => ListParam) params: ListParam, @Ctx() context: ResolverContext): Promise<KpiValueList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(KpiValue),\n searchables: ['name', 'description']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() kpiValue: KpiValue): Promise<Domain> {\n return kpiValue.domainId && (await getRepository(Domain).findOneBy({ id: kpiValue.domainId }))\n }\n\n @FieldResolver(type => User)\n async updater(@Root() kpiValue: KpiValue): Promise<User> {\n return kpiValue.updaterId && (await getRepository(User).findOneBy({ id: kpiValue.updaterId }))\n }\n\n @FieldResolver(type => User)\n async creator(@Root() kpiValue: KpiValue): Promise<User> {\n return kpiValue.creatorId && (await getRepository(User).findOneBy({ id: kpiValue.creatorId }))\n }\n}\n"]}
@@ -0,0 +1,20 @@
1
+ import { KpiValue, KpiValueStatus } from './kpi-value';
2
+ export declare class NewKpiValue {
3
+ name: string;
4
+ description?: string;
5
+ state?: KpiValueStatus;
6
+ active?: boolean;
7
+ params?: string;
8
+ }
9
+ export declare class KpiValuePatch {
10
+ id?: string;
11
+ name?: string;
12
+ description?: string;
13
+ state?: KpiValueStatus;
14
+ active?: boolean;
15
+ cuFlag?: string;
16
+ }
17
+ export declare class KpiValueList {
18
+ items: KpiValue[];
19
+ total: number;
20
+ }
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KpiValueList = exports.KpiValuePatch = exports.NewKpiValue = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const type_graphql_1 = require("type-graphql");
6
+ const kpi_value_1 = require("./kpi-value");
7
+ let NewKpiValue = class NewKpiValue {
8
+ };
9
+ exports.NewKpiValue = NewKpiValue;
10
+ tslib_1.__decorate([
11
+ (0, type_graphql_1.Field)(),
12
+ tslib_1.__metadata("design:type", String)
13
+ ], NewKpiValue.prototype, "name", void 0);
14
+ tslib_1.__decorate([
15
+ (0, type_graphql_1.Field)({ nullable: true }),
16
+ tslib_1.__metadata("design:type", String)
17
+ ], NewKpiValue.prototype, "description", void 0);
18
+ tslib_1.__decorate([
19
+ (0, type_graphql_1.Field)(type => kpi_value_1.KpiValueStatus, { nullable: true }),
20
+ tslib_1.__metadata("design:type", String)
21
+ ], NewKpiValue.prototype, "state", void 0);
22
+ tslib_1.__decorate([
23
+ (0, type_graphql_1.Field)({ nullable: true }),
24
+ tslib_1.__metadata("design:type", Boolean)
25
+ ], NewKpiValue.prototype, "active", void 0);
26
+ tslib_1.__decorate([
27
+ (0, type_graphql_1.Field)({ nullable: true }),
28
+ tslib_1.__metadata("design:type", String)
29
+ ], NewKpiValue.prototype, "params", void 0);
30
+ exports.NewKpiValue = NewKpiValue = tslib_1.__decorate([
31
+ (0, type_graphql_1.InputType)()
32
+ ], NewKpiValue);
33
+ let KpiValuePatch = class KpiValuePatch {
34
+ };
35
+ exports.KpiValuePatch = KpiValuePatch;
36
+ tslib_1.__decorate([
37
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
38
+ tslib_1.__metadata("design:type", String)
39
+ ], KpiValuePatch.prototype, "id", void 0);
40
+ tslib_1.__decorate([
41
+ (0, type_graphql_1.Field)({ nullable: true }),
42
+ tslib_1.__metadata("design:type", String)
43
+ ], KpiValuePatch.prototype, "name", void 0);
44
+ tslib_1.__decorate([
45
+ (0, type_graphql_1.Field)({ nullable: true }),
46
+ tslib_1.__metadata("design:type", String)
47
+ ], KpiValuePatch.prototype, "description", void 0);
48
+ tslib_1.__decorate([
49
+ (0, type_graphql_1.Field)(type => kpi_value_1.KpiValueStatus, { nullable: true }),
50
+ tslib_1.__metadata("design:type", String)
51
+ ], KpiValuePatch.prototype, "state", void 0);
52
+ tslib_1.__decorate([
53
+ (0, type_graphql_1.Field)({ nullable: true }),
54
+ tslib_1.__metadata("design:type", Boolean)
55
+ ], KpiValuePatch.prototype, "active", void 0);
56
+ tslib_1.__decorate([
57
+ (0, type_graphql_1.Field)({ nullable: true }),
58
+ tslib_1.__metadata("design:type", String)
59
+ ], KpiValuePatch.prototype, "cuFlag", void 0);
60
+ exports.KpiValuePatch = KpiValuePatch = tslib_1.__decorate([
61
+ (0, type_graphql_1.InputType)()
62
+ ], KpiValuePatch);
63
+ let KpiValueList = class KpiValueList {
64
+ };
65
+ exports.KpiValueList = KpiValueList;
66
+ tslib_1.__decorate([
67
+ (0, type_graphql_1.Field)(type => [kpi_value_1.KpiValue]),
68
+ tslib_1.__metadata("design:type", Array)
69
+ ], KpiValueList.prototype, "items", void 0);
70
+ tslib_1.__decorate([
71
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int),
72
+ tslib_1.__metadata("design:type", Number)
73
+ ], KpiValueList.prototype, "total", void 0);
74
+ exports.KpiValueList = KpiValueList = tslib_1.__decorate([
75
+ (0, type_graphql_1.ObjectType)()
76
+ ], KpiValueList);
77
+ //# sourceMappingURL=kpi-value-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kpi-value-type.js","sourceRoot":"","sources":["../../../server/service/kpi-value/kpi-value-type.ts"],"names":[],"mappings":";;;;AAEA,+CAAsF;AAItF,2CAAsD;AAG/C,IAAM,WAAW,GAAjB,MAAM,WAAW;CAevB,CAAA;AAfY,kCAAW;AAEtB;IADC,IAAA,oBAAK,GAAE;;yCACI;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACN;AAGpB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,0BAAc,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CAC5B;AAGtB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CACV;AAGhB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CACX;sBAdJ,WAAW;IADvB,IAAA,wBAAS,GAAE;GACC,WAAW,CAevB;AAGM,IAAM,aAAa,GAAnB,MAAM,aAAa;CAkBzB,CAAA;AAlBY,sCAAa;AAExB;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;;2CACb;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDACN;AAGpB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,0BAAc,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CAC5B;AAGtB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACV;AAGhB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACX;wBAjBJ,aAAa;IADzB,IAAA,wBAAS,GAAE;GACC,aAAa,CAkBzB;AAGM,IAAM,YAAY,GAAlB,MAAM,YAAY;CAMxB,CAAA;AANY,oCAAY;AAEvB;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;uBALF,YAAY;IADxB,IAAA,yBAAU,GAAE;GACA,YAAY,CAMxB","sourcesContent":["import type { FileUpload } from 'graphql-upload/GraphQLUpload.js'\nimport GraphQLUpload from 'graphql-upload/GraphQLUpload.js'\nimport { ObjectType, Field, InputType, Int, ID, registerEnumType } from 'type-graphql'\n\nimport { ObjectRef, ScalarObject } from '@things-factory/shell'\n\nimport { KpiValue, KpiValueStatus } from './kpi-value'\n\n@InputType()\nexport class NewKpiValue {\n @Field()\n name: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field(type => KpiValueStatus, { nullable: true })\n state?: KpiValueStatus\n\n @Field({ nullable: true })\n active?: boolean\n\n @Field({ nullable: true })\n params?: string\n}\n\n@InputType()\nexport class KpiValuePatch {\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 => KpiValueStatus, { nullable: true })\n state?: KpiValueStatus\n\n @Field({ nullable: true })\n active?: boolean\n \n @Field({ nullable: true })\n cuFlag?: string\n}\n\n@ObjectType()\nexport class KpiValueList {\n @Field(type => [KpiValue])\n items: KpiValue[]\n\n @Field(type => Int)\n total: number\n}\n"]}
@@ -0,0 +1,22 @@
1
+ import { Domain } from '@things-factory/shell';
2
+ import { User } from '@things-factory/auth-base';
3
+ export declare enum KpiValueStatus {
4
+ STATUS_A = "STATUS_A",
5
+ STATUS_B = "STATUS_B"
6
+ }
7
+ export declare class KpiValue {
8
+ readonly id: string;
9
+ domain?: Domain;
10
+ domainId?: string;
11
+ name?: string;
12
+ description?: string;
13
+ active?: boolean;
14
+ state?: KpiValueStatus;
15
+ params?: string;
16
+ createdAt?: Date;
17
+ updatedAt?: Date;
18
+ creator?: User;
19
+ creatorId?: string;
20
+ updater?: User;
21
+ updaterId?: string;
22
+ }
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KpiValue = exports.KpiValueStatus = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const typeorm_1 = require("typeorm");
6
+ const type_graphql_1 = require("type-graphql");
7
+ const shell_1 = require("@things-factory/shell");
8
+ const auth_base_1 = require("@things-factory/auth-base");
9
+ var KpiValueStatus;
10
+ (function (KpiValueStatus) {
11
+ KpiValueStatus["STATUS_A"] = "STATUS_A";
12
+ KpiValueStatus["STATUS_B"] = "STATUS_B";
13
+ })(KpiValueStatus || (exports.KpiValueStatus = KpiValueStatus = {}));
14
+ (0, type_graphql_1.registerEnumType)(KpiValueStatus, {
15
+ name: 'KpiValueStatus',
16
+ description: 'state enumeration of a kpiValue'
17
+ });
18
+ let KpiValue = class KpiValue {
19
+ };
20
+ exports.KpiValue = KpiValue;
21
+ tslib_1.__decorate([
22
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
23
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID),
24
+ tslib_1.__metadata("design:type", String)
25
+ ], KpiValue.prototype, "id", void 0);
26
+ tslib_1.__decorate([
27
+ (0, typeorm_1.ManyToOne)(type => shell_1.Domain),
28
+ (0, type_graphql_1.Field)({ nullable: true }),
29
+ tslib_1.__metadata("design:type", shell_1.Domain)
30
+ ], KpiValue.prototype, "domain", void 0);
31
+ tslib_1.__decorate([
32
+ (0, typeorm_1.RelationId)((kpiValue) => kpiValue.domain),
33
+ tslib_1.__metadata("design:type", String)
34
+ ], KpiValue.prototype, "domainId", void 0);
35
+ tslib_1.__decorate([
36
+ (0, typeorm_1.Column)(),
37
+ (0, type_graphql_1.Field)({ nullable: true }),
38
+ tslib_1.__metadata("design:type", String)
39
+ ], KpiValue.prototype, "name", void 0);
40
+ tslib_1.__decorate([
41
+ (0, typeorm_1.Column)({ nullable: true }),
42
+ (0, type_graphql_1.Field)({ nullable: true }),
43
+ tslib_1.__metadata("design:type", String)
44
+ ], KpiValue.prototype, "description", void 0);
45
+ tslib_1.__decorate([
46
+ (0, typeorm_1.Column)({ nullable: false, default: false }),
47
+ (0, type_graphql_1.Field)({ nullable: true }),
48
+ tslib_1.__metadata("design:type", Boolean)
49
+ ], KpiValue.prototype, "active", void 0);
50
+ tslib_1.__decorate([
51
+ (0, typeorm_1.Column)({ nullable: true }),
52
+ (0, type_graphql_1.Field)({ nullable: true }),
53
+ tslib_1.__metadata("design:type", String)
54
+ ], KpiValue.prototype, "state", void 0);
55
+ tslib_1.__decorate([
56
+ (0, typeorm_1.Column)({ nullable: true }),
57
+ (0, type_graphql_1.Field)({ nullable: true }),
58
+ tslib_1.__metadata("design:type", String)
59
+ ], KpiValue.prototype, "params", void 0);
60
+ tslib_1.__decorate([
61
+ (0, typeorm_1.CreateDateColumn)(),
62
+ (0, type_graphql_1.Field)({ nullable: true }),
63
+ tslib_1.__metadata("design:type", Date)
64
+ ], KpiValue.prototype, "createdAt", void 0);
65
+ tslib_1.__decorate([
66
+ (0, typeorm_1.UpdateDateColumn)(),
67
+ (0, type_graphql_1.Field)({ nullable: true }),
68
+ tslib_1.__metadata("design:type", Date)
69
+ ], KpiValue.prototype, "updatedAt", void 0);
70
+ tslib_1.__decorate([
71
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
72
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
73
+ tslib_1.__metadata("design:type", auth_base_1.User)
74
+ ], KpiValue.prototype, "creator", void 0);
75
+ tslib_1.__decorate([
76
+ (0, typeorm_1.RelationId)((kpiValue) => kpiValue.creator),
77
+ tslib_1.__metadata("design:type", String)
78
+ ], KpiValue.prototype, "creatorId", void 0);
79
+ tslib_1.__decorate([
80
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
81
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
82
+ tslib_1.__metadata("design:type", auth_base_1.User)
83
+ ], KpiValue.prototype, "updater", void 0);
84
+ tslib_1.__decorate([
85
+ (0, typeorm_1.RelationId)((kpiValue) => kpiValue.updater),
86
+ tslib_1.__metadata("design:type", String)
87
+ ], KpiValue.prototype, "updaterId", void 0);
88
+ exports.KpiValue = KpiValue = tslib_1.__decorate([
89
+ (0, typeorm_1.Entity)(),
90
+ (0, typeorm_1.Index)('ix_kpi_value_0', (kpiValue) => [kpiValue.domain, kpiValue.name], {
91
+ unique: true
92
+ }),
93
+ (0, type_graphql_1.ObjectType)({ description: 'Entity for KpiValue' })
94
+ ], KpiValue);
95
+ //# sourceMappingURL=kpi-value.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kpi-value.js","sourceRoot":"","sources":["../../../server/service/kpi-value/kpi-value.ts"],"names":[],"mappings":";;;;AAAA,qCASgB;AAChB,+CAA2E;AAE3E,iDAA8C;AAC9C,yDAAgD;AAEhD,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,uCAAqB,CAAA;IACrB,uCAAqB,CAAA;AACvB,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAED,IAAA,+BAAgB,EAAC,cAAc,EAAE;IAC/B,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,iCAAiC;CAC/C,CAAC,CAAA;AAOK,IAAM,QAAQ,GAAd,MAAM,QAAQ;CAqDpB,CAAA;AArDY,4BAAQ;AAGV;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI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C,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3C,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCAC9B,gBAAI;yCAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,QAAkB,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC;;2CACnC;AAIlB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3C,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCAC9B,gBAAI;yCAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,QAAkB,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC;;2CACnC;mBApDP,QAAQ;IALpB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,gBAAgB,EAAE,CAAC,QAAkB,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE;QACjF,MAAM,EAAE,IAAI;KACb,CAAC;IACD,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,qBAAqB,EAAE,CAAC;GACtC,QAAQ,CAqDpB","sourcesContent":["import {\n CreateDateColumn,\n UpdateDateColumn,\n Entity,\n Index,\n Column,\n RelationId,\n ManyToOne,\n PrimaryGeneratedColumn\n} from 'typeorm'\nimport { ObjectType, Field, Int, ID, registerEnumType } from 'type-graphql'\n\nimport { Domain } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\n\nexport enum KpiValueStatus {\n STATUS_A = 'STATUS_A',\n STATUS_B = 'STATUS_B'\n}\n\nregisterEnumType(KpiValueStatus, {\n name: 'KpiValueStatus',\n description: 'state enumeration of a kpiValue'\n})\n\n@Entity()\n@Index('ix_kpi_value_0', (kpiValue: KpiValue) => [kpiValue.domain, kpiValue.name], {\n unique: true\n})\n@ObjectType({ description: 'Entity for KpiValue' })\nexport class KpiValue {\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((kpiValue: KpiValue) => kpiValue.domain)\n domainId?: string\n\n @Column()\n @Field({ nullable: true })\n name?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n description?: string\n\n @Column({ nullable: false, default: false })\n @Field({ nullable: true })\n active?: boolean\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n state?: KpiValueStatus\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n params?: string\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, { nullable: true })\n @Field(type => User, { nullable: true })\n creator?: User\n\n @RelationId((kpiValue: KpiValue) => kpiValue.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((kpiValue: KpiValue) => kpiValue.updater)\n updaterId?: string\n}\n"]}