@dssp/supervision 1.0.0-alpha.0 → 1.0.0-alpha.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 (99) hide show
  1. package/dist-client/pages/building-inspection/building-inspection-detail-checklist.js +1 -1
  2. package/dist-client/pages/building-inspection/building-inspection-detail-checklist.js.map +1 -1
  3. package/dist-client/tsconfig.tsbuildinfo +1 -1
  4. package/dist-server/tsconfig.tsbuildinfo +1 -1
  5. package/package.json +13 -13
  6. package/client/bootstrap.ts +0 -1
  7. package/client/index.ts +0 -0
  8. package/client/pages/action-plan/action-plan-importer.ts +0 -94
  9. package/client/pages/action-plan/action-plan-list-page.ts +0 -340
  10. package/client/pages/building-inspection/building-inspection-detail-camera.ts +0 -277
  11. package/client/pages/building-inspection/building-inspection-detail-checklist.ts +0 -258
  12. package/client/pages/building-inspection/building-inspection-detail-drawing.ts +0 -288
  13. package/client/pages/building-inspection/building-inspection-list.ts +0 -565
  14. package/client/pages/building-inspection/component/building-inspection-detail-header.ts +0 -123
  15. package/client/pages/building-inspection/component/inspection-event-provider.ts +0 -81
  16. package/client/pages/building-inspection/inspection-create-popup.ts +0 -785
  17. package/client/pages/checklist/attachment-list-popup.ts +0 -301
  18. package/client/pages/checklist/checklist-view.ts +0 -581
  19. package/client/pages/checklist/comment-list-popup.ts +0 -328
  20. package/client/pages/checklist/file-preview-popup.ts +0 -70
  21. package/client/pages/checklist-template/checklist-template-item.ts +0 -240
  22. package/client/pages/checklist-template/checklist-template-list.ts +0 -368
  23. package/client/pages/checklist-template/checklist-type-management.ts +0 -262
  24. package/client/pages/issue/issue-importer.ts +0 -94
  25. package/client/pages/issue/issue-list-page.ts +0 -340
  26. package/client/pages/project-report/project-report-importer.ts +0 -94
  27. package/client/pages/project-report/project-report-list-page.ts +0 -340
  28. package/client/pages/supervisor/supervisor-importer.ts +0 -94
  29. package/client/pages/supervisor/supervisor-list-page.ts +0 -340
  30. package/client/route.ts +0 -27
  31. package/client/tsconfig.json +0 -11
  32. package/server/controllers/index.ts +0 -0
  33. package/server/index.ts +0 -4
  34. package/server/middlewares/index.ts +0 -3
  35. package/server/migrations/index.ts +0 -9
  36. package/server/routes.ts +0 -28
  37. package/server/service/action-plan/action-plan-mutation.ts +0 -198
  38. package/server/service/action-plan/action-plan-query.ts +0 -62
  39. package/server/service/action-plan/action-plan-type.ts +0 -61
  40. package/server/service/action-plan/action-plan.ts +0 -103
  41. package/server/service/action-plan/index.ts +0 -7
  42. package/server/service/building-inspection/building-inspection-history.ts +0 -72
  43. package/server/service/building-inspection/building-inspection-mutation.ts +0 -276
  44. package/server/service/building-inspection/building-inspection-query.ts +0 -242
  45. package/server/service/building-inspection/building-inspection-type.ts +0 -145
  46. package/server/service/building-inspection/building-inspection.ts +0 -108
  47. package/server/service/building-inspection/event-subscriber.ts +0 -20
  48. package/server/service/building-inspection/index.ts +0 -11
  49. package/server/service/checklist/checklist-history.ts +0 -96
  50. package/server/service/checklist/checklist-mutation.ts +0 -103
  51. package/server/service/checklist/checklist-query.ts +0 -58
  52. package/server/service/checklist/checklist-type.ts +0 -49
  53. package/server/service/checklist/checklist.ts +0 -127
  54. package/server/service/checklist/event-subscriber.ts +0 -17
  55. package/server/service/checklist/index.ts +0 -9
  56. package/server/service/checklist-item/checklist-item-mutation.ts +0 -5
  57. package/server/service/checklist-item/checklist-item-query.ts +0 -84
  58. package/server/service/checklist-item/checklist-item-type.ts +0 -12
  59. package/server/service/checklist-item/checklist-item.ts +0 -103
  60. package/server/service/checklist-item/index.ts +0 -7
  61. package/server/service/checklist-item-comment/checklist-item-comment-history.ts +0 -69
  62. package/server/service/checklist-item-comment/checklist-item-comment-mutation.ts +0 -80
  63. package/server/service/checklist-item-comment/checklist-item-comment-query.ts +0 -36
  64. package/server/service/checklist-item-comment/checklist-item-comment-type.ts +0 -32
  65. package/server/service/checklist-item-comment/checklist-item-comment.ts +0 -56
  66. package/server/service/checklist-item-comment/event-subscriber.ts +0 -17
  67. package/server/service/checklist-item-comment/index.ts +0 -9
  68. package/server/service/checklist-template/checklist-template-mutation.ts +0 -66
  69. package/server/service/checklist-template/checklist-template-query.ts +0 -39
  70. package/server/service/checklist-template/checklist-template-type.ts +0 -23
  71. package/server/service/checklist-template/checklist-template.ts +0 -71
  72. package/server/service/checklist-template/index.ts +0 -6
  73. package/server/service/checklist-template-item/checklist-template-item-mutation.ts +0 -64
  74. package/server/service/checklist-template-item/checklist-template-item-query.ts +0 -44
  75. package/server/service/checklist-template-item/checklist-template-item-type.ts +0 -39
  76. package/server/service/checklist-template-item/checklist-template-item.ts +0 -68
  77. package/server/service/checklist-template-item/index.ts +0 -6
  78. package/server/service/checklist-type/checklist-type-mutation.ts +0 -66
  79. package/server/service/checklist-type/checklist-type-query.ts +0 -39
  80. package/server/service/checklist-type/checklist-type-type.ts +0 -26
  81. package/server/service/checklist-type/checklist-type.ts +0 -64
  82. package/server/service/checklist-type/index.ts +0 -6
  83. package/server/service/index.ts +0 -88
  84. package/server/service/issue/index.ts +0 -7
  85. package/server/service/issue/issue-mutation.ts +0 -198
  86. package/server/service/issue/issue-query.ts +0 -62
  87. package/server/service/issue/issue-type.ts +0 -61
  88. package/server/service/issue/issue.ts +0 -100
  89. package/server/service/project-report/index.ts +0 -7
  90. package/server/service/project-report/project-report-mutation.ts +0 -198
  91. package/server/service/project-report/project-report-query.ts +0 -62
  92. package/server/service/project-report/project-report-type.ts +0 -61
  93. package/server/service/project-report/project-report.ts +0 -113
  94. package/server/service/supervisor/index.ts +0 -7
  95. package/server/service/supervisor/supervisor-mutation.ts +0 -198
  96. package/server/service/supervisor/supervisor-query.ts +0 -62
  97. package/server/service/supervisor/supervisor-type.ts +0 -61
  98. package/server/service/supervisor/supervisor.ts +0 -108
  99. package/server/tsconfig.json +0 -10
@@ -1,242 +0,0 @@
1
- import { Resolver, Query, FieldResolver, Root, Arg, Args, Ctx } from 'type-graphql'
2
- import { Attachment } from '@things-factory/attachment-base'
3
- import { getRepository, getQueryBuilderFromListParams, ListParam } from '@things-factory/shell'
4
- import { BuildingInspection, BuildingInspectionStatus } from './building-inspection'
5
- import {
6
- BuildingInspectionList,
7
- BuildingInspectionsOfBuildingLevel,
8
- BuildingInspectionsOfProject,
9
- BuildingInspectionSummary
10
- } from './building-inspection-type'
11
- import { BuildingLevel } from '@dssp/building-complex'
12
- import { Checklist } from '../checklist/checklist'
13
- import { Project } from '@dssp/project'
14
-
15
- @Resolver(BuildingInspection)
16
- export class BuildingInspectionQuery {
17
- @Query(returns => BuildingInspection!, { nullable: true, description: 'To fetch a BuildingInspection' })
18
- async buildingInspection(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<BuildingInspection> {
19
- return await getRepository(BuildingInspection).findOne({
20
- where: { id }
21
- })
22
- }
23
-
24
- @Query(returns => BuildingInspectionList, { description: 'To fetch multiple BuildingInspections' })
25
- async buildingInspections(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<BuildingInspectionList> {
26
- const { domain } = context.state
27
-
28
- const queryBuilder = getQueryBuilderFromListParams({
29
- params,
30
- repository: await getRepository(BuildingInspection),
31
- searchables: ['name']
32
- })
33
-
34
- const [items, total] = await queryBuilder.getManyAndCount()
35
-
36
- return { items, total }
37
- }
38
-
39
- @Query(returns => BuildingInspectionList, { description: 'To fetch multiple BuildingInspections' })
40
- async buildingInspectionsOfProject(
41
- @Arg('params') params: BuildingInspectionsOfProject,
42
- @Ctx() context: ResolverContext
43
- ): Promise<BuildingInspectionList> {
44
- const { domain } = context.state
45
- const { projectId, limit } = params
46
-
47
- const queryBuilder = getRepository(BuildingInspection)
48
- .createQueryBuilder('bi')
49
- .innerJoin('building_levels', 'bl', 'bi.building_level_id = bl.id')
50
- .innerJoin('buildings', 'b', 'bl.building_id = b.id')
51
- .innerJoin('building_complexes', 'bc', 'b.building_complex_id = bc.id')
52
- .innerJoin('projects', 'p', 'bc.id = p.building_complex_id')
53
- .innerJoin('checklists', 'c', 'bi.checklist_id = c.id')
54
- .where('p.domain = :domain', { domain: domain.id })
55
- .andWhere('p.id = :projectId', { projectId })
56
- .orderBy('bi.created_at', 'DESC')
57
-
58
- if (limit) {
59
- queryBuilder.limit(limit)
60
- }
61
-
62
- const [items, total] = await queryBuilder.getManyAndCount()
63
-
64
- return { items, total }
65
- }
66
-
67
- @Query(returns => Project!, { description: 'To fetch Project' })
68
- async projectByBuildingLevelId(
69
- @Arg('buildingLevelId') buildingLevelId: string,
70
- @Ctx() context: ResolverContext
71
- ): Promise<Project> {
72
- const queryBuilder = getRepository(Project)
73
- .createQueryBuilder('p')
74
- .innerJoin('building_complexes', 'bc', 'p.building_complex_id = bc.id')
75
- .innerJoin('buildings', 'b', 'b.building_complex_id = bc.id')
76
- .innerJoin('building_levels', 'bl', 'bl.building_id = b.id')
77
- .where('bl.id = :buildingLevelId', { buildingLevelId })
78
-
79
- const result = await queryBuilder.getOne()
80
-
81
- return result
82
- }
83
-
84
- @Query(returns => BuildingInspectionList, { description: 'To fetch multiple BuildingInspections' })
85
- async buildingInspectionsOfBuildingLevel(
86
- @Arg('params') params: BuildingInspectionsOfBuildingLevel,
87
- @Ctx() context: ResolverContext
88
- ): Promise<BuildingInspectionList> {
89
- const { buildingLevelId, limit } = params
90
-
91
- const queryBuilder = getRepository(BuildingInspection)
92
- .createQueryBuilder('bi')
93
- .innerJoin('building_levels', 'bl', 'bi.building_level_id = bl.id')
94
- .innerJoin('checklists', 'c', 'bi.checklist_id = c.id')
95
- .where('bl.id = :buildingLevelId', { buildingLevelId })
96
- .orderBy('bi.updated_at', 'DESC')
97
-
98
- if (limit) {
99
- queryBuilder.limit(limit)
100
- }
101
-
102
- const [items, total] = await queryBuilder.getManyAndCount()
103
-
104
- return { items, total }
105
- }
106
-
107
- // 층 별로 검수 개수 써머리
108
- @Query(returns => BuildingInspectionSummary!, { nullable: true, description: 'To fetch a BuildingInspection Summary' })
109
- async buildingInspectionSummaryOfBuildingLevel(
110
- @Arg('buildingLevelId') buildingLevelId: string,
111
- @Ctx() context: ResolverContext
112
- ): Promise<BuildingInspectionSummary> {
113
- const buildingInspectionSummary = await getRepository(BuildingInspection)
114
- .createQueryBuilder('bi')
115
- .select(
116
- `COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.WAIT}' OR bi.status='${BuildingInspectionStatus.OVERALL_WAIT}' THEN 1 ELSE NULL END) AS wait`
117
- )
118
- .addSelect(
119
- `COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.REQUEST}' OR bi.status='${BuildingInspectionStatus.OVERALL_REQUEST}' THEN 1 ELSE NULL END) AS request`
120
- )
121
- .addSelect(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.PASS}' THEN 1 ELSE NULL END) AS pass`)
122
- .addSelect(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.FAIL}' THEN 1 ELSE NULL END) AS fail`)
123
- .where('bi.building_level_id = :buildingLevelId', { buildingLevelId })
124
- .groupBy('bi.building_level_id')
125
- .getRawOne()
126
-
127
- return {
128
- wait: buildingInspectionSummary?.wait || 0,
129
- request: buildingInspectionSummary?.request || 0,
130
- pass: buildingInspectionSummary?.pass || 0,
131
- fail: buildingInspectionSummary?.fail || 0
132
- }
133
- }
134
-
135
- // 층 별로 검수 개수 써머리
136
- @Query(returns => [BuildingInspectionSummary]!, { nullable: true, description: 'To fetch a BuildingInspection Summary' })
137
- async buildingInspectionDateSummaryOfLevelAndPeriod(
138
- @Arg('buildingLevelId') buildingLevelId: string,
139
- @Arg('startDate') startDate: string,
140
- @Arg('endDate') endDate: string,
141
- @Ctx() context: ResolverContext
142
- ): Promise<BuildingInspectionSummary[]> {
143
- const buildingInspectionSummary = await getRepository(BuildingInspection)
144
- .createQueryBuilder('bi')
145
- .select(`TO_CHAR(bi.request_date, 'YYYY-MM-DD') AS "requestDate"`)
146
- .addSelect(
147
- `COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.WAIT}' OR bi.status='${BuildingInspectionStatus.OVERALL_WAIT}' THEN 1 ELSE NULL END) AS wait`
148
- )
149
- .addSelect(
150
- `COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.REQUEST}' OR bi.status='${BuildingInspectionStatus.OVERALL_REQUEST}' THEN 1 ELSE NULL END) AS request`
151
- )
152
- .addSelect(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.PASS}' THEN 1 ELSE NULL END) AS pass`)
153
- .addSelect(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.FAIL}' THEN 1 ELSE NULL END) AS fail`)
154
- .where('bi.building_level_id = :buildingLevelId', { buildingLevelId })
155
- .andWhere('bi.request_date BETWEEN :startDate AND :endDate', { startDate, endDate })
156
- .groupBy('bi.building_level_id')
157
- .addGroupBy('bi.request_date')
158
- .getRawMany()
159
-
160
- return buildingInspectionSummary
161
- }
162
-
163
- // 층 별로 검수 개수 써머리
164
- @FieldResolver(type => BuildingInspectionSummary)
165
- async buildingInspectionSummary(@Root() buildingLevel: BuildingLevel): Promise<BuildingInspectionSummary> {
166
- const buildingInspectionSummary = await getRepository(BuildingInspection)
167
- .createQueryBuilder('bi')
168
- .select(
169
- `COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.WAIT}' OR bi.status='${BuildingInspectionStatus.OVERALL_WAIT}' THEN 1 ELSE NULL END) AS wait`
170
- )
171
- .addSelect(
172
- `COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.REQUEST}' OR bi.status='${BuildingInspectionStatus.OVERALL_REQUEST}' THEN 1 ELSE NULL END) AS request`
173
- )
174
- .addSelect(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.PASS}' THEN 1 ELSE NULL END) AS pass`)
175
- .addSelect(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.FAIL}' THEN 1 ELSE NULL END) AS fail`)
176
- .where('bi.building_level_id = :buildingLevelId', { buildingLevelId: buildingLevel.id })
177
- .groupBy('bi.building_level_id')
178
- .getRawOne()
179
-
180
- return {
181
- wait: buildingInspectionSummary?.wait || 0,
182
- request: buildingInspectionSummary?.request || 0,
183
- pass: buildingInspectionSummary?.pass || 0,
184
- fail: buildingInspectionSummary?.fail || 0
185
- }
186
- }
187
-
188
- @Query(returns => BuildingInspectionSummary, { description: '프로젝트의 검측상태 별 카운트' })
189
- async buildingInspectionSummaryOfProject(
190
- @Arg('projectId') projectId: string,
191
- @Ctx() context: ResolverContext
192
- ): Promise<BuildingInspectionSummary> {
193
- const { domain } = context.state
194
-
195
- const result = await getRepository(Project)
196
- .createQueryBuilder('p')
197
- .select(
198
- `COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.WAIT}' OR bi.status='${BuildingInspectionStatus.OVERALL_WAIT}' THEN 1 ELSE NULL END) AS wait`
199
- )
200
- .addSelect(
201
- `COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.REQUEST}' OR bi.status='${BuildingInspectionStatus.OVERALL_REQUEST}' THEN 1 ELSE NULL END) AS request`
202
- )
203
- .addSelect(`COUNT(CASE WHEN bi.status = '${BuildingInspectionStatus.PASS}' THEN 1 ELSE NULL END) AS pass`)
204
- .addSelect(`COUNT(CASE WHEN bi.status = '${BuildingInspectionStatus.FAIL}' THEN 1 ELSE NULL END) AS fail`)
205
- .innerJoin('p.buildingComplex', 'bc')
206
- .innerJoin('bc.buildings', 'b')
207
- .innerJoin('b.buildingLevels', 'bl')
208
- .leftJoin('building_inspections', 'bi', 'bi.building_level_id = bl.id AND bi.deleted_at IS NULL')
209
- .where('p.domain = :domain', { domain: domain.id })
210
- .andWhere('p.id = :projectId', { projectId })
211
- .groupBy('p.id')
212
- .getRawOne()
213
-
214
- return {
215
- wait: result?.wait || 0,
216
- request: result?.request || 0,
217
- pass: result?.pass || 0,
218
- fail: result?.fail || 0
219
- }
220
- }
221
-
222
- @FieldResolver(type => Checklist)
223
- async checklist(@Root() buildingInspection: BuildingInspection): Promise<Checklist> {
224
- return await getRepository(Checklist).findOneBy({ id: buildingInspection.checklistId })
225
- }
226
-
227
- @FieldResolver(type => BuildingLevel)
228
- async buildingLevel(@Root() buildingInspection: BuildingInspection): Promise<BuildingLevel> {
229
- return await getRepository(BuildingLevel).findOneBy({ id: buildingInspection.buildingLevelId })
230
- }
231
-
232
- @FieldResolver(type => [Attachment])
233
- async attatchments(@Root() buildingInspection: BuildingInspection): Promise<Attachment[] | undefined> {
234
- const attachment: Attachment[] = await getRepository(Attachment).find({
235
- where: {
236
- refType: BuildingInspection.name,
237
- refBy: buildingInspection.id
238
- }
239
- })
240
- return attachment
241
- }
242
- }
@@ -1,145 +0,0 @@
1
- import { ObjectType, Field, InputType, Int } from 'type-graphql'
2
- import { BuildingInspection } from './building-inspection'
3
-
4
- @InputType()
5
- class ChecklistInputType {
6
- @Field({ nullable: false })
7
- name: string
8
-
9
- @Field({ nullable: false })
10
- constructionType: string
11
-
12
- @Field({ nullable: false })
13
- constructionDetailType: string
14
-
15
- @Field({ nullable: false })
16
- location?: string
17
-
18
- @Field({ nullable: false })
19
- inspectionDrawingType?: string
20
-
21
- @Field(type => [String], { nullable: false })
22
- inspectionParts?: string[]
23
- }
24
-
25
- @InputType()
26
- class ChecklistItemInputType {
27
- @Field({ nullable: false })
28
- name: string
29
-
30
- @Field({ nullable: false })
31
- mainType: string
32
-
33
- @Field({ nullable: false })
34
- detailType: string
35
-
36
- @Field({ nullable: true })
37
- inspctionCriteria: string
38
- }
39
-
40
- @InputType()
41
- export class NewBuildingInspection {
42
- @Field({ nullable: false })
43
- buildingLevelId: string
44
-
45
- @Field(type => ChecklistInputType, { nullable: false })
46
- checklist: ChecklistInputType
47
-
48
- @Field(type => [ChecklistItemInputType], { nullable: false })
49
- checklistItem: ChecklistItemInputType[]
50
- }
51
-
52
- @InputType()
53
- class ChecklistSubmitInputType {
54
- @Field({ nullable: false })
55
- id: string
56
-
57
- @Field({ nullable: true })
58
- overallConstructorSignature?: string
59
-
60
- @Field({ nullable: true })
61
- taskConstructorSignature?: string
62
-
63
- @Field({ nullable: true })
64
- overallSupervisorySignature?: string
65
-
66
- @Field({ nullable: true })
67
- taskSupervisorySignature?: string
68
- }
69
-
70
- @InputType()
71
- class ChecklistItemSubmitInputType {
72
- @Field({ nullable: false })
73
- id: string
74
-
75
- @Field({ nullable: true })
76
- constructionConfirmStatus?: string
77
-
78
- @Field({ nullable: true })
79
- supervisoryConfirmStatus?: string
80
- }
81
-
82
- @InputType()
83
- export class UpdateBuildingInspectionSubmitType {
84
- @Field({ nullable: false })
85
- id: string
86
-
87
- @Field(type => ChecklistSubmitInputType, { nullable: false })
88
- checklist: ChecklistSubmitInputType
89
-
90
- @Field(type => [ChecklistItemSubmitInputType], { nullable: false })
91
- checklistItem: ChecklistItemSubmitInputType[]
92
- }
93
- @InputType()
94
- export class UpdateBuildingInspectionDrawingMarker {
95
- @Field({ nullable: false })
96
- id: string
97
-
98
- @Field(type => String, { nullable: true })
99
- drawingMarker?: string
100
- }
101
-
102
- @InputType()
103
- export class BuildingInspectionsOfProject {
104
- @Field({ nullable: false })
105
- projectId: string
106
-
107
- @Field({ nullable: true })
108
- limit: number
109
- }
110
-
111
- @InputType()
112
- export class BuildingInspectionsOfBuildingLevel {
113
- @Field({ nullable: false })
114
- buildingLevelId: string
115
-
116
- @Field({ nullable: true })
117
- limit: number
118
- }
119
-
120
- @ObjectType()
121
- export class BuildingInspectionSummary {
122
- @Field(type => String, { nullable: true, description: '요청일자' })
123
- requestDate?: string
124
-
125
- @Field(type => Int, { description: '검측 대기 수' })
126
- wait: number
127
-
128
- @Field(type => Int, { description: '검측 요청 수' })
129
- request: number
130
-
131
- @Field(type => Int, { description: '검측 통과 수' })
132
- pass: number
133
-
134
- @Field(type => Int, { description: '검측 실패 수' })
135
- fail: number
136
- }
137
-
138
- @ObjectType()
139
- export class BuildingInspectionList {
140
- @Field(type => [BuildingInspection])
141
- items: BuildingInspection[]
142
-
143
- @Field(type => Int)
144
- total: number
145
- }
@@ -1,108 +0,0 @@
1
- import {
2
- CreateDateColumn,
3
- UpdateDateColumn,
4
- DeleteDateColumn,
5
- Entity,
6
- Index,
7
- Column,
8
- RelationId,
9
- ManyToOne,
10
- OneToOne,
11
- PrimaryGeneratedColumn,
12
- JoinColumn
13
- } from 'typeorm'
14
- import { ObjectType, Field, ID, registerEnumType } from 'type-graphql'
15
- import { User } from '@things-factory/auth-base'
16
- import { BuildingLevel } from '@dssp/building-complex'
17
- import { Checklist } from '../checklist/checklist'
18
-
19
- export enum BuildingInspectionStatus {
20
- WAIT = 'WAIT',
21
- OVERALL_WAIT = 'OVERALL_WAIT',
22
- REQUEST = 'REQUEST',
23
- OVERALL_REQUEST = 'OVERALL_REQUEST',
24
- PASS = 'PASS',
25
- FAIL = 'FAIL'
26
- }
27
-
28
- registerEnumType(BuildingInspectionStatus, {
29
- name: 'BuildingInspectionStatus',
30
- description: '검측 상태'
31
- })
32
-
33
- @Entity({ comment: '시공 검측 (층별 도면의 검측 리스트)' })
34
- @Index('ix_building_inspection_0', (buildingInspection: BuildingInspection) => [buildingInspection.buildingLevel], {
35
- where: '"deleted_at" IS NULL'
36
- })
37
- @Index('ix_building_inspection_1', (buildingInspection: BuildingInspection) => [buildingInspection.checklist], {
38
- where: '"deleted_at" IS NULL'
39
- })
40
- @Index('ix_building_inspection_2', (buildingInspection: BuildingInspection) => [buildingInspection.requestDate], {
41
- where: '"deleted_at" IS NULL'
42
- })
43
- @ObjectType()
44
- export class BuildingInspection {
45
- @PrimaryGeneratedColumn('uuid')
46
- @Field(type => ID)
47
- readonly id: string
48
-
49
- @Column({
50
- nullable: false,
51
- comment:
52
- '상태(WAIT: 검측 대기, OVERALL_WAIT: 총괄자 검측 대기, REQUEST: 검측 요청, OVERALL_REQUEST: 총괄자 검측 요청, PASS: 합격, FAIL: 불합격)',
53
- default: BuildingInspectionStatus.WAIT
54
- })
55
- @Field({ nullable: true })
56
- status?: BuildingInspectionStatus
57
-
58
- @Column({ type: 'date', default: () => 'CURRENT_DATE', nullable: true, comment: '검측 요청일' })
59
- @Field(type => String, { nullable: true })
60
- requestDate?: string
61
-
62
- @Column({ type: 'simple-json', nullable: true, comment: '도면 마커' })
63
- @Field(type => String, { nullable: true })
64
- drawingMarker?: string
65
-
66
- // 층 정보 (1:1 상위 테이블 참조)
67
- @ManyToOne(type => BuildingLevel)
68
- @Field(() => BuildingLevel, { nullable: true })
69
- buildingLevel?: BuildingLevel
70
-
71
- @RelationId((buildingInspection: BuildingInspection) => buildingInspection.buildingLevel)
72
- buildingLevelId?: string
73
-
74
- // 체크리스트 (1:1 상위 테이블 참조)
75
- @OneToOne(type => Checklist)
76
- @JoinColumn()
77
- @Field(() => Checklist, { nullable: true })
78
- checklist?: Checklist
79
-
80
- @RelationId((buildingInspection: BuildingInspection) => buildingInspection.checklist)
81
- checklistId?: string
82
-
83
- @CreateDateColumn()
84
- @Field({ nullable: true })
85
- createdAt?: Date
86
-
87
- @UpdateDateColumn()
88
- @Field({ nullable: true })
89
- updatedAt?: Date
90
-
91
- @DeleteDateColumn()
92
- @Field({ nullable: true })
93
- deletedAt?: Date
94
-
95
- @ManyToOne(type => User, { nullable: true })
96
- @Field(type => User, { nullable: true })
97
- creator?: User
98
-
99
- @RelationId((buildingInspection: BuildingInspection) => buildingInspection.creator)
100
- creatorId?: string
101
-
102
- @ManyToOne(type => User, { nullable: true })
103
- @Field(type => User, { nullable: true })
104
- updater?: User
105
-
106
- @RelationId((buildingInspection: BuildingInspection) => buildingInspection.updater)
107
- updaterId?: string
108
- }
@@ -1,20 +0,0 @@
1
- import { EventSubscriber } from 'typeorm'
2
-
3
- import { HistoryEntitySubscriber } from '@operato/typeorm-history'
4
-
5
- import { BuildingInspection } from './building-inspection'
6
- import { BuildingInspectionHistory } from './building-inspection-history'
7
-
8
- @EventSubscriber()
9
- export class BuildingInspectionHistoryEntitySubscriber extends HistoryEntitySubscriber<
10
- BuildingInspection,
11
- BuildingInspectionHistory
12
- > {
13
- public get entity() {
14
- return BuildingInspection
15
- }
16
-
17
- public get historyEntity() {
18
- return BuildingInspectionHistory
19
- }
20
- }
@@ -1,11 +0,0 @@
1
- import { BuildingInspection, BuildingInspectionStatus } from './building-inspection'
2
- import { BuildingInspectionQuery } from './building-inspection-query'
3
- import { BuildingInspectionMutation } from './building-inspection-mutation'
4
- import { BuildingInspectionSummary } from './building-inspection-type'
5
- import { BuildingInspectionHistory } from './building-inspection-history'
6
- import { BuildingInspectionHistoryEntitySubscriber } from './event-subscriber'
7
-
8
- export const entities = [BuildingInspection, BuildingInspectionHistory]
9
- export const resolvers = [BuildingInspectionQuery, BuildingInspectionMutation]
10
- export const subscribers = [BuildingInspectionHistoryEntitySubscriber]
11
- export const types = [BuildingInspectionStatus, BuildingInspectionSummary]
@@ -1,96 +0,0 @@
1
- import { Field, ID, ObjectType } from 'type-graphql'
2
- import { Column, Entity, Index, ManyToOne, PrimaryGeneratedColumn, RelationId } from 'typeorm'
3
- import { HistoryActionColumn, HistoryActionType, HistoryEntityInterface, HistoryOriginalIdColumn } from '@operato/typeorm-history'
4
- import { User } from '@things-factory/auth-base'
5
- import { config } from '@things-factory/env'
6
- import { Checklist } from './checklist'
7
-
8
- const ORMCONFIG = config.get('ormconfig', {})
9
- const DATABASE_TYPE = ORMCONFIG.type
10
-
11
- @Entity()
12
- @Index('ix_checklist_history_0', (checklistHistory: ChecklistHistory) => [checklistHistory.originalId])
13
- @ObjectType({ description: 'History Entity of Checklist' })
14
- export class ChecklistHistory implements HistoryEntityInterface<Checklist> {
15
- @PrimaryGeneratedColumn('uuid')
16
- @Field(type => ID)
17
- readonly id: string
18
-
19
- @Column({ nullable: true, comment: '이름' })
20
- @Field({ nullable: true })
21
- name?: string
22
-
23
- @Column({ nullable: true, comment: '문서 번호 동(4자리)-층(3자리)-시퀀스(6자리)' })
24
- @Field({ nullable: true })
25
- documentNo?: string
26
-
27
- @Column({ nullable: false, comment: '공종' })
28
- @Field({ nullable: true })
29
- constructionType?: string
30
-
31
- @Column({ nullable: false, comment: '세부 공종' })
32
- @Field({ nullable: true })
33
- constructionDetailType?: string
34
-
35
- @Column({ nullable: false, comment: '위치 (x동 x층)' })
36
- @Field({ nullable: true })
37
- location?: string
38
-
39
- @Column({ nullable: false, comment: '검측 도면 타입', default: '' })
40
- @Field({ nullable: true })
41
- inspectionDrawingType?: string
42
-
43
- @Column('simple-array', { nullable: true, comment: '검측 부위' })
44
- @Field(() => [String], { nullable: true })
45
- inspectionParts?: string[]
46
-
47
- @Column({ nullable: true, comment: '시공자 점검일' })
48
- @Field({ nullable: true })
49
- constructionInspectionDate?: Date
50
-
51
- @Column({ nullable: true, comment: '감리자 점검일' })
52
- @Field({ nullable: true })
53
- supervisorInspectionDate?: Date
54
-
55
- @Column({ nullable: true, comment: '총괄 시공 책임자 사인' })
56
- @Field({ nullable: true })
57
- overallConstructorSignature?: string
58
-
59
- @Column({ nullable: true, comment: '공종별 시공 관리자 사인' })
60
- @Field({ nullable: true })
61
- taskConstructorSignature?: string
62
-
63
- @Column({ nullable: true, comment: '총괄 감리 책임자 사인' })
64
- @Field({ nullable: true })
65
- overallSupervisorySignature?: string
66
-
67
- @Column({ nullable: true, comment: '건축사보 (공종별 감리 관리자) 사인' })
68
- @Field({ nullable: true })
69
- taskSupervisorySignature?: string
70
-
71
- @Column({ nullable: true })
72
- @Field({ nullable: true })
73
- createdAt?: Date
74
-
75
- @ManyToOne(type => User, { nullable: true })
76
- @Field(type => User, { nullable: true })
77
- creator?: User
78
-
79
- @RelationId((checklistHistory: ChecklistHistory) => checklistHistory.creator)
80
- creatorId?: string
81
-
82
- @HistoryOriginalIdColumn()
83
- public originalId!: string
84
-
85
- @HistoryActionColumn({
86
- nullable: false,
87
- type:
88
- DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
89
- ? 'enum'
90
- : DATABASE_TYPE == 'oracle'
91
- ? 'varchar2'
92
- : 'smallint',
93
- enum: HistoryActionType
94
- })
95
- public action!: HistoryActionType
96
- }