@dssp/project 0.0.2

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 (195) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/assets/images/hatiolab-logo.png +0 -0
  3. package/assets/images/o-mark.png +0 -0
  4. package/assets/images/x-mark.png +0 -0
  5. package/client/bootstrap.ts +0 -0
  6. package/client/index.ts +0 -0
  7. package/client/pages/checklist/checklist-importer.ts +96 -0
  8. package/client/pages/checklist/checklist-list-page.ts +355 -0
  9. package/client/pages/lib/waether.ts +159 -0
  10. package/client/pages/project/ox-progress-circle.ts +133 -0
  11. package/client/pages/project/project-create-popup.ts +148 -0
  12. package/client/pages/project/project-detail.ts +618 -0
  13. package/client/pages/project/project-list.ts +354 -0
  14. package/client/pages/project/project-plan-management.ts +437 -0
  15. package/client/pages/project/project-schedule-list.ts +280 -0
  16. package/client/pages/project/project-schedule.ts +248 -0
  17. package/client/pages/project/project-setting-list.ts +298 -0
  18. package/client/pages/project/project-update.ts +797 -0
  19. package/client/pages/resource/resource-importer.ts +96 -0
  20. package/client/pages/resource/resource-list-page.ts +355 -0
  21. package/client/pages/task/task-importer.ts +96 -0
  22. package/client/pages/task/task-list-page.ts +355 -0
  23. package/client/route.ts +39 -0
  24. package/client/tsconfig.json +11 -0
  25. package/dist-client/bootstrap.d.ts +0 -0
  26. package/dist-client/bootstrap.js +2 -0
  27. package/dist-client/bootstrap.js.map +1 -0
  28. package/dist-client/index.d.ts +0 -0
  29. package/dist-client/index.js +2 -0
  30. package/dist-client/index.js.map +1 -0
  31. package/dist-client/pages/checklist/checklist-importer.d.ts +9 -0
  32. package/dist-client/pages/checklist/checklist-importer.js +100 -0
  33. package/dist-client/pages/checklist/checklist-importer.js.map +1 -0
  34. package/dist-client/pages/checklist/checklist-list-page.d.ts +62 -0
  35. package/dist-client/pages/checklist/checklist-list-page.js +331 -0
  36. package/dist-client/pages/checklist/checklist-list-page.js.map +1 -0
  37. package/dist-client/pages/lib/waether.d.ts +6 -0
  38. package/dist-client/pages/lib/waether.js +152 -0
  39. package/dist-client/pages/lib/waether.js.map +1 -0
  40. package/dist-client/pages/project/ox-progress-circle.d.ts +41 -0
  41. package/dist-client/pages/project/ox-progress-circle.js +182 -0
  42. package/dist-client/pages/project/ox-progress-circle.js.map +1 -0
  43. package/dist-client/pages/project/project-create-popup.d.ts +14 -0
  44. package/dist-client/pages/project/project-create-popup.js +153 -0
  45. package/dist-client/pages/project/project-create-popup.js.map +1 -0
  46. package/dist-client/pages/project/project-detail.d.ts +35 -0
  47. package/dist-client/pages/project/project-detail.js +617 -0
  48. package/dist-client/pages/project/project-detail.js.map +1 -0
  49. package/dist-client/pages/project/project-list.d.ts +88 -0
  50. package/dist-client/pages/project/project-list.js +303 -0
  51. package/dist-client/pages/project/project-list.js.map +1 -0
  52. package/dist-client/pages/project/project-plan-management.d.ts +27 -0
  53. package/dist-client/pages/project/project-plan-management.js +438 -0
  54. package/dist-client/pages/project/project-plan-management.js.map +1 -0
  55. package/dist-client/pages/project/project-schedule-list.d.ts +18 -0
  56. package/dist-client/pages/project/project-schedule-list.js +292 -0
  57. package/dist-client/pages/project/project-schedule-list.js.map +1 -0
  58. package/dist-client/pages/project/project-schedule.d.ts +23 -0
  59. package/dist-client/pages/project/project-schedule.js +256 -0
  60. package/dist-client/pages/project/project-schedule.js.map +1 -0
  61. package/dist-client/pages/project/project-setting-list.d.ts +23 -0
  62. package/dist-client/pages/project/project-setting-list.js +307 -0
  63. package/dist-client/pages/project/project-setting-list.js.map +1 -0
  64. package/dist-client/pages/project/project-update.d.ts +24 -0
  65. package/dist-client/pages/project/project-update.js +797 -0
  66. package/dist-client/pages/project/project-update.js.map +1 -0
  67. package/dist-client/pages/resource/resource-importer.d.ts +9 -0
  68. package/dist-client/pages/resource/resource-importer.js +100 -0
  69. package/dist-client/pages/resource/resource-importer.js.map +1 -0
  70. package/dist-client/pages/resource/resource-list-page.d.ts +62 -0
  71. package/dist-client/pages/resource/resource-list-page.js +331 -0
  72. package/dist-client/pages/resource/resource-list-page.js.map +1 -0
  73. package/dist-client/pages/task/task-importer.d.ts +9 -0
  74. package/dist-client/pages/task/task-importer.js +100 -0
  75. package/dist-client/pages/task/task-importer.js.map +1 -0
  76. package/dist-client/pages/task/task-list-page.d.ts +62 -0
  77. package/dist-client/pages/task/task-list-page.js +331 -0
  78. package/dist-client/pages/task/task-list-page.js.map +1 -0
  79. package/dist-client/route.d.ts +1 -0
  80. package/dist-client/route.js +32 -0
  81. package/dist-client/route.js.map +1 -0
  82. package/dist-client/tsconfig.tsbuildinfo +1 -0
  83. package/dist-server/controllers/index.js +1 -0
  84. package/dist-server/controllers/index.js.map +1 -0
  85. package/dist-server/controllers/project-to-excel.js +30 -0
  86. package/dist-server/controllers/project-to-excel.js.map +1 -0
  87. package/dist-server/index.js +6 -0
  88. package/dist-server/index.js.map +1 -0
  89. package/dist-server/middlewares/index.js +8 -0
  90. package/dist-server/middlewares/index.js.map +1 -0
  91. package/dist-server/routes.js +105 -0
  92. package/dist-server/routes.js.map +1 -0
  93. package/dist-server/service/check-item/check-item-mutation.js +129 -0
  94. package/dist-server/service/check-item/check-item-mutation.js.map +1 -0
  95. package/dist-server/service/check-item/check-item-query.js +86 -0
  96. package/dist-server/service/check-item/check-item-query.js.map +1 -0
  97. package/dist-server/service/check-item/check-item-type.js +69 -0
  98. package/dist-server/service/check-item/check-item-type.js.map +1 -0
  99. package/dist-server/service/check-item/check-item.js +84 -0
  100. package/dist-server/service/check-item/check-item.js.map +1 -0
  101. package/dist-server/service/check-item/index.js +9 -0
  102. package/dist-server/service/check-item/index.js.map +1 -0
  103. package/dist-server/service/checklist/checklist-mutation.js +129 -0
  104. package/dist-server/service/checklist/checklist-mutation.js.map +1 -0
  105. package/dist-server/service/checklist/checklist-query.js +86 -0
  106. package/dist-server/service/checklist/checklist-query.js.map +1 -0
  107. package/dist-server/service/checklist/checklist-type.js +69 -0
  108. package/dist-server/service/checklist/checklist-type.js.map +1 -0
  109. package/dist-server/service/checklist/checklist.js +120 -0
  110. package/dist-server/service/checklist/checklist.js.map +1 -0
  111. package/dist-server/service/checklist/index.js +9 -0
  112. package/dist-server/service/checklist/index.js.map +1 -0
  113. package/dist-server/service/index.js +36 -0
  114. package/dist-server/service/index.js.map +1 -0
  115. package/dist-server/service/project/index.js +11 -0
  116. package/dist-server/service/project/index.js.map +1 -0
  117. package/dist-server/service/project/project-mutation.js +190 -0
  118. package/dist-server/service/project/project-mutation.js.map +1 -0
  119. package/dist-server/service/project/project-query.js +143 -0
  120. package/dist-server/service/project/project-query.js.map +1 -0
  121. package/dist-server/service/project/project-type.js +106 -0
  122. package/dist-server/service/project/project-type.js.map +1 -0
  123. package/dist-server/service/project/project.js +146 -0
  124. package/dist-server/service/project/project.js.map +1 -0
  125. package/dist-server/service/resource/index.js +9 -0
  126. package/dist-server/service/resource/index.js.map +1 -0
  127. package/dist-server/service/resource/resource-mutation.js +129 -0
  128. package/dist-server/service/resource/resource-mutation.js.map +1 -0
  129. package/dist-server/service/resource/resource-query.js +86 -0
  130. package/dist-server/service/resource/resource-query.js.map +1 -0
  131. package/dist-server/service/resource/resource-type.js +69 -0
  132. package/dist-server/service/resource/resource-type.js.map +1 -0
  133. package/dist-server/service/resource/resource.js +62 -0
  134. package/dist-server/service/resource/resource.js.map +1 -0
  135. package/dist-server/service/task/index.js +9 -0
  136. package/dist-server/service/task/index.js.map +1 -0
  137. package/dist-server/service/task/task-mutation.js +129 -0
  138. package/dist-server/service/task/task-mutation.js.map +1 -0
  139. package/dist-server/service/task/task-query.js +86 -0
  140. package/dist-server/service/task/task-query.js.map +1 -0
  141. package/dist-server/service/task/task-type.js +69 -0
  142. package/dist-server/service/task/task-type.js.map +1 -0
  143. package/dist-server/service/task/task.js +106 -0
  144. package/dist-server/service/task/task.js.map +1 -0
  145. package/dist-server/tsconfig.tsbuildinfo +1 -0
  146. package/helps/management/alarm.md +160 -0
  147. package/helps/management/alter-video.md +160 -0
  148. package/helps/management/cctv.md +160 -0
  149. package/helps/management/device.md +160 -0
  150. package/helps/management/parking.md +160 -0
  151. package/helps/management/site.md +160 -0
  152. package/helps/management/sun-pnl.md +160 -0
  153. package/helps/project/checklist.md +160 -0
  154. package/helps/project/project.md +160 -0
  155. package/helps/project/resource.md +160 -0
  156. package/helps/project/task.md +160 -0
  157. package/package.json +38 -0
  158. package/server/controllers/index.ts +0 -0
  159. package/server/controllers/project-to-excel.ts +40 -0
  160. package/server/index.ts +3 -0
  161. package/server/middlewares/index.ts +3 -0
  162. package/server/routes.ts +108 -0
  163. package/server/service/check-item/check-item-mutation.ts +142 -0
  164. package/server/service/check-item/check-item-query.ts +56 -0
  165. package/server/service/check-item/check-item-type.ts +49 -0
  166. package/server/service/check-item/check-item.ts +74 -0
  167. package/server/service/check-item/index.ts +6 -0
  168. package/server/service/checklist/checklist-mutation.ts +142 -0
  169. package/server/service/checklist/checklist-query.ts +56 -0
  170. package/server/service/checklist/checklist-type.ts +49 -0
  171. package/server/service/checklist/checklist.ts +105 -0
  172. package/server/service/checklist/index.ts +6 -0
  173. package/server/service/index.ts +35 -0
  174. package/server/service/project/index.ts +8 -0
  175. package/server/service/project/project-mutation.ts +201 -0
  176. package/server/service/project/project-query.ts +103 -0
  177. package/server/service/project/project-type.ts +71 -0
  178. package/server/service/project/project.ts +131 -0
  179. package/server/service/resource/index.ts +6 -0
  180. package/server/service/resource/resource-mutation.ts +139 -0
  181. package/server/service/resource/resource-query.ts +56 -0
  182. package/server/service/resource/resource-type.ts +49 -0
  183. package/server/service/resource/resource.ts +56 -0
  184. package/server/service/task/index.ts +6 -0
  185. package/server/service/task/task-mutation.ts +136 -0
  186. package/server/service/task/task-query.ts +56 -0
  187. package/server/service/task/task-type.ts +49 -0
  188. package/server/service/task/task.ts +97 -0
  189. package/server/tsconfig.json +10 -0
  190. package/things-factory.config.js +20 -0
  191. package/translations/en.json +1 -0
  192. package/translations/ja.json +1 -0
  193. package/translations/ko.json +9 -0
  194. package/translations/ms.json +1 -0
  195. package/translations/zh.json +1 -0
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/controllers/index.ts"],"names":[],"mappings":"","sourcesContent":[""]}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateExcel = void 0;
4
+ const exceljs_1 = require("exceljs");
5
+ function createGanttChart(tasks, worksheet, level = 0) {
6
+ tasks.forEach(task => {
7
+ const row = worksheet.addRow([task.name, task.startDate, task.endDate]);
8
+ row.outlineLevel = level;
9
+ if (task.subtasks && task.subtasks.length > 0) {
10
+ createGanttChart(task.subtasks, worksheet, level + 1);
11
+ }
12
+ });
13
+ }
14
+ async function generateExcel(tasks) {
15
+ const workbook = new exceljs_1.Workbook();
16
+ const worksheet = workbook.addWorksheet('Gantt Chart');
17
+ worksheet.properties.outlineProperties = {
18
+ summaryBelow: false,
19
+ summaryRight: false
20
+ };
21
+ worksheet.columns = [
22
+ { header: 'Task Name', key: 'name', width: 30 },
23
+ { header: 'Start Date', key: 'startDate', width: 20 },
24
+ { header: 'End Date', key: 'endDate', width: 20 }
25
+ ];
26
+ createGanttChart(tasks, worksheet);
27
+ return await workbook.xlsx.writeBuffer();
28
+ }
29
+ exports.generateExcel = generateExcel;
30
+ //# sourceMappingURL=project-to-excel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-to-excel.js","sourceRoot":"","sources":["../../server/controllers/project-to-excel.ts"],"names":[],"mappings":";;;AAAA,qCAA6C;AAS7C,SAAS,gBAAgB,CAAC,KAAa,EAAE,SAAoB,EAAE,QAAgB,CAAC;IAC9E,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACnB,MAAM,GAAG,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAA;QAEvE,GAAG,CAAC,YAAY,GAAG,KAAK,CAAA;QAExB,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;YAC7C,gBAAgB,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,GAAG,CAAC,CAAC,CAAA;SACtD;IACH,CAAC,CAAC,CAAA;AACJ,CAAC;AAEM,KAAK,UAAU,aAAa,CAAC,KAAa;IAC/C,MAAM,QAAQ,GAAG,IAAI,kBAAQ,EAAE,CAAA;IAC/B,MAAM,SAAS,GAAG,QAAQ,CAAC,YAAY,CAAC,aAAa,CAAC,CAAA;IAEtD,SAAS,CAAC,UAAU,CAAC,iBAAiB,GAAG;QACvC,YAAY,EAAE,KAAK;QACnB,YAAY,EAAE,KAAK;KACpB,CAAA;IAED,SAAS,CAAC,OAAO,GAAG;QAClB,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE;QAC/C,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,EAAE,EAAE;QACrD,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE;KAClD,CAAA;IAED,gBAAgB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAA;IAElC,OAAO,MAAM,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,CAAA;AAC1C,CAAC;AAlBD,sCAkBC","sourcesContent":["import { Workbook, Worksheet } from 'exceljs'\n\nexport interface Task {\n name: string\n startDate: Date\n endDate: Date\n subtasks?: Task[]\n}\n\nfunction createGanttChart(tasks: Task[], worksheet: Worksheet, level: number = 0) {\n tasks.forEach(task => {\n const row = worksheet.addRow([task.name, task.startDate, task.endDate])\n\n row.outlineLevel = level\n\n if (task.subtasks && task.subtasks.length > 0) {\n createGanttChart(task.subtasks, worksheet, level + 1)\n }\n })\n}\n\nexport async function generateExcel(tasks: Task[]) {\n const workbook = new Workbook()\n const worksheet = workbook.addWorksheet('Gantt Chart')\n\n worksheet.properties.outlineProperties = {\n summaryBelow: false,\n summaryRight: false\n }\n\n worksheet.columns = [\n { header: 'Task Name', key: 'name', width: 30 },\n { header: 'Start Date', key: 'startDate', width: 20 },\n { header: 'End Date', key: 'endDate', width: 20 }\n ]\n\n createGanttChart(tasks, worksheet)\n\n return await workbook.xlsx.writeBuffer()\n}\n"]}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./service"), exports);
5
+ require("./routes");
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../server/index.ts"],"names":[],"mappings":";;;AAAA,oDAAyB;AAEzB,oBAAiB","sourcesContent":["export * from './service'\n\nimport './routes'\n"]}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.initMiddlewares = void 0;
4
+ function initMiddlewares(app) {
5
+ /* can add middlewares into app */
6
+ }
7
+ exports.initMiddlewares = initMiddlewares;
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/middlewares/index.ts"],"names":[],"mappings":";;;AAAA,SAAgB,eAAe,CAAC,GAAG;IACjC,kCAAkC;AACpC,CAAC;AAFD,0CAEC","sourcesContent":["export function initMiddlewares(app) {\n /* can add middlewares into app */\n}\n"]}
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const content_disposition_1 = tslib_1.__importDefault(require("content-disposition"));
5
+ const project_to_excel_1 = require("./controllers/project-to-excel");
6
+ // const debug = require('debug')('dssp:project:routes')
7
+ process.on('bootstrap-module-global-public-route', (app, globalPublicRouter) => {
8
+ /*
9
+ * can add global public routes to application (auth not required, tenancy not required)
10
+ *
11
+ * ex) routes.get('/path', async(context, next) => {})
12
+ * ex) routes.post('/path', async(context, next) => {})
13
+ */
14
+ globalPublicRouter.get('/export-project', async (context, next) => {
15
+ const tasks = [
16
+ {
17
+ name: '1 Task',
18
+ startDate: new Date('2024-03-01'),
19
+ endDate: new Date('2024-03-05'),
20
+ subtasks: [
21
+ {
22
+ name: '1.1 Subtask',
23
+ startDate: new Date('2024-03-02'),
24
+ endDate: new Date('2024-03-03'),
25
+ subtasks: [
26
+ {
27
+ name: '1.1.1 Subtask',
28
+ startDate: new Date('2024-03-02'),
29
+ endDate: new Date('2024-03-02')
30
+ },
31
+ {
32
+ name: '1.1.2 Subtask',
33
+ startDate: new Date('2024-03-02'),
34
+ endDate: new Date('2024-03-03')
35
+ },
36
+ {
37
+ name: '1.1.2 Subtask',
38
+ startDate: new Date('2024-03-03'),
39
+ endDate: new Date('2024-03-03')
40
+ },
41
+ {
42
+ name: '1.1.2 Subtask',
43
+ startDate: new Date('2024-03-03'),
44
+ endDate: new Date('2024-03-03')
45
+ }
46
+ ]
47
+ },
48
+ {
49
+ name: '1.2 Subtask',
50
+ startDate: new Date('2024-03-04'),
51
+ endDate: new Date('2024-03-05')
52
+ }
53
+ ]
54
+ },
55
+ {
56
+ name: '2 Task',
57
+ startDate: new Date('2024-03-06'),
58
+ endDate: new Date('2024-03-10'),
59
+ subtasks: [
60
+ {
61
+ name: '2.1 Subtask',
62
+ startDate: new Date('2024-03-06'),
63
+ endDate: new Date('2024-03-07')
64
+ },
65
+ {
66
+ name: '2.2 Subtask',
67
+ startDate: new Date('2024-03-08'),
68
+ endDate: new Date('2024-03-10'),
69
+ subtasks: [
70
+ {
71
+ name: '2.2.1 Subtask',
72
+ startDate: new Date('2024-03-08'),
73
+ endDate: new Date('2024-03-09')
74
+ },
75
+ {
76
+ name: '2.2.2 Subtask',
77
+ startDate: new Date('2024-03-10'),
78
+ endDate: new Date('2024-03-10')
79
+ }
80
+ ]
81
+ }
82
+ ]
83
+ }
84
+ ];
85
+ context.type = 'application/xlsx';
86
+ context.set('Content-Disposition', (0, content_disposition_1.default)(`project.xlsx`));
87
+ context.body = await (0, project_to_excel_1.generateExcel)(tasks);
88
+ });
89
+ });
90
+ process.on('bootstrap-module-global-private-route', (app, globalPrivateRouter) => {
91
+ /*
92
+ * can add global private routes to application (auth required, tenancy not required)
93
+ */
94
+ });
95
+ process.on('bootstrap-module-domain-public-route', (app, domainPublicRouter) => {
96
+ /*
97
+ * can add domain public routes to application (auth not required, tenancy required)
98
+ */
99
+ });
100
+ process.on('bootstrap-module-domain-private-route', (app, domainPrivateRouter) => {
101
+ /*
102
+ * can add domain private routes to application (auth required, tenancy required)
103
+ */
104
+ });
105
+ //# sourceMappingURL=routes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes.js","sourceRoot":"","sources":["../server/routes.ts"],"names":[],"mappings":";;;AAAA,sFAAoD;AAEpD,qEAAoE;AAEpE,wDAAwD;AAExD,OAAO,CAAC,EAAE,CAAC,sCAA6C,EAAE,CAAC,GAAG,EAAE,kBAAkB,EAAE,EAAE;IACpF;;;;;OAKG;IACH,kBAAkB,CAAC,GAAG,CAAC,iBAAiB,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QAChE,MAAM,KAAK,GAAW;YACpB;gBACE,IAAI,EAAE,QAAQ;gBACd,SAAS,EAAE,IAAI,IAAI,CAAC,YAAY,CAAC;gBACjC,OAAO,EAAE,IAAI,IAAI,CAAC,YAAY,CAAC;gBAC/B,QAAQ,EAAE;oBACR;wBACE,IAAI,EAAE,aAAa;wBACnB,SAAS,EAAE,IAAI,IAAI,CAAC,YAAY,CAAC;wBACjC,OAAO,EAAE,IAAI,IAAI,CAAC,YAAY,CAAC;wBAC/B,QAAQ,EAAE;4BACR;gCACE,IAAI,EAAE,eAAe;gCACrB,SAAS,EAAE,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CACE,IAAI,EAAE,eAAe;gCACrB,SAAS,EAAE,IAAI,IAAI,CAAC,YAAY,CAAC;gCACjC,OAAO,EAAE,IAAI,IAAI,CAAC,YAAY,CAAC;6BAChC;yBACF;qBACF;iBACF;aACF;SACF,CAAA;QAED,OAAO,CAAC,IAAI,GAAG,kBAAkB,CAAA;QACjC,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,IAAA,6BAAkB,EAAC,cAAc,CAAC,CAAC,CAAA;QACtE,OAAO,CAAC,IAAI,GAAG,MAAM,IAAA,gCAAa,EAAC,KAAK,CAAC,CAAA;IAC3C,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAEF,OAAO,CAAC,EAAE,CAAC,uCAA8C,EAAE,CAAC,GAAG,EAAE,mBAAmB,EAAE,EAAE;IACtF;;OAEG;AACL,CAAC,CAAC,CAAA;AAEF,OAAO,CAAC,EAAE,CAAC,sCAA6C,EAAE,CAAC,GAAG,EAAE,kBAAkB,EAAE,EAAE;IACpF;;OAEG;AACL,CAAC,CAAC,CAAA;AAEF,OAAO,CAAC,EAAE,CAAC,uCAA8C,EAAE,CAAC,GAAG,EAAE,mBAAmB,EAAE,EAAE;IACtF;;OAEG;AACL,CAAC,CAAC,CAAA","sourcesContent":["import contentDisposition from 'content-disposition'\n\nimport { Task, generateExcel } from './controllers/project-to-excel'\n\n// const debug = require('debug')('dssp:project:routes')\n\nprocess.on('bootstrap-module-global-public-route' as any, (app, globalPublicRouter) => {\n /*\n * can add global public routes to application (auth not required, tenancy not required)\n *\n * ex) routes.get('/path', async(context, next) => {})\n * ex) routes.post('/path', async(context, next) => {})\n */\n globalPublicRouter.get('/export-project', async (context, next) => {\n const tasks: Task[] = [\n {\n name: '1 Task',\n startDate: new Date('2024-03-01'),\n endDate: new Date('2024-03-05'),\n subtasks: [\n {\n name: '1.1 Subtask',\n startDate: new Date('2024-03-02'),\n endDate: new Date('2024-03-03'),\n subtasks: [\n {\n name: '1.1.1 Subtask',\n startDate: new Date('2024-03-02'),\n endDate: new Date('2024-03-02')\n },\n {\n name: '1.1.2 Subtask',\n startDate: new Date('2024-03-02'),\n endDate: new Date('2024-03-03')\n },\n {\n name: '1.1.2 Subtask',\n startDate: new Date('2024-03-03'),\n endDate: new Date('2024-03-03')\n },\n {\n name: '1.1.2 Subtask',\n startDate: new Date('2024-03-03'),\n endDate: new Date('2024-03-03')\n }\n ]\n },\n {\n name: '1.2 Subtask',\n startDate: new Date('2024-03-04'),\n endDate: new Date('2024-03-05')\n }\n ]\n },\n {\n name: '2 Task',\n startDate: new Date('2024-03-06'),\n endDate: new Date('2024-03-10'),\n subtasks: [\n {\n name: '2.1 Subtask',\n startDate: new Date('2024-03-06'),\n endDate: new Date('2024-03-07')\n },\n {\n name: '2.2 Subtask',\n startDate: new Date('2024-03-08'),\n endDate: new Date('2024-03-10'),\n subtasks: [\n {\n name: '2.2.1 Subtask',\n startDate: new Date('2024-03-08'),\n endDate: new Date('2024-03-09')\n },\n {\n name: '2.2.2 Subtask',\n startDate: new Date('2024-03-10'),\n endDate: new Date('2024-03-10')\n }\n ]\n }\n ]\n }\n ]\n\n context.type = 'application/xlsx'\n context.set('Content-Disposition', contentDisposition(`project.xlsx`))\n context.body = await generateExcel(tasks)\n })\n})\n\nprocess.on('bootstrap-module-global-private-route' as any, (app, globalPrivateRouter) => {\n /*\n * can add global private routes to application (auth required, tenancy not required)\n */\n})\n\nprocess.on('bootstrap-module-domain-public-route' as any, (app, domainPublicRouter) => {\n /*\n * can add domain public routes to application (auth not required, tenancy required)\n */\n})\n\nprocess.on('bootstrap-module-domain-private-route' as any, (app, domainPrivateRouter) => {\n /*\n * can add domain private routes to application (auth required, tenancy required)\n */\n})\n"]}
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CheckItemMutation = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const type_graphql_1 = require("type-graphql");
6
+ const typeorm_1 = require("typeorm");
7
+ const attachment_base_1 = require("@things-factory/attachment-base");
8
+ const check_item_1 = require("./check-item");
9
+ const check_item_type_1 = require("./check-item-type");
10
+ let CheckItemMutation = class CheckItemMutation {
11
+ async createCheckItem(checkItem, context) {
12
+ const { domain, user, tx } = context.state;
13
+ const result = await tx.getRepository(check_item_1.CheckItem).save(Object.assign(Object.assign({}, checkItem), { domain, creator: user, updater: user }));
14
+ return result;
15
+ }
16
+ async updateCheckItem(id, patch, context) {
17
+ const { domain, user, tx } = context.state;
18
+ const repository = tx.getRepository(check_item_1.CheckItem);
19
+ const checkItem = await repository.findOne({
20
+ where: { id }
21
+ });
22
+ const result = await repository.save(Object.assign(Object.assign(Object.assign({}, checkItem), patch), { updater: user }));
23
+ return result;
24
+ }
25
+ async updateMultipleCheckItem(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 checkItemRepo = tx.getRepository(check_item_1.CheckItem);
31
+ if (_createRecords.length > 0) {
32
+ for (let i = 0; i < _createRecords.length; i++) {
33
+ const newRecord = _createRecords[i];
34
+ const result = await checkItemRepo.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 checkItem = await checkItemRepo.findOneBy({ id: updateRecord.id });
42
+ const result = await checkItemRepo.save(Object.assign(Object.assign(Object.assign({}, checkItem), updateRecord), { updater: user }));
43
+ results.push(Object.assign(Object.assign({}, result), { cuFlag: 'M' }));
44
+ }
45
+ }
46
+ return results;
47
+ }
48
+ async deleteCheckItem(id, context) {
49
+ const { domain, tx } = context.state;
50
+ await tx.getRepository(check_item_1.CheckItem).delete({ id });
51
+ await (0, attachment_base_1.deleteAttachmentsByRef)(null, { refBys: [id] }, context);
52
+ return true;
53
+ }
54
+ async deleteCheckItems(ids, context) {
55
+ const { domain, tx } = context.state;
56
+ await tx.getRepository(check_item_1.CheckItem).delete({
57
+ id: (0, typeorm_1.In)(ids)
58
+ });
59
+ await (0, attachment_base_1.deleteAttachmentsByRef)(null, { refBys: ids }, context);
60
+ return true;
61
+ }
62
+ async importCheckItems(checkItems, context) {
63
+ const { domain, tx } = context.state;
64
+ await Promise.all(checkItems.map(async (checkItem) => {
65
+ const createdCheckItem = await tx.getRepository(check_item_1.CheckItem).save(Object.assign({ domain }, checkItem));
66
+ }));
67
+ return true;
68
+ }
69
+ };
70
+ tslib_1.__decorate([
71
+ (0, type_graphql_1.Directive)('@transaction'),
72
+ (0, type_graphql_1.Mutation)(returns => check_item_1.CheckItem, { description: 'To create new CheckItem' }),
73
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('checkItem')),
74
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
75
+ tslib_1.__metadata("design:type", Function),
76
+ tslib_1.__metadata("design:paramtypes", [check_item_type_1.NewCheckItem, Object]),
77
+ tslib_1.__metadata("design:returntype", Promise)
78
+ ], CheckItemMutation.prototype, "createCheckItem", null);
79
+ tslib_1.__decorate([
80
+ (0, type_graphql_1.Directive)('@transaction'),
81
+ (0, type_graphql_1.Mutation)(returns => check_item_1.CheckItem, { description: 'To modify CheckItem 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, check_item_type_1.CheckItemPatch, Object]),
87
+ tslib_1.__metadata("design:returntype", Promise)
88
+ ], CheckItemMutation.prototype, "updateCheckItem", null);
89
+ tslib_1.__decorate([
90
+ (0, type_graphql_1.Directive)('@transaction'),
91
+ (0, type_graphql_1.Mutation)(returns => [check_item_1.CheckItem], { description: "To modify multiple CheckItems' information" }),
92
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [check_item_type_1.CheckItemPatch])),
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
+ ], CheckItemMutation.prototype, "updateMultipleCheckItem", null);
98
+ tslib_1.__decorate([
99
+ (0, type_graphql_1.Directive)('@transaction'),
100
+ (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete CheckItem' }),
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
+ ], CheckItemMutation.prototype, "deleteCheckItem", null);
107
+ tslib_1.__decorate([
108
+ (0, type_graphql_1.Directive)('@transaction'),
109
+ (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple CheckItems' }),
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
+ ], CheckItemMutation.prototype, "deleteCheckItems", null);
116
+ tslib_1.__decorate([
117
+ (0, type_graphql_1.Directive)('@transaction'),
118
+ (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To import multiple CheckItems' }),
119
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('checkItems', type => [check_item_type_1.CheckItemPatch])),
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
+ ], CheckItemMutation.prototype, "importCheckItems", null);
125
+ CheckItemMutation = tslib_1.__decorate([
126
+ (0, type_graphql_1.Resolver)(check_item_1.CheckItem)
127
+ ], CheckItemMutation);
128
+ exports.CheckItemMutation = CheckItemMutation;
129
+ //# sourceMappingURL=check-item-mutation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-item-mutation.js","sourceRoot":"","sources":["../../../server/service/check-item/check-item-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,qEAA0F;AAE1F,6CAAwC;AACxC,uDAAgE;AAGzD,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAGtB,AAAN,KAAK,CAAC,eAAe,CACD,SAAuB,EAClC,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,aAAa,CAAC,sBAAS,CAAC,CAAC,IAAI,iCAChD,SAAS,KACZ,MAAM,EACN,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,IAAI,IACb,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC;IAIK,AAAN,KAAK,CAAC,eAAe,CACR,EAAU,EACP,KAAqB,EAC5B,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,UAAU,GAAG,EAAE,CAAC,aAAa,CAAC,sBAAS,CAAC,CAAA;QAC9C,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC;YACzC,KAAK,EAAE,EAAE,EAAE,EAAE;SACd,CAAC,CAAA;QAEF,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,IAAI,+CAC/B,SAAS,GACT,KAAK,KACR,OAAO,EAA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,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,qBAAqB,EAAE,CAAC;IAC9C,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;wDAOlD;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;IAE5E,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;yDAWP;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;IAE5E,mBAAA,IAAA,kBAAG,EAAC,YAAY,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,gCAAc,CAAC,CAAC,CAAA;IAC3C,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;yDAWP;AAnIU,iBAAiB;IAD7B,IAAA,uBAAQ,EAAC,sBAAS,CAAC;GACP,iBAAiB,CAoI7B;AApIY,8CAAiB","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { createAttachment, deleteAttachmentsByRef } from '@things-factory/attachment-base'\n\nimport { CheckItem } from './check-item'\nimport { NewCheckItem, CheckItemPatch } from './check-item-type'\n\n@Resolver(CheckItem)\nexport class CheckItemMutation {\n @Directive('@transaction')\n @Mutation(returns => CheckItem, { description: 'To create new CheckItem' })\n async createCheckItem(\n @Arg('checkItem') checkItem: NewCheckItem,\n @Ctx() context: ResolverContext\n ): Promise<CheckItem> {\n const { domain, user, tx } = context.state\n\n const result = await tx.getRepository(CheckItem).save({\n ...checkItem,\n domain,\n creator: user,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => CheckItem, { description: 'To modify CheckItem information' })\n async updateCheckItem(\n @Arg('id') id: string,\n @Arg('patch') patch: CheckItemPatch,\n @Ctx() context: ResolverContext\n ): Promise<CheckItem> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(CheckItem)\n const checkItem = await repository.findOne({\n where: { id }\n })\n\n const result = await repository.save({\n ...checkItem,\n ...patch,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => [CheckItem], { description: \"To modify multiple CheckItems' information\" })\n async updateMultipleCheckItem(\n @Arg('patches', type => [CheckItemPatch]) patches: CheckItemPatch[],\n @Ctx() context: ResolverContext\n ): Promise<CheckItem[]> {\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 checkItemRepo = tx.getRepository(CheckItem)\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 checkItemRepo.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 checkItem = await checkItemRepo.findOneBy({ id: updateRecord.id })\n\n const result = await checkItemRepo.save({\n ...checkItem,\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 CheckItem' })\n async deleteCheckItem(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(CheckItem).delete({ id })\n await deleteAttachmentsByRef(null, { refBys: [id] }, context)\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple CheckItems' })\n async deleteCheckItems(\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(CheckItem).delete({\n id: In(ids)\n })\n\n await deleteAttachmentsByRef(null, { refBys: ids }, context)\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To import multiple CheckItems' })\n async importCheckItems(\n @Arg('checkItems', type => [CheckItemPatch]) checkItems: CheckItemPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n checkItems.map(async (checkItem: CheckItemPatch) => {\n const createdCheckItem: CheckItem = await tx.getRepository(CheckItem).save({ domain, ...checkItem })\n })\n )\n\n return true\n }\n}\n"]}
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CheckItemQuery = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const type_graphql_1 = require("type-graphql");
6
+ const attachment_base_1 = require("@things-factory/attachment-base");
7
+ const shell_1 = require("@things-factory/shell");
8
+ const auth_base_1 = require("@things-factory/auth-base");
9
+ const check_item_1 = require("./check-item");
10
+ const check_item_type_1 = require("./check-item-type");
11
+ let CheckItemQuery = class CheckItemQuery {
12
+ async checkItem(id, context) {
13
+ const { domain } = context.state;
14
+ return await (0, shell_1.getRepository)(check_item_1.CheckItem).findOne({
15
+ where: { id }
16
+ });
17
+ }
18
+ async checkItems(params, context) {
19
+ const { domain } = context.state;
20
+ const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
21
+ domain,
22
+ params,
23
+ repository: await (0, shell_1.getRepository)(check_item_1.CheckItem),
24
+ searchables: ['name', 'description']
25
+ });
26
+ const [items, total] = await queryBuilder.getManyAndCount();
27
+ return { items, total };
28
+ }
29
+ async thumbnail(checkItem) {
30
+ const attachment = await (0, shell_1.getRepository)(attachment_base_1.Attachment).findOne({
31
+ where: {
32
+ refType: check_item_1.CheckItem.name,
33
+ refBy: checkItem.id
34
+ }
35
+ });
36
+ return attachment === null || attachment === void 0 ? void 0 : attachment.fullpath;
37
+ }
38
+ async updater(checkItem) {
39
+ return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: checkItem.updaterId });
40
+ }
41
+ async creator(checkItem) {
42
+ return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: checkItem.creatorId });
43
+ }
44
+ };
45
+ tslib_1.__decorate([
46
+ (0, type_graphql_1.Query)(returns => check_item_1.CheckItem, { nullable: true, description: 'To fetch a CheckItem' }),
47
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
48
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
49
+ tslib_1.__metadata("design:type", Function),
50
+ tslib_1.__metadata("design:paramtypes", [String, Object]),
51
+ tslib_1.__metadata("design:returntype", Promise)
52
+ ], CheckItemQuery.prototype, "checkItem", null);
53
+ tslib_1.__decorate([
54
+ (0, type_graphql_1.Query)(returns => check_item_type_1.CheckItemList, { description: 'To fetch multiple CheckItems' }),
55
+ tslib_1.__param(0, (0, type_graphql_1.Args)()),
56
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
57
+ tslib_1.__metadata("design:type", Function),
58
+ tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
59
+ tslib_1.__metadata("design:returntype", Promise)
60
+ ], CheckItemQuery.prototype, "checkItems", null);
61
+ tslib_1.__decorate([
62
+ (0, type_graphql_1.FieldResolver)(type => String),
63
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
64
+ tslib_1.__metadata("design:type", Function),
65
+ tslib_1.__metadata("design:paramtypes", [check_item_1.CheckItem]),
66
+ tslib_1.__metadata("design:returntype", Promise)
67
+ ], CheckItemQuery.prototype, "thumbnail", null);
68
+ tslib_1.__decorate([
69
+ (0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
70
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
71
+ tslib_1.__metadata("design:type", Function),
72
+ tslib_1.__metadata("design:paramtypes", [check_item_1.CheckItem]),
73
+ tslib_1.__metadata("design:returntype", Promise)
74
+ ], CheckItemQuery.prototype, "updater", null);
75
+ tslib_1.__decorate([
76
+ (0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
77
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
78
+ tslib_1.__metadata("design:type", Function),
79
+ tslib_1.__metadata("design:paramtypes", [check_item_1.CheckItem]),
80
+ tslib_1.__metadata("design:returntype", Promise)
81
+ ], CheckItemQuery.prototype, "creator", null);
82
+ CheckItemQuery = tslib_1.__decorate([
83
+ (0, type_graphql_1.Resolver)(check_item_1.CheckItem)
84
+ ], CheckItemQuery);
85
+ exports.CheckItemQuery = CheckItemQuery;
86
+ //# sourceMappingURL=check-item-query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-item-query.js","sourceRoot":"","sources":["../../../server/service/check-item/check-item-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,qEAA4D;AAC5D,iDAAuG;AACvG,yDAAgD;AAChD,6CAAwC;AACxC,uDAAiD;AAG1C,IAAM,cAAc,GAApB,MAAM,cAAc;IAEnB,AAAN,KAAK,CAAC,SAAS,CAAY,EAAU,EAAS,OAAwB;QACpE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,qBAAa,EAAC,sBAAS,CAAC,CAAC,OAAO,CAAC;YAC5C,KAAK,EAAE,EAAE,EAAE,EAAE;SACd,CAAC,CAAA;IACJ,CAAC;IAGK,AAAN,KAAK,CAAC,UAAU,CAAS,MAAiB,EAAS,OAAwB;QACzE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,MAAM,YAAY,GAAG,IAAA,qCAA6B,EAAC;YACjD,MAAM;YACN,MAAM;Y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CAAC,+BAAa,EAAE,EAAE,WAAW,EAAE,8BAA8B,EAAE,CAAC;IAC/D,mBAAA,IAAA,mBAAI,GAAE,CAAA;IAAqB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAAjB,iBAAS;;gDAazC;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAY,sBAAS;;+CAS3C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAY,sBAAS;;6CAEzC;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAY,sBAAS;;6CAEzC;AA9CU,cAAc;IAD1B,IAAA,uBAAQ,EAAC,sBAAS,CAAC;GACP,cAAc,CA+C1B;AA/CY,wCAAc","sourcesContent":["import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'\nimport { Attachment } from '@things-factory/attachment-base'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { CheckItem } from './check-item'\nimport { CheckItemList } from './check-item-type'\n\n@Resolver(CheckItem)\nexport class CheckItemQuery {\n @Query(returns => CheckItem!, { nullable: true, description: 'To fetch a CheckItem' })\n async checkItem(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<CheckItem> {\n const { domain } = context.state\n\n return await getRepository(CheckItem).findOne({\n where: { id }\n })\n }\n\n @Query(returns => CheckItemList, { description: 'To fetch multiple CheckItems' })\n async checkItems(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<CheckItemList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(CheckItem),\n searchables: ['name', 'description']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => String)\n async thumbnail(@Root() checkItem: CheckItem): Promise<string | undefined> {\n const attachment: Attachment = await getRepository(Attachment).findOne({\n where: {\n refType: CheckItem.name,\n refBy: checkItem.id\n }\n })\n\n return attachment?.fullpath\n }\n\n @FieldResolver(type => User)\n async updater(@Root() checkItem: CheckItem): Promise<User> {\n return await getRepository(User).findOneBy({ id: checkItem.updaterId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() checkItem: CheckItem): Promise<User> {\n return await getRepository(User).findOneBy({ id: checkItem.creatorId })\n }\n}\n"]}
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CheckItemList = exports.CheckItemPatch = exports.NewCheckItem = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const type_graphql_1 = require("type-graphql");
6
+ const check_item_1 = require("./check-item");
7
+ let NewCheckItem = class NewCheckItem {
8
+ };
9
+ tslib_1.__decorate([
10
+ (0, type_graphql_1.Field)(),
11
+ tslib_1.__metadata("design:type", String)
12
+ ], NewCheckItem.prototype, "name", void 0);
13
+ tslib_1.__decorate([
14
+ (0, type_graphql_1.Field)({ nullable: true }),
15
+ tslib_1.__metadata("design:type", String)
16
+ ], NewCheckItem.prototype, "description", void 0);
17
+ tslib_1.__decorate([
18
+ (0, type_graphql_1.Field)({ nullable: true }),
19
+ tslib_1.__metadata("design:type", Boolean)
20
+ ], NewCheckItem.prototype, "active", void 0);
21
+ tslib_1.__decorate([
22
+ (0, type_graphql_1.Field)({ nullable: true }),
23
+ tslib_1.__metadata("design:type", String)
24
+ ], NewCheckItem.prototype, "params", void 0);
25
+ NewCheckItem = tslib_1.__decorate([
26
+ (0, type_graphql_1.InputType)()
27
+ ], NewCheckItem);
28
+ exports.NewCheckItem = NewCheckItem;
29
+ let CheckItemPatch = class CheckItemPatch {
30
+ };
31
+ tslib_1.__decorate([
32
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
33
+ tslib_1.__metadata("design:type", String)
34
+ ], CheckItemPatch.prototype, "id", void 0);
35
+ tslib_1.__decorate([
36
+ (0, type_graphql_1.Field)({ nullable: true }),
37
+ tslib_1.__metadata("design:type", String)
38
+ ], CheckItemPatch.prototype, "name", void 0);
39
+ tslib_1.__decorate([
40
+ (0, type_graphql_1.Field)({ nullable: true }),
41
+ tslib_1.__metadata("design:type", String)
42
+ ], CheckItemPatch.prototype, "description", void 0);
43
+ tslib_1.__decorate([
44
+ (0, type_graphql_1.Field)({ nullable: true }),
45
+ tslib_1.__metadata("design:type", Boolean)
46
+ ], CheckItemPatch.prototype, "active", void 0);
47
+ tslib_1.__decorate([
48
+ (0, type_graphql_1.Field)({ nullable: true }),
49
+ tslib_1.__metadata("design:type", String)
50
+ ], CheckItemPatch.prototype, "cuFlag", void 0);
51
+ CheckItemPatch = tslib_1.__decorate([
52
+ (0, type_graphql_1.InputType)()
53
+ ], CheckItemPatch);
54
+ exports.CheckItemPatch = CheckItemPatch;
55
+ let CheckItemList = class CheckItemList {
56
+ };
57
+ tslib_1.__decorate([
58
+ (0, type_graphql_1.Field)(type => [check_item_1.CheckItem]),
59
+ tslib_1.__metadata("design:type", Array)
60
+ ], CheckItemList.prototype, "items", void 0);
61
+ tslib_1.__decorate([
62
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int),
63
+ tslib_1.__metadata("design:type", Number)
64
+ ], CheckItemList.prototype, "total", void 0);
65
+ CheckItemList = tslib_1.__decorate([
66
+ (0, type_graphql_1.ObjectType)()
67
+ ], CheckItemList);
68
+ exports.CheckItemList = CheckItemList;
69
+ //# sourceMappingURL=check-item-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-item-type.js","sourceRoot":"","sources":["../../../server/service/check-item/check-item-type.ts"],"names":[],"mappings":";;;;AAEA,+CAAsF;AAItF,6CAAwC;AAGjC,IAAM,YAAY,GAAlB,MAAM,YA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phQLUpload 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 { CheckItem } from './check-item'\n\n@InputType()\nexport class NewCheckItem {\n @Field()\n name: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field({ nullable: true })\n active?: boolean\n\n @Field({ nullable: true })\n params?: string\n}\n\n@InputType()\nexport class CheckItemPatch {\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({ nullable: true })\n active?: boolean\n\n @Field({ nullable: true })\n cuFlag?: string\n}\n\n@ObjectType()\nexport class CheckItemList {\n @Field(type => [CheckItem])\n items: CheckItem[]\n\n @Field(type => Int)\n total: number\n}\n"]}
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CheckItem = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const typeorm_1 = require("typeorm");
6
+ const type_graphql_1 = require("type-graphql");
7
+ const auth_base_1 = require("@things-factory/auth-base");
8
+ const checklist_1 = require("../checklist/checklist");
9
+ let CheckItem = class CheckItem {
10
+ };
11
+ tslib_1.__decorate([
12
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
13
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID),
14
+ tslib_1.__metadata("design:type", String)
15
+ ], CheckItem.prototype, "id", void 0);
16
+ tslib_1.__decorate([
17
+ (0, typeorm_1.Column)({ nullable: true, comment: '검사 항목' }),
18
+ (0, type_graphql_1.Field)({ nullable: true }),
19
+ tslib_1.__metadata("design:type", String)
20
+ ], CheckItem.prototype, "name", void 0);
21
+ tslib_1.__decorate([
22
+ (0, typeorm_1.Column)({ nullable: true, comment: '검사 결과 (true: 적합, false: 부적합)' }),
23
+ (0, type_graphql_1.Field)({ nullable: true }),
24
+ tslib_1.__metadata("design:type", Boolean)
25
+ ], CheckItem.prototype, "result", void 0);
26
+ tslib_1.__decorate([
27
+ (0, typeorm_1.Column)({ nullable: true, comment: '기준, 참고 사항 이미지' }),
28
+ (0, type_graphql_1.Field)({ nullable: true }),
29
+ tslib_1.__metadata("design:type", String)
30
+ ], CheckItem.prototype, "reference", void 0);
31
+ tslib_1.__decorate([
32
+ (0, typeorm_1.Column)({ nullable: true, comment: '조치 사항' }),
33
+ (0, type_graphql_1.Field)({ nullable: true }),
34
+ tslib_1.__metadata("design:type", String)
35
+ ], CheckItem.prototype, "measuresToBeTaken", void 0);
36
+ tslib_1.__decorate([
37
+ (0, typeorm_1.ManyToOne)(type => checklist_1.Checklist),
38
+ (0, type_graphql_1.Field)({ nullable: true }),
39
+ tslib_1.__metadata("design:type", checklist_1.Checklist)
40
+ ], CheckItem.prototype, "checklist", void 0);
41
+ tslib_1.__decorate([
42
+ (0, typeorm_1.RelationId)((checkItem) => checkItem.checklist),
43
+ tslib_1.__metadata("design:type", String)
44
+ ], CheckItem.prototype, "checklistId", void 0);
45
+ tslib_1.__decorate([
46
+ (0, typeorm_1.CreateDateColumn)(),
47
+ (0, type_graphql_1.Field)({ nullable: true }),
48
+ tslib_1.__metadata("design:type", Date)
49
+ ], CheckItem.prototype, "createdAt", void 0);
50
+ tslib_1.__decorate([
51
+ (0, typeorm_1.UpdateDateColumn)(),
52
+ (0, type_graphql_1.Field)({ nullable: true }),
53
+ tslib_1.__metadata("design:type", Date)
54
+ ], CheckItem.prototype, "updatedAt", void 0);
55
+ tslib_1.__decorate([
56
+ (0, typeorm_1.DeleteDateColumn)(),
57
+ (0, type_graphql_1.Field)({ nullable: true }),
58
+ tslib_1.__metadata("design:type", Date)
59
+ ], CheckItem.prototype, "deletedAt", void 0);
60
+ tslib_1.__decorate([
61
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
62
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
63
+ tslib_1.__metadata("design:type", auth_base_1.User)
64
+ ], CheckItem.prototype, "creator", void 0);
65
+ tslib_1.__decorate([
66
+ (0, typeorm_1.RelationId)((checkItem) => checkItem.creator),
67
+ tslib_1.__metadata("design:type", String)
68
+ ], CheckItem.prototype, "creatorId", void 0);
69
+ tslib_1.__decorate([
70
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
71
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
72
+ tslib_1.__metadata("design:type", auth_base_1.User)
73
+ ], CheckItem.prototype, "updater", void 0);
74
+ tslib_1.__decorate([
75
+ (0, typeorm_1.RelationId)((checkItem) => checkItem.updater),
76
+ tslib_1.__metadata("design:type", String)
77
+ ], CheckItem.prototype, "updaterId", void 0);
78
+ CheckItem = tslib_1.__decorate([
79
+ (0, typeorm_1.Entity)(),
80
+ (0, typeorm_1.Index)('ix_check_item_0', (checkItem) => [checkItem.checklist], { where: '"deleted_at" IS NULL' }),
81
+ (0, type_graphql_1.ObjectType)({ description: '체크 리스트 항목' })
82
+ ], CheckItem);
83
+ exports.CheckItem = CheckItem;
84
+ //# sourceMappingURL=check-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-item.js","sourceRoot":"","sources":["../../../server/service/check-item/check-item.ts"],"names":[],"mappings":";;;;AAAA,qCAUgB;AAChB,+CAAoD;AAEpD,yDAAgD;AAChD,sDAAkD;AAK3C,IAAM,SAAS,GAAf,MAAM,SAAS;CAsDrB,CAAA;AArDC;IAAC,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;qCACC;AAEnB;IAAC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;IAC5C,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uCACb;AAEb;IAAC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EA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AAI,EAAE,CAAC;sCAC9B,gBAAI;0CAAA;AAEd;IAAC,IAAA,oBAAU,EAAC,CAAC,SAAoB,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC;;4CACtC;AAElB;IAAC,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;0CAAA;AAEd;IAAC,IAAA,oBAAU,EAAC,CAAC,SAAoB,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC;;4CACtC;AArDP,SAAS;IAHrB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,iBAAiB,EAAE,CAAC,SAAoB,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,sBAAsB,EAAE,CAAC;IAC5G,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;GAC5B,SAAS,CAsDrB;AAtDY,8BAAS","sourcesContent":["import {\n CreateDateColumn,\n UpdateDateColumn,\n DeleteDateColumn,\n Entity,\n Index,\n Column,\n RelationId,\n ManyToOne,\n PrimaryGeneratedColumn\n} from 'typeorm'\nimport { ObjectType, Field, ID } from 'type-graphql'\n\nimport { User } from '@things-factory/auth-base'\nimport { Checklist } from '../checklist/checklist'\n\n@Entity()\n@Index('ix_check_item_0', (checkItem: CheckItem) => [checkItem.checklist], { where: '\"deleted_at\" IS NULL' })\n@ObjectType({ description: '체크 리스트 항목' })\nexport class CheckItem {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @Column({ nullable: true, comment: '검사 항목' })\n @Field({ nullable: true })\n name?: string\n\n @Column({ nullable: true, comment: '검사 결과 (true: 적합, false: 부적합)' })\n @Field({ nullable: true })\n result?: boolean\n\n @Column({ nullable: true, comment: '기준, 참고 사항 이미지' })\n @Field({ nullable: true })\n reference?: string\n\n @Column({ nullable: true, comment: '조치 사항' })\n @Field({ nullable: true })\n measuresToBeTaken?: string\n\n // 체크리스트 정보 (상위 테이블 참조)\n @ManyToOne(type => Checklist)\n @Field({ nullable: true })\n checklist?: Checklist\n\n @RelationId((checkItem: CheckItem) => checkItem.checklist)\n checklistId?: string\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt?: Date\n\n @DeleteDateColumn()\n @Field({ nullable: true })\n deletedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n creator?: User\n\n @RelationId((checkItem: CheckItem) => checkItem.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((checkItem: CheckItem) => checkItem.updater)\n updaterId?: string\n}\n"]}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolvers = exports.entities = void 0;
4
+ const check_item_1 = require("./check-item");
5
+ const check_item_query_1 = require("./check-item-query");
6
+ const check_item_mutation_1 = require("./check-item-mutation");
7
+ exports.entities = [check_item_1.CheckItem];
8
+ exports.resolvers = [check_item_query_1.CheckItemQuery, check_item_mutation_1.CheckItemMutation];
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/check-item/index.ts"],"names":[],"mappings":";;;AAAA,6CAAwC;AACxC,yDAAmD;AACnD,+DAAyD;AAE5C,QAAA,QAAQ,GAAG,CAAC,sBAAS,CAAC,CAAA;AACtB,QAAA,SAAS,GAAG,CAAC,iCAAc,EAAE,uCAAiB,CAAC,CAAA","sourcesContent":["import { CheckItem } from './check-item'\nimport { CheckItemQuery } from './check-item-query'\nimport { CheckItemMutation } from './check-item-mutation'\n\nexport const entities = [CheckItem]\nexport const resolvers = [CheckItemQuery, CheckItemMutation]\n"]}