@dssp/project 0.0.8 → 0.0.10

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 (286) hide show
  1. package/client/pages/project/project-detail.ts +109 -30
  2. package/client/pages/project/project-list.ts +46 -10
  3. package/client/pages/project/project-schedule-list.ts +11 -3
  4. package/client/pages/project/project-schedule.ts +111 -312
  5. package/client/pages/project/project-setting-list.ts +11 -3
  6. package/client/pages/resource/construction-detail-type-popup.ts +201 -0
  7. package/client/pages/resource/construction-type-management.ts +40 -39
  8. package/client/pages/resource/inspection-drawing-type-management.ts +210 -0
  9. package/client/pages/resource/inspection-part-popup.ts +201 -0
  10. package/client/pages/resource/manager-management.ts +0 -27
  11. package/client/pages/{checklist/checklist-importer.ts → resource/resource-importer.ts} +11 -8
  12. package/client/pages/{checklist/checklist-list-page.ts → resource/resource-list-page.ts} +41 -25
  13. package/client/pages/resource/worker-type-management.ts +3 -37
  14. package/client/pages/task-resource/task-resource-importer.ts +97 -0
  15. package/client/pages/task-resource/task-resource-list-page.ts +356 -0
  16. package/client/route.ts +13 -1
  17. package/dist-client/pages/project/project-detail.d.ts +5 -1
  18. package/dist-client/pages/project/project-detail.js +123 -40
  19. package/dist-client/pages/project/project-detail.js.map +1 -1
  20. package/dist-client/pages/project/project-list.d.ts +33 -7
  21. package/dist-client/pages/project/project-list.js +26 -11
  22. package/dist-client/pages/project/project-list.js.map +1 -1
  23. package/dist-client/pages/project/project-schedule-list.js +11 -3
  24. package/dist-client/pages/project/project-schedule-list.js.map +1 -1
  25. package/dist-client/pages/project/project-schedule.d.ts +5 -1
  26. package/dist-client/pages/project/project-schedule.js +117 -306
  27. package/dist-client/pages/project/project-schedule.js.map +1 -1
  28. package/dist-client/pages/project/project-setting-list.js +11 -3
  29. package/dist-client/pages/project/project-setting-list.js.map +1 -1
  30. package/dist-client/pages/resource/construction-detail-type-popup.d.ts +2 -0
  31. package/dist-client/pages/resource/construction-detail-type-popup.js +197 -0
  32. package/dist-client/pages/resource/construction-detail-type-popup.js.map +1 -0
  33. package/dist-client/pages/resource/construction-type-management.d.ts +12 -0
  34. package/dist-client/pages/resource/construction-type-management.js +30 -38
  35. package/dist-client/pages/resource/construction-type-management.js.map +1 -1
  36. package/dist-client/pages/resource/inspection-drawing-type-management.d.ts +34 -0
  37. package/dist-client/pages/resource/inspection-drawing-type-management.js +198 -0
  38. package/dist-client/pages/resource/inspection-drawing-type-management.js.map +1 -0
  39. package/dist-client/pages/resource/inspection-part-popup.d.ts +2 -0
  40. package/dist-client/pages/resource/inspection-part-popup.js +197 -0
  41. package/dist-client/pages/resource/inspection-part-popup.js.map +1 -0
  42. package/dist-client/pages/resource/manager-management.js +0 -27
  43. package/dist-client/pages/resource/manager-management.js.map +1 -1
  44. package/dist-client/pages/{checklist/checklist-importer.d.ts → resource/resource-importer.d.ts} +2 -2
  45. package/dist-client/pages/{checklist/checklist-importer.js → resource/resource-importer.js} +10 -10
  46. package/dist-client/pages/resource/resource-importer.js.map +1 -0
  47. package/dist-client/pages/{checklist/checklist-list-page.d.ts → resource/resource-list-page.d.ts} +6 -6
  48. package/dist-client/pages/{checklist/checklist-list-page.js → resource/resource-list-page.js} +41 -32
  49. package/dist-client/pages/resource/resource-list-page.js.map +1 -0
  50. package/dist-client/pages/resource/worker-type-management.d.ts +7 -1
  51. package/dist-client/pages/resource/worker-type-management.js +3 -45
  52. package/dist-client/pages/resource/worker-type-management.js.map +1 -1
  53. package/dist-client/pages/task-resource/task-resource-importer.d.ts +10 -0
  54. package/dist-client/pages/task-resource/task-resource-importer.js +101 -0
  55. package/dist-client/pages/task-resource/task-resource-importer.js.map +1 -0
  56. package/dist-client/pages/task-resource/task-resource-list-page.d.ts +63 -0
  57. package/dist-client/pages/task-resource/task-resource-list-page.js +332 -0
  58. package/dist-client/pages/task-resource/task-resource-list-page.js.map +1 -0
  59. package/dist-client/route.d.ts +1 -1
  60. package/dist-client/route.js +9 -0
  61. package/dist-client/route.js.map +1 -1
  62. package/dist-client/tsconfig.tsbuildinfo +1 -1
  63. package/dist-server/controllers/import-task.d.ts +19 -0
  64. package/dist-server/controllers/import-task.js +104 -0
  65. package/dist-server/controllers/import-task.js.map +1 -0
  66. package/dist-server/index.d.ts +1 -0
  67. package/dist-server/index.js +1 -0
  68. package/dist-server/index.js.map +1 -1
  69. package/dist-server/migrations/1723861466413-seed-roles.d.ts +5 -0
  70. package/dist-server/migrations/1723861466413-seed-roles.js +117 -0
  71. package/dist-server/migrations/1723861466413-seed-roles.js.map +1 -0
  72. package/dist-server/migrations/1723861466414-seed-codes.d.ts +5 -0
  73. package/dist-server/migrations/1723861466414-seed-codes.js +132 -0
  74. package/dist-server/migrations/1723861466414-seed-codes.js.map +1 -0
  75. package/dist-server/migrations/1723861476419-seed-resources.d.ts +5 -0
  76. package/dist-server/migrations/1723861476419-seed-resources.js +57 -0
  77. package/dist-server/migrations/1723861476419-seed-resources.js.map +1 -0
  78. package/dist-server/migrations/1723861478420-seed-/bsample-project.d.ts +5 -0
  79. package/dist-server/migrations/1723861478420-seed-/bsample-project.js +68 -0
  80. package/dist-server/migrations/1723861478420-seed-/bsample-project.js.map +1 -0
  81. package/dist-server/migrations/1723861478421-seed-/bsample-tasks.d.ts +5 -0
  82. package/dist-server/migrations/1723861478421-seed-/bsample-tasks.js +189 -0
  83. package/dist-server/migrations/1723861478421-seed-/bsample-tasks.js.map +1 -0
  84. package/dist-server/migrations/index.d.ts +1 -0
  85. package/dist-server/migrations/index.js +12 -0
  86. package/dist-server/migrations/index.js.map +1 -0
  87. package/dist-server/service/construction-detail-type/construction-detail-type-mutation.d.ts +6 -0
  88. package/dist-server/service/construction-detail-type/construction-detail-type-mutation.js +56 -0
  89. package/dist-server/service/construction-detail-type/construction-detail-type-mutation.js.map +1 -0
  90. package/dist-server/service/construction-detail-type/construction-detail-type-query.d.ts +9 -0
  91. package/dist-server/service/construction-detail-type/construction-detail-type-query.js +53 -0
  92. package/dist-server/service/construction-detail-type/construction-detail-type-query.js.map +1 -0
  93. package/dist-server/service/construction-detail-type/construction-detail-type-type.d.ts +11 -0
  94. package/dist-server/service/construction-detail-type/construction-detail-type-type.js +43 -0
  95. package/dist-server/service/construction-detail-type/construction-detail-type-type.js.map +1 -0
  96. package/dist-server/service/construction-detail-type/construction-detail-type.d.ts +15 -0
  97. package/dist-server/service/construction-detail-type/construction-detail-type.js +69 -0
  98. package/dist-server/service/construction-detail-type/construction-detail-type.js.map +1 -0
  99. package/dist-server/service/construction-detail-type/index.d.ts +5 -0
  100. package/dist-server/service/construction-detail-type/index.js +9 -0
  101. package/dist-server/service/construction-detail-type/index.js.map +1 -0
  102. package/dist-server/service/construction-type/construction-type-query.d.ts +2 -0
  103. package/dist-server/service/construction-type/construction-type-query.js +14 -0
  104. package/dist-server/service/construction-type/construction-type-query.js.map +1 -1
  105. package/dist-server/service/construction-type/construction-type.d.ts +2 -0
  106. package/dist-server/service/construction-type/construction-type.js +6 -0
  107. package/dist-server/service/construction-type/construction-type.js.map +1 -1
  108. package/dist-server/service/index.d.ts +7 -5
  109. package/dist-server/service/index.js +21 -10
  110. package/dist-server/service/index.js.map +1 -1
  111. package/dist-server/service/inspection-drawing-type/index.d.ts +5 -0
  112. package/dist-server/service/inspection-drawing-type/index.js +9 -0
  113. package/dist-server/service/inspection-drawing-type/index.js.map +1 -0
  114. package/dist-server/service/inspection-drawing-type/inspection-drawing-type-mutation.d.ts +6 -0
  115. package/dist-server/service/inspection-drawing-type/inspection-drawing-type-mutation.js +64 -0
  116. package/dist-server/service/inspection-drawing-type/inspection-drawing-type-mutation.js.map +1 -0
  117. package/dist-server/service/inspection-drawing-type/inspection-drawing-type-query.d.ts +12 -0
  118. package/dist-server/service/inspection-drawing-type/inspection-drawing-type-query.js +83 -0
  119. package/dist-server/service/inspection-drawing-type/inspection-drawing-type-query.js.map +1 -0
  120. package/dist-server/service/inspection-drawing-type/inspection-drawing-type-type.d.ts +10 -0
  121. package/dist-server/service/inspection-drawing-type/inspection-drawing-type-type.js +39 -0
  122. package/dist-server/service/inspection-drawing-type/inspection-drawing-type-type.js.map +1 -0
  123. package/dist-server/service/inspection-drawing-type/inspection-drawing-type.d.ts +16 -0
  124. package/dist-server/service/inspection-drawing-type/inspection-drawing-type.js +72 -0
  125. package/dist-server/service/inspection-drawing-type/inspection-drawing-type.js.map +1 -0
  126. package/dist-server/service/inspection-part/index.d.ts +5 -0
  127. package/dist-server/service/inspection-part/index.js +9 -0
  128. package/dist-server/service/inspection-part/index.js.map +1 -0
  129. package/dist-server/service/inspection-part/inspection-part-mutation.d.ts +6 -0
  130. package/dist-server/service/inspection-part/inspection-part-mutation.js +55 -0
  131. package/dist-server/service/inspection-part/inspection-part-mutation.js.map +1 -0
  132. package/dist-server/service/inspection-part/inspection-part-query.d.ts +10 -0
  133. package/dist-server/service/inspection-part/inspection-part-query.js +66 -0
  134. package/dist-server/service/inspection-part/inspection-part-query.js.map +1 -0
  135. package/dist-server/service/inspection-part/inspection-part-type.d.ts +11 -0
  136. package/dist-server/service/inspection-part/inspection-part-type.js +43 -0
  137. package/dist-server/service/inspection-part/inspection-part-type.js.map +1 -0
  138. package/dist-server/service/inspection-part/inspection-part.d.ts +15 -0
  139. package/dist-server/service/inspection-part/inspection-part.js +69 -0
  140. package/dist-server/service/inspection-part/inspection-part.js.map +1 -0
  141. package/dist-server/service/project/index.d.ts +0 -2
  142. package/dist-server/service/project/index.js +1 -3
  143. package/dist-server/service/project/index.js.map +1 -1
  144. package/dist-server/service/project/project-query.d.ts +7 -5
  145. package/dist-server/service/project/project-query.js +34 -38
  146. package/dist-server/service/project/project-query.js.map +1 -1
  147. package/dist-server/service/project/project-type.d.ts +3 -6
  148. package/dist-server/service/project/project-type.js +25 -35
  149. package/dist-server/service/project/project-type.js.map +1 -1
  150. package/dist-server/service/project/project.d.ts +3 -2
  151. package/dist-server/service/project/project.js +10 -10
  152. package/dist-server/service/project/project.js.map +1 -1
  153. package/dist-server/service/resource/index.d.ts +6 -0
  154. package/dist-server/service/resource/index.js +10 -0
  155. package/dist-server/service/resource/index.js.map +1 -0
  156. package/dist-server/service/resource/resource-mutation.d.ts +10 -0
  157. package/dist-server/service/resource/resource-mutation.js +132 -0
  158. package/dist-server/service/resource/resource-mutation.js.map +1 -0
  159. package/dist-server/service/resource/resource-query.d.ts +11 -0
  160. package/dist-server/service/{checklist/checklist-query.js → resource/resource-query.js} +33 -38
  161. package/dist-server/service/resource/resource-query.js.map +1 -0
  162. package/dist-server/service/resource/resource-type.d.ts +17 -0
  163. package/dist-server/service/resource/resource-type.js +65 -0
  164. package/dist-server/service/resource/resource-type.js.map +1 -0
  165. package/dist-server/service/resource/resource.d.ts +24 -0
  166. package/dist-server/service/resource/resource.js +93 -0
  167. package/dist-server/service/resource/resource.js.map +1 -0
  168. package/dist-server/service/task/task-mutation.js +6 -0
  169. package/dist-server/service/task/task-mutation.js.map +1 -1
  170. package/dist-server/service/task/task-query.d.ts +9 -1
  171. package/dist-server/service/task/task-query.js +142 -20
  172. package/dist-server/service/task/task-query.js.map +1 -1
  173. package/dist-server/service/task/task-type.d.ts +13 -0
  174. package/dist-server/service/task/task-type.js +57 -12
  175. package/dist-server/service/task/task-type.js.map +1 -1
  176. package/dist-server/service/task/task.d.ts +12 -5
  177. package/dist-server/service/task/task.js +51 -16
  178. package/dist-server/service/task/task.js.map +1 -1
  179. package/dist-server/service/task-resource/index.d.ts +6 -0
  180. package/dist-server/service/task-resource/index.js +10 -0
  181. package/dist-server/service/task-resource/index.js.map +1 -0
  182. package/dist-server/service/task-resource/task-resource-mutation.d.ts +10 -0
  183. package/dist-server/service/task-resource/task-resource-mutation.js +132 -0
  184. package/dist-server/service/task-resource/task-resource-mutation.js.map +1 -0
  185. package/dist-server/service/task-resource/task-resource-query.d.ts +7 -0
  186. package/dist-server/service/task-resource/task-resource-query.js +50 -0
  187. package/dist-server/service/task-resource/task-resource-query.js.map +1 -0
  188. package/dist-server/service/task-resource/task-resource-type.d.ts +17 -0
  189. package/dist-server/service/task-resource/task-resource-type.js +65 -0
  190. package/dist-server/service/task-resource/task-resource-type.js.map +1 -0
  191. package/dist-server/service/task-resource/task-resource.d.ts +13 -0
  192. package/dist-server/service/task-resource/task-resource.js +59 -0
  193. package/dist-server/service/task-resource/task-resource.js.map +1 -0
  194. package/dist-server/tsconfig.tsbuildinfo +1 -1
  195. package/helps/project/checklist-type-detail.md +160 -0
  196. package/helps/project/checklist-type.md +160 -0
  197. package/helps/project/task-resource.md +160 -0
  198. package/package.json +11 -7
  199. package/server/controllers/import-task.ts +140 -0
  200. package/server/index.ts +1 -0
  201. package/server/migrations/1723861466413-seed-roles.ts +128 -0
  202. package/server/migrations/1723861466414-seed-codes.ts +139 -0
  203. package/server/migrations/1723861476419-seed-resources.ts +62 -0
  204. package/server/migrations/1723861478420-seed-/bsample-project.ts +87 -0
  205. package/server/migrations/1723861478421-seed-/bsample-tasks.ts +194 -0
  206. package/server/migrations/index.ts +9 -0
  207. package/server/service/construction-detail-type/construction-detail-type-mutation.ts +57 -0
  208. package/server/service/construction-detail-type/construction-detail-type-query.ts +31 -0
  209. package/server/service/construction-detail-type/construction-detail-type-type.ts +26 -0
  210. package/server/service/construction-detail-type/construction-detail-type.ts +52 -0
  211. package/server/service/construction-detail-type/index.ts +6 -0
  212. package/server/service/construction-type/construction-type-query.ts +9 -0
  213. package/server/service/construction-type/construction-type.ts +8 -2
  214. package/server/service/index.ts +24 -11
  215. package/server/service/inspection-drawing-type/index.ts +6 -0
  216. package/server/service/inspection-drawing-type/inspection-drawing-type-mutation.ts +69 -0
  217. package/server/service/inspection-drawing-type/inspection-drawing-type-query.ts +55 -0
  218. package/server/service/inspection-drawing-type/inspection-drawing-type-type.ts +23 -0
  219. package/server/service/inspection-drawing-type/inspection-drawing-type.ts +68 -0
  220. package/server/service/inspection-part/index.ts +6 -0
  221. package/server/service/inspection-part/inspection-part-mutation.ts +52 -0
  222. package/server/service/inspection-part/inspection-part-query.ts +41 -0
  223. package/server/service/inspection-part/inspection-part-type.ts +26 -0
  224. package/server/service/inspection-part/inspection-part.ts +51 -0
  225. package/server/service/project/index.ts +0 -2
  226. package/server/service/project/project-query.ts +30 -38
  227. package/server/service/project/project-type.ts +22 -27
  228. package/server/service/project/project.ts +11 -12
  229. package/server/service/resource/index.ts +7 -0
  230. package/server/service/resource/resource-mutation.ts +137 -0
  231. package/server/service/resource/resource-query.ts +50 -0
  232. package/server/service/resource/resource-type.ts +41 -0
  233. package/server/service/resource/resource.ts +82 -0
  234. package/server/service/task/task-mutation.ts +8 -9
  235. package/server/service/task/task-query.ts +135 -22
  236. package/server/service/task/task-type.ts +41 -15
  237. package/server/service/task/task.ts +44 -15
  238. package/server/service/task-resource/index.ts +7 -0
  239. package/server/service/task-resource/task-resource-mutation.ts +140 -0
  240. package/server/service/task-resource/task-resource-query.ts +36 -0
  241. package/server/service/task-resource/task-resource-type.ts +41 -0
  242. package/server/service/task-resource/task-resource.ts +51 -0
  243. package/things-factory.config.js +1 -0
  244. package/translations/en.json +15 -1
  245. package/translations/ko.json +9 -5
  246. package/dist-client/pages/checklist/checklist-importer.js.map +0 -1
  247. package/dist-client/pages/checklist/checklist-list-page.js.map +0 -1
  248. package/dist-server/service/check-item/check-item-mutation.d.ts +0 -10
  249. package/dist-server/service/check-item/check-item-mutation.js +0 -129
  250. package/dist-server/service/check-item/check-item-mutation.js.map +0 -1
  251. package/dist-server/service/check-item/check-item-query.d.ts +0 -11
  252. package/dist-server/service/check-item/check-item-query.js +0 -86
  253. package/dist-server/service/check-item/check-item-query.js.map +0 -1
  254. package/dist-server/service/check-item/check-item-type.d.ts +0 -18
  255. package/dist-server/service/check-item/check-item-type.js +0 -69
  256. package/dist-server/service/check-item/check-item-type.js.map +0 -1
  257. package/dist-server/service/check-item/check-item.d.ts +0 -18
  258. package/dist-server/service/check-item/check-item.js +0 -84
  259. package/dist-server/service/check-item/check-item.js.map +0 -1
  260. package/dist-server/service/check-item/index.d.ts +0 -5
  261. package/dist-server/service/check-item/index.js +0 -9
  262. package/dist-server/service/check-item/index.js.map +0 -1
  263. package/dist-server/service/checklist/checklist-mutation.d.ts +0 -10
  264. package/dist-server/service/checklist/checklist-mutation.js +0 -129
  265. package/dist-server/service/checklist/checklist-mutation.js.map +0 -1
  266. package/dist-server/service/checklist/checklist-query.d.ts +0 -11
  267. package/dist-server/service/checklist/checklist-query.js.map +0 -1
  268. package/dist-server/service/checklist/checklist-type.d.ts +0 -18
  269. package/dist-server/service/checklist/checklist-type.js +0 -69
  270. package/dist-server/service/checklist/checklist-type.js.map +0 -1
  271. package/dist-server/service/checklist/checklist.d.ts +0 -26
  272. package/dist-server/service/checklist/checklist.js +0 -120
  273. package/dist-server/service/checklist/checklist.js.map +0 -1
  274. package/dist-server/service/checklist/index.d.ts +0 -5
  275. package/dist-server/service/checklist/index.js +0 -9
  276. package/dist-server/service/checklist/index.js.map +0 -1
  277. package/server/service/check-item/check-item-mutation.ts +0 -142
  278. package/server/service/check-item/check-item-query.ts +0 -56
  279. package/server/service/check-item/check-item-type.ts +0 -49
  280. package/server/service/check-item/check-item.ts +0 -74
  281. package/server/service/check-item/index.ts +0 -6
  282. package/server/service/checklist/checklist-mutation.ts +0 -142
  283. package/server/service/checklist/checklist-query.ts +0 -56
  284. package/server/service/checklist/checklist-type.ts +0 -49
  285. package/server/service/checklist/checklist.ts +0 -105
  286. package/server/service/checklist/index.ts +0 -6
@@ -1,10 +1,12 @@
1
- import { Resolver, Query, FieldResolver, Root, Arg, Ctx } from 'type-graphql'
2
- import { Domain, getRepository } from '@things-factory/shell'
1
+ import { Resolver, Query, FieldResolver, Root, Arg, Args, Ctx } from 'type-graphql'
2
+ import { IsNull } from 'typeorm'
3
+ import { Domain, getRepository, ListParam, getQueryBuilderFromListParams } from '@things-factory/shell'
3
4
  import { User } from '@things-factory/auth-base'
4
5
  import { Project } from './project'
5
- import { InspectionSummary, ProjectList } from './project-type'
6
- import { BuildingComplex, InspectionStatus } from '@dssp/building-complex'
6
+ import { Task } from '../task/task'
7
+ import { ProjectList } from './project-type'
7
8
  import { Attachment } from '@things-factory/attachment-base'
9
+ import { BuildingComplex } from '@dssp/building-complex'
8
10
 
9
11
  @Resolver(Project)
10
12
  export class ProjectQuery {
@@ -18,51 +20,41 @@ export class ProjectQuery {
18
20
  }
19
21
 
20
22
  @Query(returns => ProjectList, { description: '프로젝트 리스트' })
21
- async projects(@Arg('projectName') projectName: string, @Ctx() context: ResolverContext): Promise<ProjectList> {
23
+ async projects(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<ProjectList> {
22
24
  const { domain } = context.state
23
- // const { page = 1, limit = 0 } = params.pagination || {}
24
25
 
25
- const queryBuilder = await getRepository(Project)
26
- .createQueryBuilder('p')
27
- .innerJoinAndSelect('p.buildingComplex', 'bc')
28
- .where('p.domain = :domain', { domain: domain.id })
29
- .orderBy('p.created_at', 'DESC')
30
- // .offset((page - 1) * limit)
31
- // .limit(limit)
32
-
33
- if (projectName) {
34
- projectName = `%${projectName}%`
35
- queryBuilder.andWhere('p.name LIKE :projectName', { projectName })
36
- }
26
+ const queryBuilder = getQueryBuilderFromListParams({
27
+ domain,
28
+ params,
29
+ repository: await getRepository(Project),
30
+ searchables: ['name', 'description']
31
+ })
37
32
 
38
33
  const [items, total] = await queryBuilder.getManyAndCount()
39
34
 
40
35
  return { items, total }
41
36
  }
42
37
 
43
- @Query(returns => InspectionSummary, { description: '프로젝트의 검측상태 카운트' })
44
- async inspectionSummary(@Arg('projectId') projectId: string, @Ctx() context: ResolverContext): Promise<InspectionSummary> {
38
+ @Query(returns => Project!, { nullable: true, description: 'To fetch a Project' })
39
+ async projectByBuildingComplexId(
40
+ @Arg('buildingComplexId') buildingComplexId: string,
41
+ @Ctx() context: ResolverContext
42
+ ): Promise<Project> {
45
43
  const { domain } = context.state
46
44
 
47
- const queryBuilder = getRepository(Project)
48
- .createQueryBuilder('p')
49
- .select(`COUNT(CASE WHEN bi.status='${InspectionStatus.REQUEST}' THEN 1 ELSE NULL END) AS request`)
50
- .addSelect(`COUNT(CASE WHEN bi.status='${InspectionStatus.PASS}' THEN 1 ELSE NULL END) AS pass`)
51
- .addSelect(`COUNT(CASE WHEN bi.status='${InspectionStatus.FAIL}' THEN 1 ELSE NULL END) AS fail`)
52
- .innerJoin('p.buildingComplex', 'bc')
53
- .innerJoin('bc.buildings', 'b')
54
- .innerJoin('b.buildingLevels', 'bl')
55
- .innerJoin('bl.buildingInspections', 'bi')
56
- .where('p.domain = :domain', { domain: domain.id })
57
- .andWhere('p.id = :projectId', { projectId })
58
- .groupBy('p.id')
45
+ return await getRepository(Project).findOne({
46
+ where: { domain: { id: domain.id }, buildingComplex: { id: buildingComplexId } }
47
+ })
48
+ }
59
49
 
60
- const result = (await queryBuilder.getRawOne()) || {}
61
- return {
62
- request: result.request || 0,
63
- pass: result.pass || 0,
64
- fail: result.fail || 0
65
- }
50
+ @FieldResolver(type => [Task], { nullable: true })
51
+ async rootTasks(@Root() project: Project): Promise<Task[]> {
52
+ return await getRepository(Task).find({
53
+ where: {
54
+ project: { id: project.id },
55
+ parent: IsNull()
56
+ }
57
+ })
66
58
  }
67
59
 
68
60
  @FieldResolver(type => Attachment)
@@ -1,71 +1,66 @@
1
1
  import { ObjectType, Field, InputType, Int, Float } from 'type-graphql'
2
2
  import { Project } from './project'
3
- import { BuildingComplexPatch } from '@dssp/building-complex'
4
3
  import type { FileUpload } from 'graphql-upload/GraphQLUpload.js'
5
4
  import GraphQLUpload from 'graphql-upload/GraphQLUpload.js'
5
+ import { ObjectRef, ScalarObject } from '@things-factory/shell'
6
+ import { BuildingComplexPatch } from '@dssp/building-complex'
6
7
 
7
8
  @InputType()
8
9
  export class NewProject {
9
- @Field({ nullable: false })
10
+ @Field({ nullable: false, description: '프로젝트 이름' })
10
11
  name: string
12
+
13
+ @Field(type => ObjectRef, { nullable: true, description: '연관된 건물 복합체 정보 (선택 사항)' })
14
+ buildingComplex?: ObjectRef
11
15
  }
12
16
 
13
17
  @InputType()
14
18
  export class ProjectPatch {
15
- @Field({ nullable: false })
19
+ @Field({ nullable: false, description: '수정할 프로젝트의 ID' })
16
20
  id: string
17
21
 
18
- @Field({ nullable: false })
22
+ @Field({ nullable: false, description: '프로젝트 이름' })
19
23
  name: string
20
24
 
21
- @Field({ nullable: true })
25
+ @Field({ nullable: true, description: '프로젝트 착공일정' })
22
26
  startDate?: string
23
27
 
24
- @Field({ nullable: true })
28
+ @Field({ nullable: true, description: '프로젝트 준공일정' })
25
29
  endDate?: string
26
30
 
27
- @Field(type => GraphQLUpload, { nullable: true })
31
+ @Field(type => GraphQLUpload, { nullable: true, description: '프로젝트 대표 사진 업로드' })
28
32
  mainPhotoUpload?: FileUpload
29
33
 
30
- @Field(type => Float, { nullable: true })
34
+ @Field(type => Float, { nullable: true, description: '프로젝트 전체 진행현황 (%)' })
31
35
  totalProgress?: number
32
36
 
33
- @Field(type => Float, { nullable: true })
37
+ @Field(type => Float, { nullable: true, description: '프로젝트 주간 진행현황 (%)' })
34
38
  weeklyProgress?: number
35
39
 
36
- @Field(type => Float, { nullable: true })
40
+ @Field(type => Float, { nullable: true, description: '프로젝트 KPI' })
37
41
  kpi?: number
38
42
 
39
- @Field(type => Float, { nullable: true })
43
+ @Field(type => Float, { nullable: true, description: '검측/통과 비율 (%)' })
40
44
  inspPassRate?: number
41
45
 
42
- @Field(type => Float, { nullable: true })
46
+ @Field(type => Float, { nullable: true, description: '로봇 작업 진행율 (%)' })
43
47
  robotProgressRate?: number
44
48
 
45
- @Field(type => Float, { nullable: true })
49
+ @Field(type => Float, { nullable: true, description: '구조 안전도 (%)' })
46
50
  structuralSafetyRate?: number
47
51
 
48
52
  @Field({ nullable: true })
49
53
  buildingComplex?: BuildingComplexPatch
54
+
55
+ // @Field(type => ObjectRef, { nullable: true, description: '연관된 건물 복합체 정보 (선택 사항)' })
56
+ // buildingComplex?: ObjectRef
50
57
  }
51
58
 
52
59
  @ObjectType()
53
60
  export class ProjectList {
54
- @Field(type => [Project])
61
+ @Field(type => [Project], { description: '프로젝트 리스트 항목들' })
55
62
  items: Project[]
56
63
 
57
- @Field(type => Int)
64
+ @Field(type => Int, { description: '전체 프로젝트 수' })
58
65
  total: number
59
66
  }
60
-
61
- @ObjectType()
62
- export class InspectionSummary {
63
- @Field(type => Int)
64
- request: number
65
-
66
- @Field(type => Int)
67
- pass: number
68
-
69
- @Field(type => Int)
70
- fail: number
71
- }
@@ -12,7 +12,7 @@ import {
12
12
  JoinColumn,
13
13
  PrimaryGeneratedColumn
14
14
  } from 'typeorm'
15
- import { ObjectType, Field, ID, registerEnumType } from 'type-graphql'
15
+ import { ObjectType, Field, ID } from 'type-graphql'
16
16
 
17
17
  import { Domain, roundTransformer } from '@things-factory/shell'
18
18
  import { User } from '@things-factory/auth-base'
@@ -21,18 +21,13 @@ import { BuildingComplex } from '@dssp/building-complex'
21
21
  import { Attachment } from '@things-factory/attachment-base'
22
22
 
23
23
  export enum ProjectStatus {
24
- 'PROCEEDING' = '10',
25
- 'COMPLICATED' = '20'
24
+ 'ONGOING' = '10',
25
+ 'COMPLETED' = '20'
26
26
  }
27
27
 
28
- registerEnumType(ProjectStatus, {
29
- name: 'ProjectStatus',
30
- description: '프로젝트 상태'
31
- })
32
-
33
- @Entity()
34
- @Index('ix_project_0', (project: Project) => [project.buildingComplex], { unique: true, where: '"deleted_at" IS NULL' })
35
28
  @ObjectType({ description: '프로젝트' })
29
+ @Entity()
30
+ @Index('ix_project_building', (project: Project) => [project.buildingComplex], { unique: true, where: '"deleted_at" IS NULL' })
36
31
  export class Project {
37
32
  @PrimaryGeneratedColumn('uuid')
38
33
  @Field(type => ID)
@@ -49,7 +44,7 @@ export class Project {
49
44
  @Field({ nullable: false })
50
45
  name?: string
51
46
 
52
- @Column({ nullable: false, default: ProjectStatus.PROCEEDING, comment: '프로젝트 상태 (10: 진행중, 20: 완료)' })
47
+ @Column({ nullable: false, default: ProjectStatus.ONGOING, comment: '프로젝트 상태 (10: 진행중, 20: 완료)' })
53
48
  @Field({ nullable: false })
54
49
  state?: ProjectStatus
55
50
 
@@ -99,10 +94,14 @@ export class Project {
99
94
  buildingComplexId?: string
100
95
 
101
96
  // 작업 정보 (하위 테이블 참조)
102
- @Field(() => [Task], { nullable: true })
103
97
  @OneToMany(() => Task, task => task.project)
98
+ @Field(() => [Task], { nullable: true })
104
99
  tasks?: Task[]
105
100
 
101
+ // 루트 작업 정보 (부모가 없는 상위 작업)
102
+ @Field(() => [Task], { nullable: true })
103
+ rootTasks?: Task[]
104
+
106
105
  @CreateDateColumn()
107
106
  @Field({ nullable: true })
108
107
  createdAt?: Date
@@ -0,0 +1,7 @@
1
+ import { Resource } from './resource'
2
+ import { ResourceQuery } from './resource-query'
3
+ import { ResourceMutation } from './resource-mutation'
4
+
5
+ export const entities = [Resource]
6
+ export const resolvers = [ResourceQuery, ResourceMutation]
7
+ export const subscribers = []
@@ -0,0 +1,137 @@
1
+ import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
2
+ import { In } from 'typeorm'
3
+
4
+ import { Resource } from './resource'
5
+ import { NewResource, ResourcePatch } from './resource-type'
6
+
7
+ @Resolver(Resource)
8
+ export class ResourceMutation {
9
+ @Directive('@transaction')
10
+ @Directive('@privilege(category: "project", privilege: "mutation", domainOwnerGranted: true)')
11
+ @Mutation(returns => Resource, { description: 'To create new Resource' })
12
+ async createResource(@Arg('resource') resource: NewResource, @Ctx() context: ResolverContext): Promise<Resource> {
13
+ const { domain, user, tx } = context.state
14
+
15
+ const result = await tx.getRepository(Resource).save({
16
+ ...resource,
17
+ domain,
18
+ creator: user,
19
+ updater: user
20
+ })
21
+
22
+ return result
23
+ }
24
+
25
+ @Directive('@transaction')
26
+ @Directive('@privilege(category: "project", privilege: "mutation", domainOwnerGranted: true)')
27
+ @Mutation(returns => Resource, { description: 'To modify Resource information' })
28
+ async updateResource(
29
+ @Arg('id') id: string,
30
+ @Arg('patch') patch: ResourcePatch,
31
+ @Ctx() context: ResolverContext
32
+ ): Promise<Resource> {
33
+ const { domain, user, tx } = context.state
34
+
35
+ const repository = tx.getRepository(Resource)
36
+ const resource = await repository.findOne({
37
+ where: { domain: { id: domain.id }, id }
38
+ })
39
+
40
+ const result = await repository.save({
41
+ ...resource,
42
+ ...patch,
43
+ updater: user
44
+ })
45
+
46
+ return result
47
+ }
48
+
49
+ @Directive('@transaction')
50
+ @Directive('@privilege(category: "project", privilege: "mutation", domainOwnerGranted: true)')
51
+ @Mutation(returns => [Resource], { description: "To modify multiple Resources' information" })
52
+ async updateMultipleResource(
53
+ @Arg('patches', type => [ResourcePatch]) patches: ResourcePatch[],
54
+ @Ctx() context: ResolverContext
55
+ ): Promise<Resource[]> {
56
+ const { domain, user, tx } = context.state
57
+
58
+ let results = []
59
+ const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
60
+ const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
61
+ const resourceRepo = tx.getRepository(Resource)
62
+
63
+ if (_createRecords.length > 0) {
64
+ for (let i = 0; i < _createRecords.length; i++) {
65
+ const newRecord = _createRecords[i]
66
+
67
+ const result = await resourceRepo.save({
68
+ ...newRecord,
69
+ domain,
70
+ creator: user,
71
+ updater: user
72
+ })
73
+
74
+ results.push({ ...result, cuFlag: '+' })
75
+ }
76
+ }
77
+
78
+ if (_updateRecords.length > 0) {
79
+ for (let i = 0; i < _updateRecords.length; i++) {
80
+ const updateRecord = _updateRecords[i]
81
+ const resource = await resourceRepo.findOneBy({ id: updateRecord.id })
82
+
83
+ const result = await resourceRepo.save({
84
+ ...resource,
85
+ ...updateRecord,
86
+ updater: user
87
+ })
88
+
89
+ results.push({ ...result, cuFlag: 'M' })
90
+ }
91
+ }
92
+
93
+ return results
94
+ }
95
+
96
+ @Directive('@transaction')
97
+ @Directive('@privilege(category: "project", privilege: "mutation", domainOwnerGranted: true)')
98
+ @Mutation(returns => Boolean, { description: 'To delete Resource' })
99
+ async deleteResource(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
100
+ const { domain, tx } = context.state
101
+
102
+ await tx.getRepository(Resource).delete({ domain: { id: domain.id }, id })
103
+
104
+ return true
105
+ }
106
+
107
+ @Directive('@transaction')
108
+ @Mutation(returns => Boolean, { description: 'To delete multiple Resources' })
109
+ async deleteResources(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<boolean> {
110
+ const { domain, tx } = context.state
111
+
112
+ await tx.getRepository(Resource).delete({
113
+ domain: { id: domain.id },
114
+ id: In(ids)
115
+ })
116
+
117
+ return true
118
+ }
119
+
120
+ @Directive('@transaction')
121
+ @Directive('@privilege(category: "project", privilege: "mutation", domainOwnerGranted: true)')
122
+ @Mutation(returns => Boolean, { description: 'To import multiple Resources' })
123
+ async importResources(
124
+ @Arg('resources', type => [ResourcePatch]) resources: ResourcePatch[],
125
+ @Ctx() context: ResolverContext
126
+ ): Promise<boolean> {
127
+ const { domain, tx } = context.state
128
+
129
+ await Promise.all(
130
+ resources.map(async (resource: ResourcePatch) => {
131
+ const createdResource: Resource = await tx.getRepository(Resource).save({ domain, ...resource })
132
+ })
133
+ )
134
+
135
+ return true
136
+ }
137
+ }
@@ -0,0 +1,50 @@
1
+ import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'
2
+ import { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
3
+ import { User } from '@things-factory/auth-base'
4
+ import { Resource } from './resource'
5
+ import { ResourceList } from './resource-type'
6
+
7
+ @Resolver(Resource)
8
+ export class ResourceQuery {
9
+ @Directive('@privilege(category: "project", privilege: "query", domainOwnerGranted: true)')
10
+ @Query(returns => Resource!, { nullable: true, description: 'To fetch a Resource' })
11
+ async resource(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Resource> {
12
+ const { domain } = context.state
13
+
14
+ return await getRepository(Resource).findOne({
15
+ where: { domain: { id: domain.id }, id }
16
+ })
17
+ }
18
+
19
+ @Directive('@privilege(category: "project", privilege: "query", domainOwnerGranted: true)')
20
+ @Query(returns => ResourceList, { description: 'To fetch multiple Resources' })
21
+ async resources(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<ResourceList> {
22
+ const { domain } = context.state
23
+
24
+ const queryBuilder = getQueryBuilderFromListParams({
25
+ domain,
26
+ params,
27
+ repository: await getRepository(Resource),
28
+ searchables: ['name', 'description']
29
+ })
30
+
31
+ const [items, total] = await queryBuilder.getManyAndCount()
32
+
33
+ return { items, total }
34
+ }
35
+
36
+ @FieldResolver(type => Domain)
37
+ async domain(@Root() resource: Resource): Promise<Domain> {
38
+ return await getRepository(Domain).findOneBy({ id: resource.domainId })
39
+ }
40
+
41
+ @FieldResolver(type => User)
42
+ async updater(@Root() resource: Resource): Promise<User> {
43
+ return await getRepository(User).findOneBy({ id: resource.updaterId })
44
+ }
45
+
46
+ @FieldResolver(type => User)
47
+ async creator(@Root() resource: Resource): Promise<User> {
48
+ return await getRepository(User).findOneBy({ id: resource.creatorId })
49
+ }
50
+ }
@@ -0,0 +1,41 @@
1
+ import { InputType, Field, ID, ObjectType, Int } from 'type-graphql'
2
+ import { Resource, ResourceType } from './resource'
3
+
4
+ @InputType()
5
+ export class NewResource {
6
+ @Field()
7
+ name: string
8
+
9
+ @Field(type => ResourceType)
10
+ type: ResourceType
11
+
12
+ @Field()
13
+ unit: string
14
+ }
15
+
16
+ @InputType()
17
+ export class ResourcePatch {
18
+ @Field(type => ID, { nullable: true })
19
+ id?: string
20
+
21
+ @Field({ nullable: true })
22
+ name?: string
23
+
24
+ @Field(type => ResourceType, { nullable: true })
25
+ type?: ResourceType
26
+
27
+ @Field({ nullable: true })
28
+ unit?: string
29
+
30
+ @Field({ nullable: true })
31
+ cuFlag?: string
32
+ }
33
+
34
+ @ObjectType()
35
+ export class ResourceList {
36
+ @Field(type => [Resource])
37
+ items: Resource[]
38
+
39
+ @Field(type => Int)
40
+ total: number
41
+ }
@@ -0,0 +1,82 @@
1
+ import {
2
+ CreateDateColumn,
3
+ UpdateDateColumn,
4
+ DeleteDateColumn,
5
+ Entity,
6
+ Column,
7
+ PrimaryGeneratedColumn,
8
+ ManyToOne,
9
+ RelationId,
10
+ OneToMany
11
+ } from 'typeorm'
12
+ import { ObjectType, Field, ID, registerEnumType } from 'type-graphql'
13
+ import { Domain } from '@things-factory/shell'
14
+ import { User } from '@things-factory/auth-base'
15
+ import { TaskResource } from '../task-resource/task-resource'
16
+
17
+ export enum ResourceType {
18
+ HUMAN = 'HUMAN',
19
+ MATERIAL = 'MATERIAL',
20
+ EQUIPMENT = 'EQUIPMENT'
21
+ }
22
+
23
+ registerEnumType(ResourceType, {
24
+ name: 'ResourceType',
25
+ description: '자원 유형'
26
+ })
27
+
28
+ @Entity()
29
+ @ObjectType({ description: '자원' })
30
+ export class Resource {
31
+ @PrimaryGeneratedColumn('uuid')
32
+ @Field(type => ID)
33
+ readonly id: string
34
+
35
+ @ManyToOne(type => Domain)
36
+ @Field({ nullable: true })
37
+ domain?: Domain
38
+
39
+ @RelationId((resource: Resource) => resource.domain)
40
+ domainId?: string
41
+
42
+ @Column({ nullable: false, comment: '자원 이름' })
43
+ @Field({ nullable: false })
44
+ name?: string
45
+
46
+ @Column({ nullable: false, default: ResourceType.HUMAN, comment: '자원 유형' })
47
+ @Field({ nullable: false })
48
+ type: ResourceType
49
+
50
+ @Column({ nullable: false, comment: '단위 (예: man/day, kg, hour 등)' })
51
+ @Field({ nullable: false })
52
+ unit: string
53
+
54
+ @CreateDateColumn()
55
+ @Field({ nullable: true })
56
+ createdAt?: Date
57
+
58
+ @UpdateDateColumn()
59
+ @Field({ nullable: true })
60
+ updatedAt?: Date
61
+
62
+ @DeleteDateColumn()
63
+ @Field({ nullable: true })
64
+ deletedAt?: Date
65
+
66
+ @ManyToOne(type => User, { nullable: true })
67
+ @Field(type => User, { nullable: true })
68
+ creator?: User
69
+
70
+ @RelationId((resource: Resource) => resource.creator)
71
+ creatorId?: string
72
+
73
+ @ManyToOne(type => User, { nullable: true })
74
+ @Field(type => User, { nullable: true })
75
+ updater?: User
76
+
77
+ @RelationId((resource: Resource) => resource.updater)
78
+ updaterId?: string
79
+
80
+ @OneToMany(() => TaskResource, taskResource => taskResource.resource)
81
+ taskResources?: TaskResource[]
82
+ }
@@ -9,6 +9,7 @@ import { NewTask, TaskPatch } from './task-type'
9
9
  @Resolver(Task)
10
10
  export class TaskMutation {
11
11
  @Directive('@transaction')
12
+ @Directive('@privilege(category: "project", privilege: "mutation", domainOwnerGranted: true)')
12
13
  @Mutation(returns => Task, { description: 'To create new Task' })
13
14
  async createTask(@Arg('task') task: NewTask, @Ctx() context: ResolverContext): Promise<Task> {
14
15
  const { domain, user, tx } = context.state
@@ -24,12 +25,9 @@ export class TaskMutation {
24
25
  }
25
26
 
26
27
  @Directive('@transaction')
28
+ @Directive('@privilege(category: "project", privilege: "mutation", domainOwnerGranted: true)')
27
29
  @Mutation(returns => Task, { description: 'To modify Task information' })
28
- async updateTask(
29
- @Arg('id') id: string,
30
- @Arg('patch') patch: TaskPatch,
31
- @Ctx() context: ResolverContext
32
- ): Promise<Task> {
30
+ async updateTask(@Arg('id') id: string, @Arg('patch') patch: TaskPatch, @Ctx() context: ResolverContext): Promise<Task> {
33
31
  const { domain, user, tx } = context.state
34
32
 
35
33
  const repository = tx.getRepository(Task)
@@ -47,6 +45,7 @@ export class TaskMutation {
47
45
  }
48
46
 
49
47
  @Directive('@transaction')
48
+ @Directive('@privilege(category: "project", privilege: "mutation", domainOwnerGranted: true)')
50
49
  @Mutation(returns => [Task], { description: "To modify multiple Tasks' information" })
51
50
  async updateMultipleTask(
52
51
  @Arg('patches', type => [TaskPatch]) patches: TaskPatch[],
@@ -93,6 +92,7 @@ export class TaskMutation {
93
92
  }
94
93
 
95
94
  @Directive('@transaction')
95
+ @Directive('@privilege(category: "project", privilege: "mutation", domainOwnerGranted: true)')
96
96
  @Mutation(returns => Boolean, { description: 'To delete Task' })
97
97
  async deleteTask(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
98
98
  const { domain, tx } = context.state
@@ -104,6 +104,7 @@ export class TaskMutation {
104
104
  }
105
105
 
106
106
  @Directive('@transaction')
107
+ @Directive('@privilege(category: "project", privilege: "mutation", domainOwnerGranted: true)')
107
108
  @Mutation(returns => Boolean, { description: 'To delete multiple Tasks' })
108
109
  async deleteTasks(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<boolean> {
109
110
  const { domain, tx } = context.state
@@ -118,11 +119,9 @@ export class TaskMutation {
118
119
  }
119
120
 
120
121
  @Directive('@transaction')
122
+ @Directive('@privilege(category: "project", privilege: "mutation", domainOwnerGranted: true)')
121
123
  @Mutation(returns => Boolean, { description: 'To import multiple Tasks' })
122
- async importTasks(
123
- @Arg('tasks', type => [TaskPatch]) tasks: TaskPatch[],
124
- @Ctx() context: ResolverContext
125
- ): Promise<boolean> {
124
+ async importTasks(@Arg('tasks', type => [TaskPatch]) tasks: TaskPatch[], @Ctx() context: ResolverContext): Promise<boolean> {
126
125
  const { domain, tx } = context.state
127
126
 
128
127
  await Promise.all(