@dssp/supervision 1.0.0-alpha.0 → 1.0.0-alpha.14
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.
- package/dist-client/pages/action-plan/action-plan-importer.js.map +1 -1
- package/dist-client/pages/action-plan/action-plan-list-page.js.map +1 -1
- package/dist-client/pages/building-inspection/building-inspection-detail-camera.js.map +1 -1
- package/dist-client/pages/building-inspection/building-inspection-detail-checklist.js +1 -1
- package/dist-client/pages/building-inspection/building-inspection-detail-checklist.js.map +1 -1
- package/dist-client/pages/building-inspection/building-inspection-detail-drawing.d.ts +0 -1
- package/dist-client/pages/building-inspection/building-inspection-detail-drawing.js +16 -11
- package/dist-client/pages/building-inspection/building-inspection-detail-drawing.js.map +1 -1
- package/dist-client/pages/building-inspection/building-inspection-list.d.ts +2 -2
- package/dist-client/pages/building-inspection/building-inspection-list.js +2 -1
- package/dist-client/pages/building-inspection/building-inspection-list.js.map +1 -1
- package/dist-client/pages/building-inspection/component/building-inspection-detail-header.js.map +1 -1
- package/dist-client/pages/building-inspection/component/inspection-event-provider.js +3 -3
- package/dist-client/pages/building-inspection/component/inspection-event-provider.js.map +1 -1
- package/dist-client/pages/building-inspection/inspection-create-popup.js +8 -5
- package/dist-client/pages/building-inspection/inspection-create-popup.js.map +1 -1
- package/dist-client/pages/building-inspection-grid/building-inspection-grid-detail.d.ts +46 -0
- package/dist-client/pages/building-inspection-grid/building-inspection-grid-detail.js +930 -0
- package/dist-client/pages/building-inspection-grid/building-inspection-grid-detail.js.map +1 -0
- package/dist-client/pages/building-inspection-grid/component/grid-inspection-create-popup.d.ts +2 -0
- package/dist-client/pages/building-inspection-grid/component/grid-inspection-create-popup.js +736 -0
- package/dist-client/pages/building-inspection-grid/component/grid-inspection-create-popup.js.map +1 -0
- package/dist-client/pages/building-inspection-grid/component/notice-comment-popup.d.ts +1 -0
- package/dist-client/pages/building-inspection-grid/component/notice-comment-popup.js +304 -0
- package/dist-client/pages/building-inspection-grid/component/notice-comment-popup.js.map +1 -0
- package/dist-client/pages/building-inspection-grid/component/plan-preview-popup.d.ts +15 -0
- package/dist-client/pages/building-inspection-grid/component/plan-preview-popup.js +430 -0
- package/dist-client/pages/building-inspection-grid/component/plan-preview-popup.js.map +1 -0
- package/dist-client/pages/checklist/attachment-list-popup.js.map +1 -1
- package/dist-client/pages/checklist/checklist-view.d.ts +6 -0
- package/dist-client/pages/checklist/checklist-view.js +291 -185
- package/dist-client/pages/checklist/checklist-view.js.map +1 -1
- package/dist-client/pages/checklist/comment-list-popup.js.map +1 -1
- package/dist-client/pages/checklist/file-preview-popup.js.map +1 -1
- package/dist-client/pages/checklist-template/checklist-template-item.js +8 -3
- package/dist-client/pages/checklist-template/checklist-template-item.js.map +1 -1
- package/dist-client/pages/checklist-template/checklist-template-list.js +1 -1
- package/dist-client/pages/checklist-template/checklist-template-list.js.map +1 -1
- package/dist-client/pages/checklist-template/checklist-type-management.d.ts +2 -2
- package/dist-client/pages/checklist-template/checklist-type-management.js.map +1 -1
- package/dist-client/pages/issue/issue-importer.js.map +1 -1
- package/dist-client/pages/issue/issue-list-page.js.map +1 -1
- package/dist-client/pages/project-report/project-report-importer.js.map +1 -1
- package/dist-client/pages/project-report/project-report-list-page.js.map +1 -1
- package/dist-client/pages/supervisor/supervisor-importer.js.map +1 -1
- package/dist-client/pages/supervisor/supervisor-list-page.js.map +1 -1
- package/dist-client/route.d.ts +1 -1
- package/dist-client/route.js +3 -0
- package/dist-client/route.js.map +1 -1
- package/dist-client/stt/speech-to-text.d.ts +36 -0
- package/dist-client/stt/speech-to-text.js +89 -0
- package/dist-client/stt/speech-to-text.js.map +1 -0
- package/dist-client/stt/stt-utils.d.ts +28 -0
- package/dist-client/stt/stt-utils.js +146 -0
- package/dist-client/stt/stt-utils.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/middlewares/index.js +1 -2
- package/dist-server/middlewares/index.js.map +1 -1
- package/dist-server/service/action-plan/action-plan-mutation.js +2 -2
- package/dist-server/service/action-plan/action-plan-mutation.js.map +1 -1
- package/dist-server/service/action-plan/action-plan-query.js +2 -2
- package/dist-server/service/action-plan/action-plan-query.js.map +1 -1
- package/dist-server/service/action-plan/action-plan-type.js +6 -6
- package/dist-server/service/action-plan/action-plan-type.js.map +1 -1
- package/dist-server/service/action-plan/action-plan.js +3 -3
- package/dist-server/service/action-plan/action-plan.js.map +1 -1
- package/dist-server/service/action-plan/index.d.ts +0 -1
- package/dist-server/service/action-plan/index.js +1 -2
- package/dist-server/service/action-plan/index.js.map +1 -1
- package/dist-server/service/building-inspection/building-inspection-history.js +2 -2
- package/dist-server/service/building-inspection/building-inspection-history.js.map +1 -1
- package/dist-server/service/building-inspection/building-inspection-mutation.d.ts +1 -0
- package/dist-server/service/building-inspection/building-inspection-mutation.js +91 -14
- package/dist-server/service/building-inspection/building-inspection-mutation.js.map +1 -1
- package/dist-server/service/building-inspection/building-inspection-query.d.ts +2 -1
- package/dist-server/service/building-inspection/building-inspection-query.js +33 -4
- package/dist-server/service/building-inspection/building-inspection-query.js.map +1 -1
- package/dist-server/service/building-inspection/building-inspection-type.d.ts +10 -3
- package/dist-server/service/building-inspection/building-inspection-type.js +45 -20
- package/dist-server/service/building-inspection/building-inspection-type.js.map +1 -1
- package/dist-server/service/building-inspection/building-inspection.d.ts +9 -0
- package/dist-server/service/building-inspection/building-inspection.js +43 -5
- package/dist-server/service/building-inspection/building-inspection.js.map +1 -1
- package/dist-server/service/building-inspection/index.d.ts +2 -4
- package/dist-server/service/building-inspection/index.js +2 -4
- package/dist-server/service/building-inspection/index.js.map +1 -1
- package/dist-server/service/checklist/checklist-history.d.ts +8 -0
- package/dist-server/service/checklist/checklist-history.js +38 -2
- package/dist-server/service/checklist/checklist-history.js.map +1 -1
- package/dist-server/service/checklist/checklist-mutation.js +2 -2
- package/dist-server/service/checklist/checklist-mutation.js.map +1 -1
- package/dist-server/service/checklist/checklist-query.js +2 -2
- package/dist-server/service/checklist/checklist-query.js.map +1 -1
- package/dist-server/service/checklist/checklist-type.js +6 -6
- package/dist-server/service/checklist/checklist-type.js.map +1 -1
- package/dist-server/service/checklist/checklist.d.ts +19 -1
- package/dist-server/service/checklist/checklist.js +78 -7
- package/dist-server/service/checklist/checklist.js.map +1 -1
- package/dist-server/service/checklist/index.d.ts +0 -2
- package/dist-server/service/checklist/index.js +1 -3
- package/dist-server/service/checklist/index.js.map +1 -1
- package/dist-server/service/checklist-item/checklist-item-mutation.js +2 -2
- package/dist-server/service/checklist-item/checklist-item-mutation.js.map +1 -1
- package/dist-server/service/checklist-item/checklist-item-query.js +2 -2
- package/dist-server/service/checklist-item/checklist-item-query.js.map +1 -1
- package/dist-server/service/checklist-item/checklist-item-type.js +2 -2
- package/dist-server/service/checklist-item/checklist-item-type.js.map +1 -1
- package/dist-server/service/checklist-item/checklist-item.js +3 -3
- package/dist-server/service/checklist-item/checklist-item.js.map +1 -1
- package/dist-server/service/checklist-item-comment/checklist-item-comment-history.js +2 -2
- package/dist-server/service/checklist-item-comment/checklist-item-comment-history.js.map +1 -1
- package/dist-server/service/checklist-item-comment/checklist-item-comment-mutation.js +2 -2
- package/dist-server/service/checklist-item-comment/checklist-item-comment-mutation.js.map +1 -1
- package/dist-server/service/checklist-item-comment/checklist-item-comment-query.js +2 -2
- package/dist-server/service/checklist-item-comment/checklist-item-comment-query.js.map +1 -1
- package/dist-server/service/checklist-item-comment/checklist-item-comment-type.js +6 -6
- package/dist-server/service/checklist-item-comment/checklist-item-comment-type.js.map +1 -1
- package/dist-server/service/checklist-item-comment/checklist-item-comment.js +2 -2
- package/dist-server/service/checklist-item-comment/checklist-item-comment.js.map +1 -1
- package/dist-server/service/checklist-item-comment/index.d.ts +0 -2
- package/dist-server/service/checklist-item-comment/index.js +1 -3
- package/dist-server/service/checklist-item-comment/index.js.map +1 -1
- package/dist-server/service/checklist-template/checklist-template-mutation.js +2 -2
- package/dist-server/service/checklist-template/checklist-template-mutation.js.map +1 -1
- package/dist-server/service/checklist-template/checklist-template-query.js +2 -2
- package/dist-server/service/checklist-template/checklist-template-query.js.map +1 -1
- package/dist-server/service/checklist-template/checklist-template-type.js +4 -4
- package/dist-server/service/checklist-template/checklist-template-type.js.map +1 -1
- package/dist-server/service/checklist-template/checklist-template.js +2 -2
- package/dist-server/service/checklist-template/checklist-template.js.map +1 -1
- package/dist-server/service/checklist-template-item/checklist-template-item-mutation.js +2 -2
- package/dist-server/service/checklist-template-item/checklist-template-item-mutation.js.map +1 -1
- package/dist-server/service/checklist-template-item/checklist-template-item-query.js +2 -2
- package/dist-server/service/checklist-template-item/checklist-template-item-query.js.map +1 -1
- package/dist-server/service/checklist-template-item/checklist-template-item-type.js +4 -4
- package/dist-server/service/checklist-template-item/checklist-template-item-type.js.map +1 -1
- package/dist-server/service/checklist-template-item/checklist-template-item.js +4 -6
- package/dist-server/service/checklist-template-item/checklist-template-item.js.map +1 -1
- package/dist-server/service/checklist-type/checklist-type-mutation.js +2 -2
- package/dist-server/service/checklist-type/checklist-type-mutation.js.map +1 -1
- package/dist-server/service/checklist-type/checklist-type-query.js +2 -2
- package/dist-server/service/checklist-type/checklist-type-query.js.map +1 -1
- package/dist-server/service/checklist-type/checklist-type-type.js +4 -4
- package/dist-server/service/checklist-type/checklist-type-type.js.map +1 -1
- package/dist-server/service/checklist-type/checklist-type.js +3 -3
- package/dist-server/service/checklist-type/checklist-type.js.map +1 -1
- package/dist-server/service/index.d.ts +0 -1
- package/dist-server/service/index.js +1 -11
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/issue/index.d.ts +0 -1
- package/dist-server/service/issue/index.js +1 -2
- package/dist-server/service/issue/index.js.map +1 -1
- package/dist-server/service/issue/issue-mutation.js +2 -2
- package/dist-server/service/issue/issue-mutation.js.map +1 -1
- package/dist-server/service/issue/issue-query.js +2 -2
- package/dist-server/service/issue/issue-query.js.map +1 -1
- package/dist-server/service/issue/issue-type.js +6 -6
- package/dist-server/service/issue/issue-type.js.map +1 -1
- package/dist-server/service/issue/issue.js +3 -3
- package/dist-server/service/issue/issue.js.map +1 -1
- package/dist-server/service/project-report/index.d.ts +0 -1
- package/dist-server/service/project-report/index.js +1 -2
- package/dist-server/service/project-report/index.js.map +1 -1
- package/dist-server/service/project-report/project-report-mutation.js +2 -2
- package/dist-server/service/project-report/project-report-mutation.js.map +1 -1
- package/dist-server/service/project-report/project-report-query.js +2 -2
- package/dist-server/service/project-report/project-report-query.js.map +1 -1
- package/dist-server/service/project-report/project-report-type.js +6 -6
- package/dist-server/service/project-report/project-report-type.js.map +1 -1
- package/dist-server/service/project-report/project-report.js +3 -3
- package/dist-server/service/project-report/project-report.js.map +1 -1
- package/dist-server/service/supervisor/index.d.ts +0 -1
- package/dist-server/service/supervisor/index.js +1 -2
- package/dist-server/service/supervisor/index.js.map +1 -1
- package/dist-server/service/supervisor/supervisor-mutation.js +2 -2
- package/dist-server/service/supervisor/supervisor-mutation.js.map +1 -1
- package/dist-server/service/supervisor/supervisor-query.js +2 -2
- package/dist-server/service/supervisor/supervisor-query.js.map +1 -1
- package/dist-server/service/supervisor/supervisor-type.js +6 -6
- package/dist-server/service/supervisor/supervisor-type.js.map +1 -1
- package/dist-server/service/supervisor/supervisor.js +3 -3
- package/dist-server/service/supervisor/supervisor.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -13
- package/things-factory.config.js +3 -1
- package/client/bootstrap.ts +0 -1
- package/client/index.ts +0 -0
- package/client/pages/action-plan/action-plan-importer.ts +0 -94
- package/client/pages/action-plan/action-plan-list-page.ts +0 -340
- package/client/pages/building-inspection/building-inspection-detail-camera.ts +0 -277
- package/client/pages/building-inspection/building-inspection-detail-checklist.ts +0 -258
- package/client/pages/building-inspection/building-inspection-detail-drawing.ts +0 -288
- package/client/pages/building-inspection/building-inspection-list.ts +0 -565
- package/client/pages/building-inspection/component/building-inspection-detail-header.ts +0 -123
- package/client/pages/building-inspection/component/inspection-event-provider.ts +0 -81
- package/client/pages/building-inspection/inspection-create-popup.ts +0 -785
- package/client/pages/checklist/attachment-list-popup.ts +0 -301
- package/client/pages/checklist/checklist-view.ts +0 -581
- package/client/pages/checklist/comment-list-popup.ts +0 -328
- package/client/pages/checklist/file-preview-popup.ts +0 -70
- package/client/pages/checklist-template/checklist-template-item.ts +0 -240
- package/client/pages/checklist-template/checklist-template-list.ts +0 -368
- package/client/pages/checklist-template/checklist-type-management.ts +0 -262
- package/client/pages/issue/issue-importer.ts +0 -94
- package/client/pages/issue/issue-list-page.ts +0 -340
- package/client/pages/project-report/project-report-importer.ts +0 -94
- package/client/pages/project-report/project-report-list-page.ts +0 -340
- package/client/pages/supervisor/supervisor-importer.ts +0 -94
- package/client/pages/supervisor/supervisor-list-page.ts +0 -340
- package/client/route.ts +0 -27
- package/client/tsconfig.json +0 -11
- package/dist-server/service/building-inspection/event-subscriber.d.ts +0 -7
- package/dist-server/service/building-inspection/event-subscriber.js +0 -21
- package/dist-server/service/building-inspection/event-subscriber.js.map +0 -1
- package/dist-server/service/checklist/event-subscriber.d.ts +0 -7
- package/dist-server/service/checklist/event-subscriber.js +0 -21
- package/dist-server/service/checklist/event-subscriber.js.map +0 -1
- package/dist-server/service/checklist-item-comment/event-subscriber.d.ts +0 -7
- package/dist-server/service/checklist-item-comment/event-subscriber.js +0 -21
- package/dist-server/service/checklist-item-comment/event-subscriber.js.map +0 -1
- package/server/controllers/index.ts +0 -0
- package/server/index.ts +0 -4
- package/server/middlewares/index.ts +0 -3
- package/server/migrations/index.ts +0 -9
- package/server/routes.ts +0 -28
- package/server/service/action-plan/action-plan-mutation.ts +0 -198
- package/server/service/action-plan/action-plan-query.ts +0 -62
- package/server/service/action-plan/action-plan-type.ts +0 -61
- package/server/service/action-plan/action-plan.ts +0 -103
- package/server/service/action-plan/index.ts +0 -7
- package/server/service/building-inspection/building-inspection-history.ts +0 -72
- package/server/service/building-inspection/building-inspection-mutation.ts +0 -276
- package/server/service/building-inspection/building-inspection-query.ts +0 -242
- package/server/service/building-inspection/building-inspection-type.ts +0 -145
- package/server/service/building-inspection/building-inspection.ts +0 -108
- package/server/service/building-inspection/event-subscriber.ts +0 -20
- package/server/service/building-inspection/index.ts +0 -11
- package/server/service/checklist/checklist-history.ts +0 -96
- package/server/service/checklist/checklist-mutation.ts +0 -103
- package/server/service/checklist/checklist-query.ts +0 -58
- package/server/service/checklist/checklist-type.ts +0 -49
- package/server/service/checklist/checklist.ts +0 -127
- package/server/service/checklist/event-subscriber.ts +0 -17
- package/server/service/checklist/index.ts +0 -9
- package/server/service/checklist-item/checklist-item-mutation.ts +0 -5
- package/server/service/checklist-item/checklist-item-query.ts +0 -84
- package/server/service/checklist-item/checklist-item-type.ts +0 -12
- package/server/service/checklist-item/checklist-item.ts +0 -103
- package/server/service/checklist-item/index.ts +0 -7
- package/server/service/checklist-item-comment/checklist-item-comment-history.ts +0 -69
- package/server/service/checklist-item-comment/checklist-item-comment-mutation.ts +0 -80
- package/server/service/checklist-item-comment/checklist-item-comment-query.ts +0 -36
- package/server/service/checklist-item-comment/checklist-item-comment-type.ts +0 -32
- package/server/service/checklist-item-comment/checklist-item-comment.ts +0 -56
- package/server/service/checklist-item-comment/event-subscriber.ts +0 -17
- package/server/service/checklist-item-comment/index.ts +0 -9
- package/server/service/checklist-template/checklist-template-mutation.ts +0 -66
- package/server/service/checklist-template/checklist-template-query.ts +0 -39
- package/server/service/checklist-template/checklist-template-type.ts +0 -23
- package/server/service/checklist-template/checklist-template.ts +0 -71
- package/server/service/checklist-template/index.ts +0 -6
- package/server/service/checklist-template-item/checklist-template-item-mutation.ts +0 -64
- package/server/service/checklist-template-item/checklist-template-item-query.ts +0 -44
- package/server/service/checklist-template-item/checklist-template-item-type.ts +0 -39
- package/server/service/checklist-template-item/checklist-template-item.ts +0 -68
- package/server/service/checklist-template-item/index.ts +0 -6
- package/server/service/checklist-type/checklist-type-mutation.ts +0 -66
- package/server/service/checklist-type/checklist-type-query.ts +0 -39
- package/server/service/checklist-type/checklist-type-type.ts +0 -26
- package/server/service/checklist-type/checklist-type.ts +0 -64
- package/server/service/checklist-type/index.ts +0 -6
- package/server/service/index.ts +0 -88
- package/server/service/issue/index.ts +0 -7
- package/server/service/issue/issue-mutation.ts +0 -198
- package/server/service/issue/issue-query.ts +0 -62
- package/server/service/issue/issue-type.ts +0 -61
- package/server/service/issue/issue.ts +0 -100
- package/server/service/project-report/index.ts +0 -7
- package/server/service/project-report/project-report-mutation.ts +0 -198
- package/server/service/project-report/project-report-query.ts +0 -62
- package/server/service/project-report/project-report-type.ts +0 -61
- package/server/service/project-report/project-report.ts +0 -113
- package/server/service/supervisor/index.ts +0 -7
- package/server/service/supervisor/supervisor-mutation.ts +0 -198
- package/server/service/supervisor/supervisor-query.ts +0 -62
- package/server/service/supervisor/supervisor-type.ts +0 -61
- package/server/service/supervisor/supervisor.ts +0 -108
- package/server/tsconfig.json +0 -10
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx } from 'type-graphql'
|
|
2
|
-
import { Attachment } from '@things-factory/attachment-base'
|
|
3
|
-
import { getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
|
|
4
|
-
import { User } from '@things-factory/auth-base'
|
|
5
|
-
import { ChecklistItem } from './checklist-item'
|
|
6
|
-
import { ChecklistItemList } from './checklist-item-type'
|
|
7
|
-
import { ChecklistItemComment } from '../checklist-item-comment/checklist-item-comment'
|
|
8
|
-
import { BuildingInspection } from '../building-inspection/building-inspection'
|
|
9
|
-
|
|
10
|
-
@Resolver(ChecklistItem)
|
|
11
|
-
export class ChecklistItemQuery {
|
|
12
|
-
@Query(returns => ChecklistItem!, { nullable: true, description: 'To fetch a ChecklistItem' })
|
|
13
|
-
async checklistItem(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<ChecklistItem> {
|
|
14
|
-
return await getRepository(ChecklistItem).findOne({
|
|
15
|
-
where: { id }
|
|
16
|
-
})
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
@Query(returns => ChecklistItemList, { description: 'To fetch multiple ChecklistItems' })
|
|
20
|
-
async checklistItems(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<ChecklistItemList> {
|
|
21
|
-
const queryBuilder = getQueryBuilderFromListParams({
|
|
22
|
-
params,
|
|
23
|
-
repository: await getRepository(ChecklistItem),
|
|
24
|
-
searchables: ['name', 'description']
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
const [items, total] = await queryBuilder.getManyAndCount()
|
|
28
|
-
|
|
29
|
-
return { items, total }
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
@Query(returns => BuildingInspection, { description: 'BuildingInspection By ChecklistItemId' })
|
|
33
|
-
async inspectionByChecklistItemId(checklistItemId: string): Promise<BuildingInspection> {
|
|
34
|
-
return getRepository(BuildingInspection)
|
|
35
|
-
.createQueryBuilder('bi')
|
|
36
|
-
.innerJoin('checklists', 'c', 'bi.checklist_id = c.id')
|
|
37
|
-
.innerJoin('checklist_items', 'ci', 'c.id = ci.checklist_id')
|
|
38
|
-
.where('ci.id = :checklistItemId', { checklistItemId })
|
|
39
|
-
.getOne()
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
@FieldResolver(type => [ChecklistItemComment])
|
|
43
|
-
async checklistItemComments(@Root() checklistItem: ChecklistItem): Promise<ChecklistItemComment[]> {
|
|
44
|
-
return await getRepository(ChecklistItemComment).findBy({ checklistItem: { id: checklistItem.id } })
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
@FieldResolver(type => Number)
|
|
48
|
-
async checklistItemCommentCount(@Root() checklistItem: ChecklistItem): Promise<number> {
|
|
49
|
-
return await getRepository(ChecklistItemComment).countBy({ checklistItem: { id: checklistItem.id } })
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
@FieldResolver(type => [Attachment])
|
|
53
|
-
async checklistItemAttachments(@Root() checklistItem: ChecklistItem): Promise<Attachment[]> {
|
|
54
|
-
return await getRepository(Attachment).find({
|
|
55
|
-
where: {
|
|
56
|
-
refType: ChecklistItem.name,
|
|
57
|
-
refBy: checklistItem.id
|
|
58
|
-
},
|
|
59
|
-
order: {
|
|
60
|
-
createdAt: 'DESC'
|
|
61
|
-
}
|
|
62
|
-
})
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
@FieldResolver(type => Number)
|
|
66
|
-
async checklistItemAttachmentCount(@Root() checklistItem: ChecklistItem): Promise<number> {
|
|
67
|
-
return await getRepository(Attachment).count({
|
|
68
|
-
where: {
|
|
69
|
-
refType: ChecklistItem.name,
|
|
70
|
-
refBy: checklistItem.id
|
|
71
|
-
}
|
|
72
|
-
})
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
@FieldResolver(type => User)
|
|
76
|
-
async updater(@Root() checklistItem: ChecklistItem): Promise<User> {
|
|
77
|
-
return await getRepository(User).findOneBy({ id: checklistItem.updaterId })
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
@FieldResolver(type => User)
|
|
81
|
-
async creator(@Root() checklistItem: ChecklistItem): Promise<User> {
|
|
82
|
-
return await getRepository(User).findOneBy({ id: checklistItem.creatorId })
|
|
83
|
-
}
|
|
84
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ObjectType, Field, InputType, Int, ID, registerEnumType } from 'type-graphql'
|
|
2
|
-
|
|
3
|
-
import { ChecklistItem } from './checklist-item'
|
|
4
|
-
|
|
5
|
-
@ObjectType()
|
|
6
|
-
export class ChecklistItemList {
|
|
7
|
-
@Field(type => [ChecklistItem])
|
|
8
|
-
items: ChecklistItem[]
|
|
9
|
-
|
|
10
|
-
@Field(type => Int)
|
|
11
|
-
total: number
|
|
12
|
-
}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CreateDateColumn,
|
|
3
|
-
UpdateDateColumn,
|
|
4
|
-
DeleteDateColumn,
|
|
5
|
-
Entity,
|
|
6
|
-
Index,
|
|
7
|
-
Column,
|
|
8
|
-
RelationId,
|
|
9
|
-
ManyToOne,
|
|
10
|
-
OneToMany,
|
|
11
|
-
PrimaryGeneratedColumn
|
|
12
|
-
} from 'typeorm'
|
|
13
|
-
import { ObjectType, Field, ID, Int, registerEnumType } from 'type-graphql'
|
|
14
|
-
|
|
15
|
-
import { User } from '@things-factory/auth-base'
|
|
16
|
-
import { Checklist } from '../checklist/checklist'
|
|
17
|
-
import { ChecklistItemComment } from '../checklist-item-comment/checklist-item-comment'
|
|
18
|
-
|
|
19
|
-
export enum ChecklistItemConfirmStatus {
|
|
20
|
-
T = '적합',
|
|
21
|
-
F = '부적합'
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
registerEnumType(ChecklistItemConfirmStatus, {
|
|
25
|
-
name: 'ChecklistItemConfirmStatus',
|
|
26
|
-
description: '적합 상태'
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
@Entity({ comment: '체크 리스트 항목' })
|
|
30
|
-
@Index('ix_checklist_item_0', (checklistItem: ChecklistItem) => [checklistItem.checklist], { where: '"deleted_at" IS NULL' })
|
|
31
|
-
@ObjectType()
|
|
32
|
-
export class ChecklistItem {
|
|
33
|
-
@PrimaryGeneratedColumn('uuid')
|
|
34
|
-
@Field(type => ID)
|
|
35
|
-
readonly id: string
|
|
36
|
-
|
|
37
|
-
@Column({ nullable: true, comment: '시퀀스' })
|
|
38
|
-
@Field(type => Int, { nullable: true })
|
|
39
|
-
sequence?: number
|
|
40
|
-
|
|
41
|
-
@Column({ nullable: false, comment: '구분 (텍스트)' })
|
|
42
|
-
@Field({ nullable: false })
|
|
43
|
-
mainType?: string
|
|
44
|
-
|
|
45
|
-
@Column({ nullable: false, comment: '상세 구분 (텍스트)' })
|
|
46
|
-
@Field({ nullable: false })
|
|
47
|
-
detailType?: string
|
|
48
|
-
|
|
49
|
-
@Column({ nullable: true, comment: '검사 항목' })
|
|
50
|
-
@Field({ nullable: true })
|
|
51
|
-
name?: string
|
|
52
|
-
|
|
53
|
-
@Column({ nullable: true, comment: '검사 기준' })
|
|
54
|
-
@Field({ nullable: true })
|
|
55
|
-
inspctionCriteria?: string
|
|
56
|
-
|
|
57
|
-
@Column({ nullable: true, comment: '시공 관리자 적합 여부 (T: 적합, F: 부적합)' })
|
|
58
|
-
@Field({ nullable: true })
|
|
59
|
-
constructionConfirmStatus?: ChecklistItemConfirmStatus
|
|
60
|
-
|
|
61
|
-
@Column({ nullable: true, comment: '감리 관리자 적합 여부 (T: 적합, F: 부적합)' })
|
|
62
|
-
@Field({ nullable: true })
|
|
63
|
-
supervisoryConfirmStatus?: ChecklistItemConfirmStatus
|
|
64
|
-
|
|
65
|
-
// 조치 사항 정보 (하위 테이블 참조)
|
|
66
|
-
@OneToMany(() => ChecklistItemComment, checklistItemComment => checklistItemComment.checklistItem)
|
|
67
|
-
@Field(() => [ChecklistItemComment])
|
|
68
|
-
checklistItemComments?: ChecklistItemComment[]
|
|
69
|
-
|
|
70
|
-
// 체크리스트 정보 (상위 테이블 참조)
|
|
71
|
-
@ManyToOne(type => Checklist)
|
|
72
|
-
@Field(type => Checklist, { nullable: true })
|
|
73
|
-
checklist?: Checklist
|
|
74
|
-
|
|
75
|
-
@RelationId((checklistItem: ChecklistItem) => checklistItem.checklist)
|
|
76
|
-
checklistId?: string
|
|
77
|
-
|
|
78
|
-
@CreateDateColumn()
|
|
79
|
-
@Field({ nullable: true })
|
|
80
|
-
createdAt?: Date
|
|
81
|
-
|
|
82
|
-
@UpdateDateColumn()
|
|
83
|
-
@Field({ nullable: true })
|
|
84
|
-
updatedAt?: Date
|
|
85
|
-
|
|
86
|
-
@DeleteDateColumn()
|
|
87
|
-
@Field({ nullable: true })
|
|
88
|
-
deletedAt?: Date
|
|
89
|
-
|
|
90
|
-
@ManyToOne(type => User, { nullable: true })
|
|
91
|
-
@Field(type => User, { nullable: true })
|
|
92
|
-
creator?: User
|
|
93
|
-
|
|
94
|
-
@RelationId((checklistItem: ChecklistItem) => checklistItem.creator)
|
|
95
|
-
creatorId?: string
|
|
96
|
-
|
|
97
|
-
@ManyToOne(type => User, { nullable: true })
|
|
98
|
-
@Field(type => User, { nullable: true })
|
|
99
|
-
updater?: User
|
|
100
|
-
|
|
101
|
-
@RelationId((checklistItem: ChecklistItem) => checklistItem.updater)
|
|
102
|
-
updaterId?: string
|
|
103
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ChecklistItem } from './checklist-item'
|
|
2
|
-
import { ChecklistItemQuery } from './checklist-item-query'
|
|
3
|
-
import { ChecklistItemMutation } from './checklist-item-mutation'
|
|
4
|
-
|
|
5
|
-
export const entities = [ChecklistItem]
|
|
6
|
-
export const resolvers = [ChecklistItemQuery, ChecklistItemMutation]
|
|
7
|
-
export const subscribers = []
|
|
@@ -1,69 +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 { ChecklistItemComment } from './checklist-item-comment'
|
|
7
|
-
import { ChecklistItem } from '../checklist-item/checklist-item'
|
|
8
|
-
|
|
9
|
-
const ORMCONFIG = config.get('ormconfig', {})
|
|
10
|
-
const DATABASE_TYPE = ORMCONFIG.type
|
|
11
|
-
|
|
12
|
-
@Entity()
|
|
13
|
-
@Index('ix_checklist-item-comment_history_0', (checklistItemCommentHistory: ChecklistItemCommentHistory) => [
|
|
14
|
-
checklistItemCommentHistory.originalId
|
|
15
|
-
])
|
|
16
|
-
@Index('ix_checklist-item-comment_history_1', (checklistItemCommentHistory: ChecklistItemCommentHistory) => [
|
|
17
|
-
checklistItemCommentHistory.checklistItem
|
|
18
|
-
])
|
|
19
|
-
@ObjectType({ description: 'History Entity of ChecklistItemComment' })
|
|
20
|
-
export class ChecklistItemCommentHistory implements HistoryEntityInterface<ChecklistItemComment> {
|
|
21
|
-
@PrimaryGeneratedColumn('uuid')
|
|
22
|
-
@Field(type => ID)
|
|
23
|
-
readonly id: string
|
|
24
|
-
|
|
25
|
-
@Column({ nullable: true, comment: '조치 사항 코멘트' })
|
|
26
|
-
@Field({ nullable: true })
|
|
27
|
-
comment?: string
|
|
28
|
-
|
|
29
|
-
// 체크리스트 아이템 정보 (상위 테이블 참조)
|
|
30
|
-
@ManyToOne(type => ChecklistItem)
|
|
31
|
-
@Field(type => ChecklistItem, { nullable: true })
|
|
32
|
-
checklistItem?: ChecklistItem
|
|
33
|
-
|
|
34
|
-
@RelationId((checklistItemComment: ChecklistItemComment) => checklistItemComment.checklistItem)
|
|
35
|
-
checklistItemId?: string
|
|
36
|
-
|
|
37
|
-
@Column({ nullable: true })
|
|
38
|
-
@Field({ nullable: true })
|
|
39
|
-
createdAt?: Date
|
|
40
|
-
|
|
41
|
-
@Column({ nullable: true })
|
|
42
|
-
@Field({ nullable: true })
|
|
43
|
-
deletedAt?: Date
|
|
44
|
-
|
|
45
|
-
@ManyToOne(type => User, { nullable: true })
|
|
46
|
-
@Field(type => User, { nullable: true })
|
|
47
|
-
creator?: User
|
|
48
|
-
|
|
49
|
-
@RelationId((checklistItemComment: ChecklistItemComment) => checklistItemComment.creator)
|
|
50
|
-
creatorId?: string
|
|
51
|
-
|
|
52
|
-
@HistoryOriginalIdColumn()
|
|
53
|
-
public originalId!: string
|
|
54
|
-
|
|
55
|
-
@HistoryActionColumn({
|
|
56
|
-
nullable: false,
|
|
57
|
-
type:
|
|
58
|
-
DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
|
|
59
|
-
? 'enum'
|
|
60
|
-
: DATABASE_TYPE == 'oracle'
|
|
61
|
-
? 'varchar2'
|
|
62
|
-
: DATABASE_TYPE == 'mssql'
|
|
63
|
-
? 'nvarchar'
|
|
64
|
-
: 'varchar',
|
|
65
|
-
enum: DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb' ? HistoryActionType : undefined,
|
|
66
|
-
length: DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb' ? undefined : 32
|
|
67
|
-
})
|
|
68
|
-
public action!: HistoryActionType
|
|
69
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
|
|
2
|
-
import { getRepository } from '@things-factory/shell'
|
|
3
|
-
import { ChecklistItemComment } from './checklist-item-comment'
|
|
4
|
-
import { NewChecklistItemComment, ChecklistItemCommentPatch } from './checklist-item-comment-type'
|
|
5
|
-
import { BuildingInspectionStatus } from '../building-inspection/building-inspection'
|
|
6
|
-
import { ChecklistItemQuery } from '../checklist-item/checklist-item-query'
|
|
7
|
-
|
|
8
|
-
@Resolver(ChecklistItemComment)
|
|
9
|
-
export class ChecklistItemCommentMutation {
|
|
10
|
-
@Directive('@transaction')
|
|
11
|
-
@Mutation(returns => ChecklistItemComment, { description: 'To create new ChecklistItemComment' })
|
|
12
|
-
async createChecklistItemComment(
|
|
13
|
-
@Arg('checklistItemComment') checklistItemComment: NewChecklistItemComment,
|
|
14
|
-
@Ctx() context: ResolverContext
|
|
15
|
-
): Promise<ChecklistItemComment> {
|
|
16
|
-
const { user, tx } = context.state
|
|
17
|
-
const { comment, checklistItemId } = checklistItemComment
|
|
18
|
-
|
|
19
|
-
// 합격 상태인지 체크
|
|
20
|
-
const checklistItemQuery = new ChecklistItemQuery()
|
|
21
|
-
const inspection = await checklistItemQuery.inspectionByChecklistItemId(checklistItemId)
|
|
22
|
-
if (inspection.status === BuildingInspectionStatus.PASS) {
|
|
23
|
-
throw new Error('완료 상태인 검측정보를 변경할 수 없습니다.')
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const result = await getRepository(ChecklistItemComment, tx).save({
|
|
27
|
-
comment,
|
|
28
|
-
checklistItem: { id: checklistItemId },
|
|
29
|
-
createdAt: new Date(),
|
|
30
|
-
creator: user,
|
|
31
|
-
updater: user
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
return result
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
@Directive('@transaction')
|
|
38
|
-
@Mutation(returns => ChecklistItemComment, { description: 'To modify ChecklistItemComment information' })
|
|
39
|
-
async updateChecklistItemComment(
|
|
40
|
-
@Arg('id') id: string,
|
|
41
|
-
@Arg('patch') patch: ChecklistItemCommentPatch,
|
|
42
|
-
@Ctx() context: ResolverContext
|
|
43
|
-
): Promise<ChecklistItemComment> {
|
|
44
|
-
const { user, tx } = context.state
|
|
45
|
-
|
|
46
|
-
const repository = getRepository(ChecklistItemComment, tx)
|
|
47
|
-
const checklistItemComment = await repository.findOne({
|
|
48
|
-
where: { id }
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
const result = await repository.save({
|
|
52
|
-
...checklistItemComment,
|
|
53
|
-
...patch,
|
|
54
|
-
updater: user
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
return result
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
@Directive('@transaction')
|
|
61
|
-
@Mutation(returns => Boolean, { description: 'To delete ChecklistItemComment' })
|
|
62
|
-
async deleteChecklistItemComment(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
|
|
63
|
-
const { tx } = context.state
|
|
64
|
-
const repository = getRepository(ChecklistItemComment, tx)
|
|
65
|
-
const checklistItemComment = await repository.findOne({
|
|
66
|
-
where: { id }
|
|
67
|
-
})
|
|
68
|
-
|
|
69
|
-
// 합격 상태인지 체크
|
|
70
|
-
const checklistItemQuery = new ChecklistItemQuery()
|
|
71
|
-
const inspection = await checklistItemQuery.inspectionByChecklistItemId(checklistItemComment.checklistItemId)
|
|
72
|
-
if (inspection.status === BuildingInspectionStatus.PASS) {
|
|
73
|
-
throw new Error('완료 상태인 검측정보를 변경할 수 없습니다.')
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
await repository.softDelete({ id })
|
|
77
|
-
|
|
78
|
-
return true
|
|
79
|
-
}
|
|
80
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { Resolver, Query, FieldResolver, Root, Arg, Ctx } from 'type-graphql'
|
|
2
|
-
import { getRepository, Pagination } from '@things-factory/shell'
|
|
3
|
-
import { User } from '@things-factory/auth-base'
|
|
4
|
-
import { ChecklistItemComment } from './checklist-item-comment'
|
|
5
|
-
|
|
6
|
-
@Resolver(ChecklistItemComment)
|
|
7
|
-
export class ChecklistItemCommentQuery {
|
|
8
|
-
@Query(returns => [ChecklistItemComment], { description: 'To fetch multiple ChecklistItemComments' })
|
|
9
|
-
async checklistItemComments(
|
|
10
|
-
@Arg('checklistItemId') checklistItemId: string,
|
|
11
|
-
@Arg('pagination') pagination: Pagination,
|
|
12
|
-
@Ctx() context: ResolverContext
|
|
13
|
-
): Promise<ChecklistItemComment[]> {
|
|
14
|
-
const { limit, page } = pagination
|
|
15
|
-
|
|
16
|
-
// 페이지네이션을 위한 offset 계산
|
|
17
|
-
const offset = (page - 1) * limit
|
|
18
|
-
|
|
19
|
-
// 코멘트와 총 개수를 가져오는 쿼리
|
|
20
|
-
const items = await getRepository(ChecklistItemComment)
|
|
21
|
-
.createQueryBuilder('cic')
|
|
22
|
-
.innerJoin('cic.checklistItem', 'ci')
|
|
23
|
-
.where('cic.checklistItem = :checklistItemId', { checklistItemId })
|
|
24
|
-
.skip(offset)
|
|
25
|
-
.take(limit)
|
|
26
|
-
.orderBy('cic.createdAt', 'DESC')
|
|
27
|
-
.getMany()
|
|
28
|
-
|
|
29
|
-
return items
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
@FieldResolver(type => User)
|
|
33
|
-
async creator(@Root() checklistItemComment: ChecklistItemComment): Promise<User> {
|
|
34
|
-
return checklistItemComment.creatorId && (await getRepository(User).findOneBy({ id: checklistItemComment.creatorId }))
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { ObjectType, Field, InputType, Int, ID } from 'type-graphql'
|
|
2
|
-
import { ChecklistItemComment } from './checklist-item-comment'
|
|
3
|
-
|
|
4
|
-
@InputType()
|
|
5
|
-
export class NewChecklistItemComment {
|
|
6
|
-
@Field({ nullable: true })
|
|
7
|
-
comment?: string
|
|
8
|
-
|
|
9
|
-
@Field({ nullable: true })
|
|
10
|
-
checklistItemId?: string
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
@InputType()
|
|
14
|
-
export class ChecklistItemCommentPatch {
|
|
15
|
-
@Field(type => ID, { nullable: true })
|
|
16
|
-
id?: string
|
|
17
|
-
|
|
18
|
-
@Field({ nullable: true })
|
|
19
|
-
comment?: string
|
|
20
|
-
|
|
21
|
-
@Field({ nullable: true })
|
|
22
|
-
checklistItemId?: string
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
@ObjectType()
|
|
26
|
-
export class ChecklistItemCommentList {
|
|
27
|
-
@Field(type => [ChecklistItemComment])
|
|
28
|
-
items: ChecklistItemComment[]
|
|
29
|
-
|
|
30
|
-
@Field(type => Int)
|
|
31
|
-
total: number
|
|
32
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CreateDateColumn,
|
|
3
|
-
UpdateDateColumn,
|
|
4
|
-
DeleteDateColumn,
|
|
5
|
-
Entity,
|
|
6
|
-
Index,
|
|
7
|
-
Column,
|
|
8
|
-
RelationId,
|
|
9
|
-
ManyToOne,
|
|
10
|
-
PrimaryGeneratedColumn
|
|
11
|
-
} from 'typeorm'
|
|
12
|
-
import { ObjectType, Field, ID } from 'type-graphql'
|
|
13
|
-
import { User } from '@things-factory/auth-base'
|
|
14
|
-
import { ChecklistItem } from '../checklist-item/checklist-item'
|
|
15
|
-
|
|
16
|
-
@Entity()
|
|
17
|
-
@Index(
|
|
18
|
-
'ix_checklist_item_comment_0',
|
|
19
|
-
(checklistItemComment: ChecklistItemComment) => [checklistItemComment.checklistItem, checklistItemComment.createdAt],
|
|
20
|
-
{
|
|
21
|
-
where: '"deleted_at" IS NULL'
|
|
22
|
-
}
|
|
23
|
-
)
|
|
24
|
-
@ObjectType({ description: 'Entity for ChecklistItemComment' })
|
|
25
|
-
export class ChecklistItemComment {
|
|
26
|
-
@PrimaryGeneratedColumn('uuid')
|
|
27
|
-
@Field(type => ID)
|
|
28
|
-
readonly id: string
|
|
29
|
-
|
|
30
|
-
@Column({ nullable: true, comment: '조치 사항 코멘트' })
|
|
31
|
-
@Field({ nullable: true })
|
|
32
|
-
comment?: string
|
|
33
|
-
|
|
34
|
-
// 체크리스트 아이템 정보 (상위 테이블 참조)
|
|
35
|
-
@ManyToOne(type => ChecklistItem)
|
|
36
|
-
@Field(type => ChecklistItem, { nullable: true })
|
|
37
|
-
checklistItem?: ChecklistItem
|
|
38
|
-
|
|
39
|
-
@RelationId((checklistItemComment: ChecklistItemComment) => checklistItemComment.checklistItem)
|
|
40
|
-
checklistItemId?: string
|
|
41
|
-
|
|
42
|
-
@CreateDateColumn()
|
|
43
|
-
@Field({ nullable: true })
|
|
44
|
-
createdAt?: Date
|
|
45
|
-
|
|
46
|
-
@DeleteDateColumn()
|
|
47
|
-
@Field({ nullable: true })
|
|
48
|
-
deletedAt?: Date
|
|
49
|
-
|
|
50
|
-
@ManyToOne(type => User, { nullable: true })
|
|
51
|
-
@Field(type => User, { nullable: true })
|
|
52
|
-
creator?: User
|
|
53
|
-
|
|
54
|
-
@RelationId((checklistItemComment: ChecklistItemComment) => checklistItemComment.creator)
|
|
55
|
-
creatorId?: string
|
|
56
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { EventSubscriber } from 'typeorm'
|
|
2
|
-
|
|
3
|
-
import { HistoryEntitySubscriber } from '@operato/typeorm-history'
|
|
4
|
-
|
|
5
|
-
import { ChecklistItemComment } from './checklist-item-comment'
|
|
6
|
-
import { ChecklistItemCommentHistory } from './checklist-item-comment-history'
|
|
7
|
-
|
|
8
|
-
@EventSubscriber()
|
|
9
|
-
export class ChecklistItemCommentHistoryEntitySubscriber extends HistoryEntitySubscriber<ChecklistItemComment, ChecklistItemCommentHistory> {
|
|
10
|
-
public get entity() {
|
|
11
|
-
return ChecklistItemComment
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
public get historyEntity() {
|
|
15
|
-
return ChecklistItemCommentHistory
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ChecklistItemComment } from './checklist-item-comment'
|
|
2
|
-
import { ChecklistItemCommentHistory } from './checklist-item-comment-history'
|
|
3
|
-
import { ChecklistItemCommentHistoryEntitySubscriber } from './event-subscriber'
|
|
4
|
-
import { ChecklistItemCommentQuery } from './checklist-item-comment-query'
|
|
5
|
-
import { ChecklistItemCommentMutation } from './checklist-item-comment-mutation'
|
|
6
|
-
|
|
7
|
-
export const entities = [ChecklistItemComment, ChecklistItemCommentHistory]
|
|
8
|
-
export const resolvers = [ChecklistItemCommentQuery, ChecklistItemCommentMutation]
|
|
9
|
-
export const subscribers = [ChecklistItemCommentHistoryEntitySubscriber]
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
|
|
2
|
-
import { In } from 'typeorm'
|
|
3
|
-
import { ChecklistTemplate } from './checklist-template'
|
|
4
|
-
import { ChecklistTemplatePatch } from './checklist-template-type'
|
|
5
|
-
|
|
6
|
-
@Resolver(ChecklistTemplate)
|
|
7
|
-
export class ChecklistTemplateMutation {
|
|
8
|
-
@Directive('@transaction')
|
|
9
|
-
@Mutation(returns => [ChecklistTemplate], { description: "To modify multiple ChecklistTemplates' information" })
|
|
10
|
-
async updateMultipleChecklistTemplate(
|
|
11
|
-
@Arg('patches', type => [ChecklistTemplatePatch]) patches: ChecklistTemplatePatch[],
|
|
12
|
-
@Ctx() context: ResolverContext
|
|
13
|
-
): Promise<ChecklistTemplate[]> {
|
|
14
|
-
const { domain, user, tx } = context.state
|
|
15
|
-
|
|
16
|
-
let results = []
|
|
17
|
-
const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
|
|
18
|
-
const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
|
|
19
|
-
const checklistTemplateRepo = tx.getRepository(ChecklistTemplate)
|
|
20
|
-
|
|
21
|
-
if (_createRecords.length > 0) {
|
|
22
|
-
for (let i = 0; i < _createRecords.length; i++) {
|
|
23
|
-
const newRecord = _createRecords[i]
|
|
24
|
-
|
|
25
|
-
const result = await checklistTemplateRepo.save({
|
|
26
|
-
...newRecord,
|
|
27
|
-
domain,
|
|
28
|
-
creator: user,
|
|
29
|
-
updater: user
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
results.push({ ...result, cuFlag: '+' })
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (_updateRecords.length > 0) {
|
|
37
|
-
for (let i = 0; i < _updateRecords.length; i++) {
|
|
38
|
-
const updateRecord = _updateRecords[i]
|
|
39
|
-
const checklistTemplate = await checklistTemplateRepo.findOneBy({ id: updateRecord.id })
|
|
40
|
-
|
|
41
|
-
const result = await checklistTemplateRepo.save({
|
|
42
|
-
...checklistTemplate,
|
|
43
|
-
...updateRecord,
|
|
44
|
-
updater: user
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
results.push({ ...result, cuFlag: 'M' })
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return results
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
@Directive('@transaction')
|
|
55
|
-
@Mutation(returns => Boolean, { description: 'To delete multiple ChecklistTemplates' })
|
|
56
|
-
async deleteChecklistTemplates(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<boolean> {
|
|
57
|
-
const { domain, tx } = context.state
|
|
58
|
-
|
|
59
|
-
await tx.getRepository(ChecklistTemplate).delete({
|
|
60
|
-
domain: { id: domain.id },
|
|
61
|
-
id: In(ids)
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
return true
|
|
65
|
-
}
|
|
66
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { Resolver, Query, FieldResolver, Root, Args, Ctx } from 'type-graphql'
|
|
2
|
-
import { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
|
|
3
|
-
import { User } from '@things-factory/auth-base'
|
|
4
|
-
import { ChecklistTemplate } from './checklist-template'
|
|
5
|
-
import { ChecklistTemplateList } from './checklist-template-type'
|
|
6
|
-
|
|
7
|
-
@Resolver(ChecklistTemplate)
|
|
8
|
-
export class ChecklistTemplateQuery {
|
|
9
|
-
@Query(returns => ChecklistTemplateList, { description: 'To fetch multiple ChecklistTemplates' })
|
|
10
|
-
async checklistTemplates(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<ChecklistTemplateList> {
|
|
11
|
-
const { domain } = context.state
|
|
12
|
-
|
|
13
|
-
const queryBuilder = getQueryBuilderFromListParams({
|
|
14
|
-
domain,
|
|
15
|
-
params,
|
|
16
|
-
repository: await getRepository(ChecklistTemplate),
|
|
17
|
-
searchables: ['name']
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
const [items, total] = await queryBuilder.getManyAndCount()
|
|
21
|
-
|
|
22
|
-
return { items, total }
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
@FieldResolver(type => Domain)
|
|
26
|
-
async domain(@Root() checklistTemplate: ChecklistTemplate): Promise<Domain> {
|
|
27
|
-
return await getRepository(Domain).findOneBy({ id: checklistTemplate.domainId })
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
@FieldResolver(type => User)
|
|
31
|
-
async updater(@Root() checklistTemplate: ChecklistTemplate): Promise<User> {
|
|
32
|
-
return await getRepository(User).findOneBy({ id: checklistTemplate.updaterId })
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
@FieldResolver(type => User)
|
|
36
|
-
async creator(@Root() checklistTemplate: ChecklistTemplate): Promise<User> {
|
|
37
|
-
return await getRepository(User).findOneBy({ id: checklistTemplate.creatorId })
|
|
38
|
-
}
|
|
39
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ObjectType, Field, InputType, Int, ID } from 'type-graphql'
|
|
2
|
-
import { ChecklistTemplate } from './checklist-template'
|
|
3
|
-
|
|
4
|
-
@InputType()
|
|
5
|
-
export class ChecklistTemplatePatch {
|
|
6
|
-
@Field(type => ID, { nullable: true })
|
|
7
|
-
id?: string
|
|
8
|
-
|
|
9
|
-
@Field({ nullable: true })
|
|
10
|
-
name?: string
|
|
11
|
-
|
|
12
|
-
@Field({ nullable: true })
|
|
13
|
-
cuFlag?: string
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
@ObjectType()
|
|
17
|
-
export class ChecklistTemplateList {
|
|
18
|
-
@Field(type => [ChecklistTemplate])
|
|
19
|
-
items: ChecklistTemplate[]
|
|
20
|
-
|
|
21
|
-
@Field(type => Int)
|
|
22
|
-
total: number
|
|
23
|
-
}
|