@dssp/supervision 1.0.0-alpha.0 → 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 (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/route.d.ts +1 -1
  4. package/dist-client/tsconfig.tsbuildinfo +1 -1
  5. package/package.json +5 -5
  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,66 +0,0 @@
1
- import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
2
- import { In } from 'typeorm'
3
- import { ChecklistType } from './checklist-type'
4
- import { ChecklistTypePatch } from './checklist-type-type'
5
-
6
- @Resolver(ChecklistType)
7
- export class ChecklistTypeMutation {
8
- @Directive('@transaction')
9
- @Mutation(returns => [ChecklistType], { description: "To modify multiple ChecklistTypes' information" })
10
- async updateMultipleChecklistType(
11
- @Arg('patches', type => [ChecklistTypePatch]) patches: ChecklistTypePatch[],
12
- @Ctx() context: ResolverContext
13
- ): Promise<ChecklistType[]> {
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 checklistTypeRepo = tx.getRepository(ChecklistType)
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 checklistTypeRepo.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 checklistType = await checklistTypeRepo.findOneBy({ id: updateRecord.id })
40
-
41
- const result = await checklistTypeRepo.save({
42
- ...checklistType,
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 ChecklistTypes' })
56
- async deleteChecklistTypes(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<boolean> {
57
- const { domain, tx } = context.state
58
-
59
- await tx.getRepository(ChecklistType).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 { ChecklistType } from './checklist-type'
5
- import { ChecklistTypeList } from './checklist-type-type'
6
-
7
- @Resolver(ChecklistType)
8
- export class ChecklistTypeQuery {
9
- @Query(returns => ChecklistTypeList, { description: 'To fetch multiple ChecklistTypes' })
10
- async checklistTypes(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<ChecklistTypeList> {
11
- const { domain } = context.state
12
-
13
- const queryBuilder = getQueryBuilderFromListParams({
14
- domain,
15
- params,
16
- repository: await getRepository(ChecklistType),
17
- searchables: ['mainType', 'detailType']
18
- })
19
-
20
- const [items, total] = await queryBuilder.getManyAndCount()
21
-
22
- return { items, total }
23
- }
24
-
25
- @FieldResolver(type => Domain)
26
- async domain(@Root() checklistType: ChecklistType): Promise<Domain> {
27
- return await getRepository(Domain).findOneBy({ id: checklistType.domainId })
28
- }
29
-
30
- @FieldResolver(type => User)
31
- async updater(@Root() checklistType: ChecklistType): Promise<User> {
32
- return await getRepository(User).findOneBy({ id: checklistType.updaterId })
33
- }
34
-
35
- @FieldResolver(type => User)
36
- async creator(@Root() checklistType: ChecklistType): Promise<User> {
37
- return await getRepository(User).findOneBy({ id: checklistType.creatorId })
38
- }
39
- }
@@ -1,26 +0,0 @@
1
- import { ObjectType, Field, InputType, Int, ID } from 'type-graphql'
2
- import { ChecklistType, ChecklistTypeMainType } from './checklist-type'
3
-
4
- @InputType()
5
- export class ChecklistTypePatch {
6
- @Field(type => ID, { nullable: true })
7
- id?: string
8
-
9
- @Field({ nullable: true })
10
- mainType: ChecklistTypeMainType
11
-
12
- @Field({ nullable: true })
13
- detailType: string
14
-
15
- @Field({ nullable: true })
16
- cuFlag?: string
17
- }
18
-
19
- @ObjectType()
20
- export class ChecklistTypeList {
21
- @Field(type => [ChecklistType])
22
- items: ChecklistType[]
23
-
24
- @Field(type => Int)
25
- total: number
26
- }
@@ -1,64 +0,0 @@
1
- import { CreateDateColumn, UpdateDateColumn, Entity, Index, Column, RelationId, ManyToOne, PrimaryGeneratedColumn } from 'typeorm'
2
- import { ObjectType, Field, ID, registerEnumType } from 'type-graphql'
3
- import { Domain } from '@things-factory/shell'
4
- import { User } from '@things-factory/auth-base'
5
-
6
- export enum ChecklistTypeMainType {
7
- BASIC = '10',
8
- NON_BASIC = '20'
9
- }
10
-
11
- registerEnumType(ChecklistTypeMainType, {
12
- name: 'ChecklistTypeMainType',
13
- description: '체크리스트 구분 메인 구분'
14
- })
15
-
16
- @Entity({ comment: '체크리스트 구분' })
17
- @Index(
18
- 'ix_checklist_type_0',
19
- (checklistType: ChecklistType) => [checklistType.domain, checklistType.mainType, checklistType.detailType],
20
- { unique: true }
21
- )
22
- @ObjectType()
23
- export class ChecklistType {
24
- @PrimaryGeneratedColumn('uuid')
25
- @Field(type => ID)
26
- readonly id: string
27
-
28
- @ManyToOne(type => Domain)
29
- @Field({ nullable: true })
30
- domain?: Domain
31
-
32
- @RelationId((checklistType: ChecklistType) => checklistType.domain)
33
- domainId?: string
34
-
35
- @Column({ nullable: false, comment: '메인 구분 (10: 기본 업무, 20: 기본 외 업무)' })
36
- @Field({ nullable: false })
37
- mainType: ChecklistTypeMainType
38
-
39
- @Column({ nullable: false, comment: '상세 구분' })
40
- @Field({ nullable: false })
41
- detailType: string
42
-
43
- @CreateDateColumn()
44
- @Field({ nullable: true })
45
- createdAt?: Date
46
-
47
- @UpdateDateColumn()
48
- @Field({ nullable: true })
49
- updatedAt?: Date
50
-
51
- @ManyToOne(type => User, { nullable: true })
52
- @Field(type => User, { nullable: true })
53
- creator?: User
54
-
55
- @RelationId((checklistType: ChecklistType) => checklistType.creator)
56
- creatorId?: string
57
-
58
- @ManyToOne(type => User, { nullable: true })
59
- @Field(type => User, { nullable: true })
60
- updater?: User
61
-
62
- @RelationId((checklistType: ChecklistType) => checklistType.updater)
63
- updaterId?: string
64
- }
@@ -1,6 +0,0 @@
1
- import { ChecklistType } from './checklist-type'
2
- import { ChecklistTypeQuery } from './checklist-type-query'
3
- import { ChecklistTypeMutation } from './checklist-type-mutation'
4
-
5
- export const entities = [ChecklistType]
6
- export const resolvers = [ChecklistTypeQuery, ChecklistTypeMutation]
@@ -1,88 +0,0 @@
1
- /* EXPORT ENTITY TYPES */
2
- export * from './action-plan/action-plan'
3
- export * from './issue/issue'
4
- export * from './project-report/project-report'
5
- export * from './supervisor/supervisor'
6
- export * from './checklist-type/checklist-type'
7
- export * from './checklist/checklist'
8
- export * from './checklist-item/checklist-item'
9
- export * from './checklist-item-comment/checklist-item-comment'
10
- export * from './checklist-template/checklist-template'
11
- export * from './checklist-template-item/checklist-template-item'
12
- export * from './building-inspection/building-inspection'
13
-
14
- /* IMPORT ENTITIES AND RESOLVERS */
15
- import {
16
- entities as ActionPlanEntities,
17
- resolvers as ActionPlanResolvers,
18
- subscribers as ActionPlanSubscribers
19
- } from './action-plan'
20
- import { entities as IssueEntities, resolvers as IssueResolvers, subscribers as IssueSubscribers } from './issue'
21
- import {
22
- entities as ProjectReportEntities,
23
- resolvers as ProjectReportResolvers,
24
- subscribers as ProjectReportSubscribers
25
- } from './project-report'
26
- import {
27
- entities as SupervisorEntities,
28
- resolvers as SupervisorResolvers,
29
- subscribers as SupervisorSubscribers
30
- } from './supervisor'
31
- import { entities as ChecklistEntities, resolvers as ChecklistResolvers, subscribers as ChecklistSubscribers } from './checklist'
32
- import { entities as ChecklistItemEntities, resolvers as ChecklistItemResolvers } from './checklist-item'
33
- import {
34
- entities as ChecklistItemCommentEntities,
35
- resolvers as ChecklistItemCommentResolvers,
36
- subscribers as ChecklistItemCommentSubscribers
37
- } from './checklist-item-comment'
38
- import { entities as ChecklistTypeEntities, resolvers as ChecklistTypeResolvers } from './checklist-type'
39
- import { entities as ChecklistTemplateEntities, resolvers as ChecklistTemplateResolvers } from './checklist-template'
40
- import { entities as ChecklistTemplateItemEntities, resolvers as ChecklistTemplateItemResolvers } from './checklist-template-item'
41
- import {
42
- entities as BuildingInspectionEntities,
43
- resolvers as BuildingInspectionResolvers,
44
- subscribers as BuildingInspectionSubscribers
45
- } from './building-inspection'
46
-
47
- export const entities = [
48
- /* ENTITIES */
49
- ...ActionPlanEntities,
50
- ...IssueEntities,
51
- ...ProjectReportEntities,
52
- ...SupervisorEntities,
53
- ...ChecklistEntities,
54
- ...ChecklistItemEntities,
55
- ...ChecklistItemCommentEntities,
56
- ...ChecklistTypeEntities,
57
- ...ChecklistTemplateItemEntities,
58
- ...ChecklistTemplateEntities,
59
- ...BuildingInspectionEntities
60
- ]
61
-
62
- export const subscribers = [
63
- /* SUBSCRIBERS */
64
- ...ActionPlanSubscribers,
65
- ...IssueSubscribers,
66
- ...ProjectReportSubscribers,
67
- ...SupervisorSubscribers,
68
- ...BuildingInspectionSubscribers,
69
- ...ChecklistSubscribers,
70
- ...ChecklistItemCommentSubscribers
71
- ]
72
-
73
- export const schema = {
74
- resolverClasses: [
75
- /* RESOLVER CLASSES */
76
- ...ActionPlanResolvers,
77
- ...IssueResolvers,
78
- ...ProjectReportResolvers,
79
- ...SupervisorResolvers,
80
- ...ChecklistResolvers,
81
- ...ChecklistItemResolvers,
82
- ...ChecklistItemCommentResolvers,
83
- ...ChecklistTypeResolvers,
84
- ...ChecklistTemplateItemResolvers,
85
- ...ChecklistTemplateResolvers,
86
- ...BuildingInspectionResolvers
87
- ]
88
- }
@@ -1,7 +0,0 @@
1
- import { Issue } from './issue'
2
- import { IssueQuery } from './issue-query'
3
- import { IssueMutation } from './issue-mutation'
4
-
5
- export const entities = [Issue]
6
- export const resolvers = [IssueQuery, IssueMutation]
7
- export const subscribers = []
@@ -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 { Issue } from './issue'
7
- import { NewIssue, IssuePatch } from './issue-type'
8
-
9
- @Resolver(Issue)
10
- export class IssueMutation {
11
- @Directive('@transaction')
12
- @Mutation(returns => Issue, { description: 'To create new Issue' })
13
- async createIssue(@Arg('issue') issue: NewIssue, @Ctx() context: ResolverContext): Promise<Issue> {
14
- const { domain, user, tx } = context.state
15
-
16
- const result = await tx.getRepository(Issue).save({
17
- ...issue,
18
- domain,
19
- creator: user,
20
- updater: user
21
- })
22
-
23
- if (issue.thumbnail) {
24
- await createAttachment(
25
- null,
26
- {
27
- attachment: {
28
- file: issue.thumbnail,
29
- refType: Issue.name,
30
- refBy: result.id
31
- }
32
- },
33
- context
34
- )
35
- }
36
-
37
- return result
38
- }
39
-
40
- @Directive('@transaction')
41
- @Mutation(returns => Issue, { description: 'To modify Issue information' })
42
- async updateIssue(
43
- @Arg('id') id: string,
44
- @Arg('patch') patch: IssuePatch,
45
- @Ctx() context: ResolverContext
46
- ): Promise<Issue> {
47
- const { domain, user, tx } = context.state
48
-
49
- const repository = tx.getRepository(Issue)
50
- const issue = await repository.findOne({
51
- where: { domain: { id: domain.id }, id }
52
- })
53
-
54
- const result = await repository.save({
55
- ...issue,
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: Issue.name,
68
- refBy: result.id
69
- }
70
- },
71
- context
72
- )
73
- }
74
-
75
- return result
76
- }
77
-
78
- @Directive('@transaction')
79
- @Mutation(returns => [Issue], { description: "To modify multiple Issues' information" })
80
- async updateMultipleIssue(
81
- @Arg('patches', type => [IssuePatch]) patches: IssuePatch[],
82
- @Ctx() context: ResolverContext
83
- ): Promise<Issue[]> {
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 issueRepo = tx.getRepository(Issue)
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 issueRepo.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: Issue.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 issue = await issueRepo.findOneBy({ id: updateRecord.id })
124
-
125
- const result = await issueRepo.save({
126
- ...issue,
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: Issue.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 Issue' })
155
- async deleteIssue(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
156
- const { domain, tx } = context.state
157
-
158
- await tx.getRepository(Issue).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 Issues' })
166
- async deleteIssues(
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(Issue).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 Issues' })
184
- async importIssues(
185
- @Arg('issues', type => [IssuePatch]) issues: IssuePatch[],
186
- @Ctx() context: ResolverContext
187
- ): Promise<boolean> {
188
- const { domain, tx } = context.state
189
-
190
- await Promise.all(
191
- issues.map(async (issue: IssuePatch) => {
192
- const createdIssue: Issue = await tx.getRepository(Issue).save({ domain, ...issue })
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 { Issue } from './issue'
6
- import { IssueList } from './issue-type'
7
-
8
- @Resolver(Issue)
9
- export class IssueQuery {
10
- @Query(returns => Issue!, { nullable: true, description: 'To fetch a Issue' })
11
- async issue(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Issue> {
12
- const { domain } = context.state
13
-
14
- return await getRepository(Issue).findOne({
15
- where: { domain: { id: domain.id }, id }
16
- })
17
- }
18
-
19
- @Query(returns => IssueList, { description: 'To fetch multiple Issues' })
20
- async issues(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<IssueList> {
21
- const { domain } = context.state
22
-
23
- const queryBuilder = getQueryBuilderFromListParams({
24
- domain,
25
- params,
26
- repository: await getRepository(Issue),
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() issue: Issue): Promise<string | undefined> {
37
- const attachment: Attachment = await getRepository(Attachment).findOne({
38
- where: {
39
- domain: { id: issue.domainId },
40
- refType: Issue.name,
41
- refBy: issue.id
42
- }
43
- })
44
-
45
- return attachment?.fullpath
46
- }
47
-
48
- @FieldResolver(type => Domain)
49
- async domain(@Root() issue: Issue): Promise<Domain> {
50
- return await getRepository(Domain).findOneBy({ id: issue.domainId })
51
- }
52
-
53
- @FieldResolver(type => User)
54
- async updater(@Root() issue: Issue): Promise<User> {
55
- return await getRepository(User).findOneBy({ id: issue.updaterId })
56
- }
57
-
58
- @FieldResolver(type => User)
59
- async creator(@Root() issue: Issue): Promise<User> {
60
- return await getRepository(User).findOneBy({ id: issue.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 { Issue, IssueStatus } from './issue'
8
-
9
- @InputType()
10
- export class NewIssue {
11
- @Field()
12
- name: string
13
-
14
- @Field({ nullable: true })
15
- description?: string
16
-
17
- @Field(type => IssueStatus, { nullable: true })
18
- state?: IssueStatus
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 IssuePatch {
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 => IssueStatus, { nullable: true })
42
- state?: IssueStatus
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 IssueList {
56
- @Field(type => [Issue])
57
- items: Issue[]
58
-
59
- @Field(type => Int)
60
- total: number
61
- }