@dssp/supervision 0.0.19 → 0.0.21

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 (57) hide show
  1. package/client/pages/building-inspection/building-inspection-detail-checklist.ts +16 -8
  2. package/client/pages/building-inspection/building-inspection-list.ts +152 -48
  3. package/client/pages/building-inspection/component/inspection-event-provider.ts +32 -0
  4. package/client/pages/building-inspection/inspection-create-popup.ts +186 -124
  5. package/client/pages/checklist/checklist-view.ts +13 -16
  6. package/client/pages/checklist-template/checklist-template-list.ts +75 -1
  7. package/dist-client/pages/building-inspection/building-inspection-detail-checklist.d.ts +1 -3
  8. package/dist-client/pages/building-inspection/building-inspection-detail-checklist.js +12 -7
  9. package/dist-client/pages/building-inspection/building-inspection-detail-checklist.js.map +1 -1
  10. package/dist-client/pages/building-inspection/building-inspection-list.d.ts +5 -1
  11. package/dist-client/pages/building-inspection/building-inspection-list.js +151 -47
  12. package/dist-client/pages/building-inspection/building-inspection-list.js.map +1 -1
  13. package/dist-client/pages/building-inspection/component/inspection-event-provider.d.ts +6 -0
  14. package/dist-client/pages/building-inspection/component/inspection-event-provider.js +26 -0
  15. package/dist-client/pages/building-inspection/component/inspection-event-provider.js.map +1 -0
  16. package/dist-client/pages/building-inspection/inspection-create-popup.js +162 -97
  17. package/dist-client/pages/building-inspection/inspection-create-popup.js.map +1 -1
  18. package/dist-client/pages/checklist/checklist-view.js +9 -26
  19. package/dist-client/pages/checklist/checklist-view.js.map +1 -1
  20. package/dist-client/pages/checklist-template/checklist-template-list.d.ts +2 -0
  21. package/dist-client/pages/checklist-template/checklist-template-list.js +67 -0
  22. package/dist-client/pages/checklist-template/checklist-template-list.js.map +1 -1
  23. package/dist-client/route.d.ts +1 -1
  24. package/dist-client/tsconfig.tsbuildinfo +1 -1
  25. package/dist-server/service/building-inspection/building-inspection-history.d.ts +1 -1
  26. package/dist-server/service/building-inspection/building-inspection-history.js +3 -5
  27. package/dist-server/service/building-inspection/building-inspection-history.js.map +1 -1
  28. package/dist-server/service/building-inspection/building-inspection-mutation.js +0 -1
  29. package/dist-server/service/building-inspection/building-inspection-mutation.js.map +1 -1
  30. package/dist-server/service/building-inspection/building-inspection-query.d.ts +1 -0
  31. package/dist-server/service/building-inspection/building-inspection-query.js +32 -4
  32. package/dist-server/service/building-inspection/building-inspection-query.js.map +1 -1
  33. package/dist-server/service/building-inspection/building-inspection-type.d.ts +1 -0
  34. package/dist-server/service/building-inspection/building-inspection-type.js +4 -0
  35. package/dist-server/service/building-inspection/building-inspection-type.js.map +1 -1
  36. package/dist-server/service/building-inspection/building-inspection.d.ts +1 -1
  37. package/dist-server/service/building-inspection/building-inspection.js +3 -3
  38. package/dist-server/service/building-inspection/building-inspection.js.map +1 -1
  39. package/dist-server/service/checklist/checklist-query.d.ts +2 -0
  40. package/dist-server/service/checklist/checklist-query.js +11 -0
  41. package/dist-server/service/checklist/checklist-query.js.map +1 -1
  42. package/dist-server/service/checklist-template-item/checklist-template-item-query.d.ts +1 -0
  43. package/dist-server/service/checklist-template-item/checklist-template-item-query.js +12 -0
  44. package/dist-server/service/checklist-template-item/checklist-template-item-query.js.map +1 -1
  45. package/dist-server/service/checklist-template-item/checklist-template-item.js +2 -1
  46. package/dist-server/service/checklist-template-item/checklist-template-item.js.map +1 -1
  47. package/dist-server/service/index.d.ts +1 -1
  48. package/dist-server/tsconfig.tsbuildinfo +1 -1
  49. package/package.json +4 -4
  50. package/server/service/building-inspection/building-inspection-history.ts +3 -5
  51. package/server/service/building-inspection/building-inspection-mutation.ts +0 -1
  52. package/server/service/building-inspection/building-inspection-query.ts +31 -4
  53. package/server/service/building-inspection/building-inspection-type.ts +3 -0
  54. package/server/service/building-inspection/building-inspection.ts +3 -4
  55. package/server/service/checklist/checklist-query.ts +6 -0
  56. package/server/service/checklist-template-item/checklist-template-item-query.ts +8 -3
  57. package/server/service/checklist-template-item/checklist-template-item.ts +2 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dssp/supervision",
3
- "version": "0.0.19",
3
+ "version": "0.0.21",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "things-factory": true,
@@ -27,8 +27,8 @@
27
27
  "migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
28
28
  },
29
29
  "dependencies": {
30
- "@dssp/building-complex": "^0.0.19",
31
- "@dssp/project": "^0.0.19",
30
+ "@dssp/building-complex": "^0.0.21",
31
+ "@dssp/project": "^0.0.21",
32
32
  "@operato/event-view": "^8.0.0-alpha",
33
33
  "@operato/graphql": "^8.0.0-alpha",
34
34
  "@operato/image-marker": "^8.0.0-alpha",
@@ -37,5 +37,5 @@
37
37
  "@things-factory/auth-base": "^8.0.0-alpha",
38
38
  "@things-factory/shell": "^8.0.0-alpha"
39
39
  },
40
- "gitHead": "a7d5da01e7a8920b9eb9c4f9340a4eb5ebdb12f9"
40
+ "gitHead": "2f7869190c368d6c5dfa5f8c64845e9e64de7dc9"
41
41
  }
@@ -1,10 +1,8 @@
1
1
  import { Field, ID, ObjectType } from 'type-graphql'
2
2
  import { Column, Entity, Index, ManyToOne, PrimaryGeneratedColumn, RelationId } from 'typeorm'
3
-
4
3
  import { HistoryActionColumn, HistoryActionType, HistoryEntityInterface, HistoryOriginalIdColumn } from '@operato/typeorm-history'
5
4
  import { User } from '@things-factory/auth-base'
6
5
  import { config } from '@things-factory/env'
7
-
8
6
  import { BuildingInspection, BuildingInspectionStatus } from './building-inspection'
9
7
  import { BuildingLevel } from '@dssp/building-complex'
10
8
 
@@ -36,9 +34,9 @@ export class BuildingInspectionHistory implements HistoryEntityInterface<Buildin
36
34
  @RelationId((buildingInspectionHistory: BuildingInspectionHistory) => buildingInspectionHistory.buildingLevel)
37
35
  buildingLevelId?: string
38
36
 
39
- @Column({ nullable: false, comment: '검측 요청일' })
40
- @Field({ nullable: true })
41
- requestDate?: Date
37
+ @Column({ type: 'date', nullable: true, comment: '검측 요청일' })
38
+ @Field(type => String, { nullable: true })
39
+ requestDate?: string
42
40
 
43
41
  // 체크리스트 ID (1:1 테이블 참조)
44
42
  @Field({ nullable: true })
@@ -62,7 +62,6 @@ export class BuildingInspectionMutation {
62
62
  const result = await buildingInspectionRepository.save({
63
63
  status: BuildingInspectionStatus.WAIT,
64
64
  buildingLevel: { id: buildingLevelId },
65
- requestDate: new Date(),
66
65
  checklist: savedChecklist,
67
66
  creator: user,
68
67
  updater: user
@@ -128,6 +128,33 @@ export class BuildingInspectionQuery {
128
128
  }
129
129
  }
130
130
 
131
+ // 층 별로 검수 개수 써머리
132
+ @Query(returns => [BuildingInspectionSummary]!, { nullable: true, description: 'To fetch a BuildingInspection Summary' })
133
+ async buildingInspectionDateSummaryOfLevelAndMonth(
134
+ @Arg('buildingLevelId') buildingLevelId: string,
135
+ @Arg('yearMonth') yearMonth: string,
136
+ @Ctx() context: ResolverContext
137
+ ): Promise<BuildingInspectionSummary[]> {
138
+ const [year, month] = yearMonth.split('-') // 'YYYY-MM' 형식에서 연도와 월 추출
139
+ const startDate = `${year}-${month}-01`
140
+ const endDate = new Date(Number(year), Number(month), 0).toISOString().split('T')[0] // 해당 월의 마지막 날짜 계산
141
+
142
+ const buildingInspectionSummary = await getRepository(BuildingInspection)
143
+ .createQueryBuilder('bi')
144
+ .select(`TO_CHAR(bi.request_date, 'YYYY-MM-DD') AS "requestDate"`)
145
+ .addSelect(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.WAIT}' THEN 1 ELSE NULL END) AS wait`)
146
+ .addSelect(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.REQUEST}' THEN 1 ELSE NULL END) AS request`)
147
+ .addSelect(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.PASS}' THEN 1 ELSE NULL END) AS pass`)
148
+ .addSelect(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.FAIL}' THEN 1 ELSE NULL END) AS fail`)
149
+ .where('bi.building_level_id = :buildingLevelId', { buildingLevelId })
150
+ .andWhere('bi.request_date BETWEEN :startDate AND :endDate', { startDate, endDate })
151
+ .groupBy('bi.building_level_id')
152
+ .addGroupBy('bi.request_date')
153
+ .getRawMany()
154
+
155
+ return buildingInspectionSummary
156
+ }
157
+
131
158
  // 층 별로 검수 개수 써머리
132
159
  @FieldResolver(type => BuildingInspectionSummary)
133
160
  async buildingInspectionSummary(@Root() buildingLevel: BuildingLevel): Promise<BuildingInspectionSummary> {
@@ -172,10 +199,10 @@ export class BuildingInspectionQuery {
172
199
  .getRawOne()
173
200
 
174
201
  return {
175
- wait: result.wait || 0,
176
- request: result.request || 0,
177
- pass: result.pass || 0,
178
- fail: result.fail || 0
202
+ wait: result?.wait || 0,
203
+ request: result?.request || 0,
204
+ pass: result?.pass || 0,
205
+ fail: result?.fail || 0
179
206
  }
180
207
  }
181
208
 
@@ -119,6 +119,9 @@ export class BuildingInspectionsOfBuildingLevel {
119
119
 
120
120
  @ObjectType()
121
121
  export class BuildingInspectionSummary {
122
+ @Field(type => String, { nullable: true, description: '요청일자' })
123
+ requestDate?: string
124
+
122
125
  @Field(type => Int, { description: '검측 대기 수' })
123
126
  wait: number
124
127
 
@@ -12,7 +12,6 @@ import {
12
12
  JoinColumn
13
13
  } from 'typeorm'
14
14
  import { ObjectType, Field, ID, registerEnumType } from 'type-graphql'
15
-
16
15
  import { User } from '@things-factory/auth-base'
17
16
  import { BuildingLevel } from '@dssp/building-complex'
18
17
  import { Checklist } from '../checklist/checklist'
@@ -53,9 +52,9 @@ export class BuildingInspection {
53
52
  @Field({ nullable: true })
54
53
  status?: BuildingInspectionStatus
55
54
 
56
- @Column({ nullable: false, comment: '검측 요청일' })
57
- @Field({ nullable: true })
58
- requestDate?: Date
55
+ @Column({ type: 'date', default: () => 'CURRENT_DATE', nullable: true, comment: '검측 요청일' })
56
+ @Field(type => String, { nullable: true })
57
+ requestDate?: string
59
58
 
60
59
  @Column({ type: 'simple-json', nullable: true, comment: '도면 마커' })
61
60
  @Field(type => String, { nullable: true })
@@ -4,6 +4,7 @@ import { User } from '@things-factory/auth-base'
4
4
  import { Checklist } from './checklist'
5
5
  import { ChecklistList } from './checklist-type'
6
6
  import { ChecklistItem } from '../checklist-item/checklist-item'
7
+ import { BuildingInspection } from '../building-inspection/building-inspection'
7
8
 
8
9
  @Resolver(Checklist)
9
10
  export class ChecklistQuery {
@@ -40,6 +41,11 @@ export class ChecklistQuery {
40
41
  .getMany()
41
42
  }
42
43
 
44
+ @FieldResolver(type => BuildingInspection)
45
+ async buildingInspection(@Root() checklist: Checklist): Promise<BuildingInspection> {
46
+ return await getRepository(BuildingInspection).findOneBy({ checklist: { id: checklist.id } })
47
+ }
48
+
43
49
  @FieldResolver(type => User)
44
50
  async updater(@Root() checklist: Checklist): Promise<User> {
45
51
  return await getRepository(User).findOneBy({ id: checklist.updaterId })
@@ -1,9 +1,9 @@
1
- import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'
2
- import { Attachment } from '@things-factory/attachment-base'
3
- import { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
1
+ import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx } from 'type-graphql'
2
+ import { getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
4
3
  import { User } from '@things-factory/auth-base'
5
4
  import { ChecklistTemplateItem } from './checklist-template-item'
6
5
  import { ChecklistTemplateItemList } from './checklist-template-item-type'
6
+ import { ChecklistType } from '../checklist-type/checklist-type'
7
7
 
8
8
  @Resolver(ChecklistTemplateItem)
9
9
  export class ChecklistTemplateItemQuery {
@@ -27,6 +27,11 @@ export class ChecklistTemplateItemQuery {
27
27
  return { items, total }
28
28
  }
29
29
 
30
+ @FieldResolver(type => String)
31
+ async detailTypeName(@Root() checklistTemplateItem: ChecklistTemplateItem): Promise<string> {
32
+ return (await getRepository(ChecklistType).findOneBy({ id: checklistTemplateItem.detailType }))?.detailType || ''
33
+ }
34
+
30
35
  @FieldResolver(type => User)
31
36
  async updater(@Root() checklistTemplateItem: ChecklistTemplateItem): Promise<User> {
32
37
  return await getRepository(User).findOneBy({ id: checklistTemplateItem.updaterId })
@@ -9,6 +9,7 @@ import { ChecklistTypeMainType } from '../checklist-type/checklist-type'
9
9
  @Index('ix_checklist_template_item_0', (checklistTemplateItem: ChecklistTemplateItem) => [checklistTemplateItem.name], {
10
10
  unique: true
11
11
  })
12
+ @Index('ix_checklist_template_item_1', (checklistTemplateItem: ChecklistTemplateItem) => [checklistTemplateItem.detailType])
12
13
  @ObjectType()
13
14
  export class ChecklistTemplateItem {
14
15
  @PrimaryGeneratedColumn('uuid')
@@ -31,7 +32,7 @@ export class ChecklistTemplateItem {
31
32
  @Field({ nullable: false })
32
33
  mainType: ChecklistTypeMainType
33
34
 
34
- @Column({ nullable: false, comment: '상세 구분' })
35
+ @Column({ nullable: false, comment: '상세 구분 ID (F.K)' })
35
36
  @Field({ nullable: false })
36
37
  detailType: string
37
38