@dssp/supervision 0.0.36 → 1.0.0-alpha.1

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 (106) 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/pages/checklist/checklist-view.js +2 -5
  4. package/dist-client/pages/checklist/checklist-view.js.map +1 -1
  5. package/dist-client/route.d.ts +1 -1
  6. package/dist-client/tsconfig.tsbuildinfo +1 -1
  7. package/dist-server/service/index.d.ts +1 -1
  8. package/dist-server/tsconfig.tsbuildinfo +1 -1
  9. package/package.json +13 -13
  10. package/client/bootstrap.ts +0 -1
  11. package/client/index.ts +0 -0
  12. package/client/pages/action-plan/action-plan-importer.ts +0 -94
  13. package/client/pages/action-plan/action-plan-list-page.ts +0 -340
  14. package/client/pages/building-inspection/building-inspection-detail-camera.ts +0 -277
  15. package/client/pages/building-inspection/building-inspection-detail-checklist.ts +0 -258
  16. package/client/pages/building-inspection/building-inspection-detail-drawing.ts +0 -288
  17. package/client/pages/building-inspection/building-inspection-list.ts +0 -565
  18. package/client/pages/building-inspection/component/building-inspection-detail-header.ts +0 -123
  19. package/client/pages/building-inspection/component/inspection-event-provider.ts +0 -81
  20. package/client/pages/building-inspection/inspection-create-popup.ts +0 -785
  21. package/client/pages/checklist/attachment-list-popup.ts +0 -301
  22. package/client/pages/checklist/checklist-view.ts +0 -581
  23. package/client/pages/checklist/comment-list-popup.ts +0 -328
  24. package/client/pages/checklist/file-preview-popup.ts +0 -70
  25. package/client/pages/checklist-template/checklist-template-item.ts +0 -240
  26. package/client/pages/checklist-template/checklist-template-list.ts +0 -368
  27. package/client/pages/checklist-template/checklist-type-management.ts +0 -262
  28. package/client/pages/issue/issue-importer.ts +0 -94
  29. package/client/pages/issue/issue-list-page.ts +0 -340
  30. package/client/pages/project-report/project-report-importer.ts +0 -94
  31. package/client/pages/project-report/project-report-list-page.ts +0 -340
  32. package/client/pages/supervisor/supervisor-importer.ts +0 -94
  33. package/client/pages/supervisor/supervisor-list-page.ts +0 -340
  34. package/client/route.ts +0 -27
  35. package/client/tsconfig.json +0 -11
  36. package/dist-client/pages/checklist/comment-list-popup copy.d.ts +0 -2
  37. package/dist-client/pages/checklist/comment-list-popup copy.js +0 -344
  38. package/dist-client/pages/checklist/comment-list-popup copy.js.map +0 -1
  39. package/server/controllers/index.ts +0 -0
  40. package/server/index.ts +0 -4
  41. package/server/middlewares/index.ts +0 -3
  42. package/server/migrations/index.ts +0 -9
  43. package/server/routes.ts +0 -28
  44. package/server/service/action-plan/action-plan-mutation.ts +0 -198
  45. package/server/service/action-plan/action-plan-query.ts +0 -62
  46. package/server/service/action-plan/action-plan-type.ts +0 -61
  47. package/server/service/action-plan/action-plan.ts +0 -103
  48. package/server/service/action-plan/index.ts +0 -7
  49. package/server/service/building-inspection/building-inspection-history.ts +0 -72
  50. package/server/service/building-inspection/building-inspection-mutation.ts +0 -276
  51. package/server/service/building-inspection/building-inspection-query.ts +0 -242
  52. package/server/service/building-inspection/building-inspection-type.ts +0 -145
  53. package/server/service/building-inspection/building-inspection.ts +0 -108
  54. package/server/service/building-inspection/event-subscriber.ts +0 -20
  55. package/server/service/building-inspection/index.ts +0 -11
  56. package/server/service/checklist/checklist-history.ts +0 -96
  57. package/server/service/checklist/checklist-mutation.ts +0 -103
  58. package/server/service/checklist/checklist-query.ts +0 -58
  59. package/server/service/checklist/checklist-type.ts +0 -49
  60. package/server/service/checklist/checklist.ts +0 -127
  61. package/server/service/checklist/event-subscriber.ts +0 -17
  62. package/server/service/checklist/index.ts +0 -9
  63. package/server/service/checklist-item/checklist-item-mutation.ts +0 -5
  64. package/server/service/checklist-item/checklist-item-query.ts +0 -84
  65. package/server/service/checklist-item/checklist-item-type.ts +0 -12
  66. package/server/service/checklist-item/checklist-item.ts +0 -103
  67. package/server/service/checklist-item/index.ts +0 -7
  68. package/server/service/checklist-item-comment/checklist-item-comment-history.ts +0 -69
  69. package/server/service/checklist-item-comment/checklist-item-comment-mutation.ts +0 -80
  70. package/server/service/checklist-item-comment/checklist-item-comment-query.ts +0 -36
  71. package/server/service/checklist-item-comment/checklist-item-comment-type.ts +0 -32
  72. package/server/service/checklist-item-comment/checklist-item-comment.ts +0 -56
  73. package/server/service/checklist-item-comment/event-subscriber.ts +0 -17
  74. package/server/service/checklist-item-comment/index.ts +0 -9
  75. package/server/service/checklist-template/checklist-template-mutation.ts +0 -66
  76. package/server/service/checklist-template/checklist-template-query.ts +0 -39
  77. package/server/service/checklist-template/checklist-template-type.ts +0 -23
  78. package/server/service/checklist-template/checklist-template.ts +0 -71
  79. package/server/service/checklist-template/index.ts +0 -6
  80. package/server/service/checklist-template-item/checklist-template-item-mutation.ts +0 -64
  81. package/server/service/checklist-template-item/checklist-template-item-query.ts +0 -44
  82. package/server/service/checklist-template-item/checklist-template-item-type.ts +0 -39
  83. package/server/service/checklist-template-item/checklist-template-item.ts +0 -68
  84. package/server/service/checklist-template-item/index.ts +0 -6
  85. package/server/service/checklist-type/checklist-type-mutation.ts +0 -66
  86. package/server/service/checklist-type/checklist-type-query.ts +0 -39
  87. package/server/service/checklist-type/checklist-type-type.ts +0 -26
  88. package/server/service/checklist-type/checklist-type.ts +0 -64
  89. package/server/service/checklist-type/index.ts +0 -6
  90. package/server/service/index.ts +0 -88
  91. package/server/service/issue/index.ts +0 -7
  92. package/server/service/issue/issue-mutation.ts +0 -198
  93. package/server/service/issue/issue-query.ts +0 -62
  94. package/server/service/issue/issue-type.ts +0 -61
  95. package/server/service/issue/issue.ts +0 -100
  96. package/server/service/project-report/index.ts +0 -7
  97. package/server/service/project-report/project-report-mutation.ts +0 -198
  98. package/server/service/project-report/project-report-query.ts +0 -62
  99. package/server/service/project-report/project-report-type.ts +0 -61
  100. package/server/service/project-report/project-report.ts +0 -113
  101. package/server/service/supervisor/index.ts +0 -7
  102. package/server/service/supervisor/supervisor-mutation.ts +0 -198
  103. package/server/service/supervisor/supervisor-query.ts +0 -62
  104. package/server/service/supervisor/supervisor-type.ts +0 -61
  105. package/server/service/supervisor/supervisor.ts +0 -108
  106. package/server/tsconfig.json +0 -10
@@ -1,198 +0,0 @@
1
- import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
2
- import { In } from 'typeorm'
3
-
4
- import { createAttachment, deleteAttachmentsByRef } from '@things-factory/attachment-base'
5
-
6
- import { Supervisor } from './supervisor'
7
- import { NewSupervisor, SupervisorPatch } from './supervisor-type'
8
-
9
- @Resolver(Supervisor)
10
- export class SupervisorMutation {
11
- @Directive('@transaction')
12
- @Mutation(returns => Supervisor, { description: 'To create new Supervisor' })
13
- async createSupervisor(@Arg('supervisor') supervisor: NewSupervisor, @Ctx() context: ResolverContext): Promise<Supervisor> {
14
- const { domain, user, tx } = context.state
15
-
16
- const result = await tx.getRepository(Supervisor).save({
17
- ...supervisor,
18
- domain,
19
- creator: user,
20
- updater: user
21
- })
22
-
23
- if (supervisor.thumbnail) {
24
- await createAttachment(
25
- null,
26
- {
27
- attachment: {
28
- file: supervisor.thumbnail,
29
- refType: Supervisor.name,
30
- refBy: result.id
31
- }
32
- },
33
- context
34
- )
35
- }
36
-
37
- return result
38
- }
39
-
40
- @Directive('@transaction')
41
- @Mutation(returns => Supervisor, { description: 'To modify Supervisor information' })
42
- async updateSupervisor(
43
- @Arg('id') id: string,
44
- @Arg('patch') patch: SupervisorPatch,
45
- @Ctx() context: ResolverContext
46
- ): Promise<Supervisor> {
47
- const { domain, user, tx } = context.state
48
-
49
- const repository = tx.getRepository(Supervisor)
50
- const supervisor = await repository.findOne({
51
- where: { domain: { id: domain.id }, id }
52
- })
53
-
54
- const result = await repository.save({
55
- ...supervisor,
56
- ...patch,
57
- updater: user
58
- })
59
-
60
- if (patch.thumbnail) {
61
- await deleteAttachmentsByRef(null, { refBys: [result.id] }, context)
62
- await createAttachment(
63
- null,
64
- {
65
- attachment: {
66
- file: patch.thumbnail,
67
- refType: Supervisor.name,
68
- refBy: result.id
69
- }
70
- },
71
- context
72
- )
73
- }
74
-
75
- return result
76
- }
77
-
78
- @Directive('@transaction')
79
- @Mutation(returns => [Supervisor], { description: "To modify multiple Supervisors' information" })
80
- async updateMultipleSupervisor(
81
- @Arg('patches', type => [SupervisorPatch]) patches: SupervisorPatch[],
82
- @Ctx() context: ResolverContext
83
- ): Promise<Supervisor[]> {
84
- const { domain, user, tx } = context.state
85
-
86
- let results = []
87
- const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
88
- const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
89
- const supervisorRepo = tx.getRepository(Supervisor)
90
-
91
- if (_createRecords.length > 0) {
92
- for (let i = 0; i < _createRecords.length; i++) {
93
- const newRecord = _createRecords[i]
94
-
95
- const result = await supervisorRepo.save({
96
- ...newRecord,
97
- domain,
98
- creator: user,
99
- updater: user
100
- })
101
-
102
- if (newRecord.thumbnail) {
103
- await createAttachment(
104
- null,
105
- {
106
- attachment: {
107
- file: newRecord.thumbnail,
108
- refType: Supervisor.name,
109
- refBy: result.id
110
- }
111
- },
112
- context
113
- )
114
- }
115
-
116
- results.push({ ...result, cuFlag: '+' })
117
- }
118
- }
119
-
120
- if (_updateRecords.length > 0) {
121
- for (let i = 0; i < _updateRecords.length; i++) {
122
- const updateRecord = _updateRecords[i]
123
- const supervisor = await supervisorRepo.findOneBy({ id: updateRecord.id })
124
-
125
- const result = await supervisorRepo.save({
126
- ...supervisor,
127
- ...updateRecord,
128
- updater: user
129
- })
130
-
131
- if (updateRecord.thumbnail) {
132
- await deleteAttachmentsByRef(null, { refBys: [result.id] }, context)
133
- await createAttachment(
134
- null,
135
- {
136
- attachment: {
137
- file: updateRecord.thumbnail,
138
- refType: Supervisor.name,
139
- refBy: result.id
140
- }
141
- },
142
- context
143
- )
144
- }
145
-
146
- results.push({ ...result, cuFlag: 'M' })
147
- }
148
- }
149
-
150
- return results
151
- }
152
-
153
- @Directive('@transaction')
154
- @Mutation(returns => Boolean, { description: 'To delete Supervisor' })
155
- async deleteSupervisor(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
156
- const { domain, tx } = context.state
157
-
158
- await tx.getRepository(Supervisor).delete({ domain: { id: domain.id }, id })
159
- await deleteAttachmentsByRef(null, { refBys: [id] }, context)
160
-
161
- return true
162
- }
163
-
164
- @Directive('@transaction')
165
- @Mutation(returns => Boolean, { description: 'To delete multiple Supervisors' })
166
- async deleteSupervisors(
167
- @Arg('ids', type => [String]) ids: string[],
168
- @Ctx() context: ResolverContext
169
- ): Promise<boolean> {
170
- const { domain, tx } = context.state
171
-
172
- await tx.getRepository(Supervisor).delete({
173
- domain: { id: domain.id },
174
- id: In(ids)
175
- })
176
-
177
- await deleteAttachmentsByRef(null, { refBys: ids }, context)
178
-
179
- return true
180
- }
181
-
182
- @Directive('@transaction')
183
- @Mutation(returns => Boolean, { description: 'To import multiple Supervisors' })
184
- async importSupervisors(
185
- @Arg('supervisors', type => [SupervisorPatch]) supervisors: SupervisorPatch[],
186
- @Ctx() context: ResolverContext
187
- ): Promise<boolean> {
188
- const { domain, tx } = context.state
189
-
190
- await Promise.all(
191
- supervisors.map(async (supervisor: SupervisorPatch) => {
192
- const createdSupervisor: Supervisor = await tx.getRepository(Supervisor).save({ domain, ...supervisor })
193
- })
194
- )
195
-
196
- return true
197
- }
198
- }
@@ -1,62 +0,0 @@
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'
4
- import { User } from '@things-factory/auth-base'
5
- import { Supervisor } from './supervisor'
6
- import { SupervisorList } from './supervisor-type'
7
-
8
- @Resolver(Supervisor)
9
- export class SupervisorQuery {
10
- @Query(returns => Supervisor!, { nullable: true, description: 'To fetch a Supervisor' })
11
- async supervisor(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Supervisor> {
12
- const { domain } = context.state
13
-
14
- return await getRepository(Supervisor).findOne({
15
- where: { domain: { id: domain.id }, id }
16
- })
17
- }
18
-
19
- @Query(returns => SupervisorList, { description: 'To fetch multiple Supervisors' })
20
- async supervisors(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<SupervisorList> {
21
- const { domain } = context.state
22
-
23
- const queryBuilder = getQueryBuilderFromListParams({
24
- domain,
25
- params,
26
- repository: await getRepository(Supervisor),
27
- searchables: ['name', 'description']
28
- })
29
-
30
- const [items, total] = await queryBuilder.getManyAndCount()
31
-
32
- return { items, total }
33
- }
34
-
35
- @FieldResolver(type => String)
36
- async thumbnail(@Root() supervisor: Supervisor): Promise<string | undefined> {
37
- const attachment: Attachment = await getRepository(Attachment).findOne({
38
- where: {
39
- domain: { id: supervisor.domainId },
40
- refType: Supervisor.name,
41
- refBy: supervisor.id
42
- }
43
- })
44
-
45
- return attachment?.fullpath
46
- }
47
-
48
- @FieldResolver(type => Domain)
49
- async domain(@Root() supervisor: Supervisor): Promise<Domain> {
50
- return await getRepository(Domain).findOneBy({ id: supervisor.domainId })
51
- }
52
-
53
- @FieldResolver(type => User)
54
- async updater(@Root() supervisor: Supervisor): Promise<User> {
55
- return await getRepository(User).findOneBy({ id: supervisor.updaterId })
56
- }
57
-
58
- @FieldResolver(type => User)
59
- async creator(@Root() supervisor: Supervisor): Promise<User> {
60
- return await getRepository(User).findOneBy({ id: supervisor.creatorId })
61
- }
62
- }
@@ -1,61 +0,0 @@
1
- import type { FileUpload } from 'graphql-upload/GraphQLUpload.js'
2
- import GraphQLUpload from 'graphql-upload/GraphQLUpload.js'
3
- import { ObjectType, Field, InputType, Int, ID, registerEnumType } from 'type-graphql'
4
-
5
- import { ObjectRef, ScalarObject } from '@things-factory/shell'
6
-
7
- import { Supervisor, SupervisorStatus } from './supervisor'
8
-
9
- @InputType()
10
- export class NewSupervisor {
11
- @Field()
12
- name: string
13
-
14
- @Field({ nullable: true })
15
- description?: string
16
-
17
- @Field(type => SupervisorStatus, { nullable: true })
18
- state?: SupervisorStatus
19
-
20
- @Field({ nullable: true })
21
- active?: boolean
22
-
23
- @Field({ nullable: true })
24
- params?: string
25
-
26
- @Field(type => GraphQLUpload, { nullable: true })
27
- thumbnail?: FileUpload
28
- }
29
-
30
- @InputType()
31
- export class SupervisorPatch {
32
- @Field(type => ID, { nullable: true })
33
- id?: string
34
-
35
- @Field({ nullable: true })
36
- name?: string
37
-
38
- @Field({ nullable: true })
39
- description?: string
40
-
41
- @Field(type => SupervisorStatus, { nullable: true })
42
- state?: SupervisorStatus
43
-
44
- @Field({ nullable: true })
45
- active?: boolean
46
-
47
- @Field(type => GraphQLUpload, { nullable: true })
48
- thumbnail?: FileUpload
49
-
50
- @Field({ nullable: true })
51
- cuFlag?: string
52
- }
53
-
54
- @ObjectType()
55
- export class SupervisorList {
56
- @Field(type => [Supervisor])
57
- items: Supervisor[]
58
-
59
- @Field(type => Int)
60
- total: number
61
- }
@@ -1,108 +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
- VersionColumn
13
- } from 'typeorm'
14
- import { ObjectType, Field, Int, ID, registerEnumType } from 'type-graphql'
15
-
16
- import { Domain } from '@things-factory/shell'
17
- import { User } from '@things-factory/auth-base'
18
- import { ProjectReport } from '../project-report/project-report'
19
-
20
- export enum SupervisorStatus {
21
- STATUS_A = 'STATUS_A',
22
- STATUS_B = 'STATUS_B'
23
- }
24
-
25
- registerEnumType(SupervisorStatus, {
26
- name: 'SupervisorStatus',
27
- description: 'state enumeration of a supervisor'
28
- })
29
-
30
- @Entity()
31
- @Index('ix_supervisor_0', (supervisor: Supervisor) => [supervisor.domain, supervisor.name], {
32
- unique: true,
33
- where: '"deleted_at" IS NULL'
34
- })
35
- @ObjectType({ description: 'Entity for Supervisor' })
36
- export class Supervisor {
37
- @PrimaryGeneratedColumn('uuid')
38
- @Field(type => ID)
39
- readonly id: string
40
-
41
- @ManyToOne(type => Domain)
42
- @Field({ nullable: true })
43
- domain?: Domain
44
-
45
- @RelationId((supervisor: Supervisor) => supervisor.domain)
46
- domainId?: string
47
-
48
- @Column()
49
- @Field({ nullable: true })
50
- name?: string
51
-
52
- @Column({ nullable: true })
53
- @Field({ nullable: true })
54
- description?: string
55
-
56
- @Column({ nullable: true })
57
- @Field({ nullable: true })
58
- active?: boolean
59
-
60
- @Column({ nullable: true })
61
- @Field({ nullable: true })
62
- state?: SupervisorStatus
63
-
64
- @Column({ nullable: true })
65
- @Field({ nullable: true })
66
- params?: string
67
-
68
- @Column({ nullable: true })
69
- @Field({ nullable: true })
70
- email: string
71
-
72
- @Column({ nullable: true })
73
- @Field({ nullable: true })
74
- phoneNumber: string
75
-
76
- @Field(() => [ProjectReport])
77
- @OneToMany(() => ProjectReport, report => report.supervisor)
78
- reports: ProjectReport[]
79
-
80
- @CreateDateColumn()
81
- @Field({ nullable: true })
82
- createdAt?: Date
83
-
84
- @UpdateDateColumn()
85
- @Field({ nullable: true })
86
- updatedAt?: Date
87
-
88
- @DeleteDateColumn()
89
- @Field({ nullable: true })
90
- deletedAt?: Date
91
-
92
- @ManyToOne(type => User, { nullable: true })
93
- @Field(type => User, { nullable: true })
94
- creator?: User
95
-
96
- @RelationId((supervisor: Supervisor) => supervisor.creator)
97
- creatorId?: string
98
-
99
- @ManyToOne(type => User, { nullable: true })
100
- @Field(type => User, { nullable: true })
101
- updater?: User
102
-
103
- @RelationId((supervisor: Supervisor) => supervisor.updater)
104
- updaterId?: string
105
-
106
- @Field(type => String, { nullable: true })
107
- thumbnail?: string
108
- }
@@ -1,10 +0,0 @@
1
- {
2
- "extends": "../../tsconfig-base.json",
3
- "compilerOptions": {
4
- "strict": false,
5
- "module": "commonjs",
6
- "outDir": "../dist-server",
7
- "baseUrl": "./"
8
- },
9
- "include": ["./**/*"]
10
- }