@things-factory/worklist 5.0.11 → 6.0.0-alpha.0

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 (211) hide show
  1. package/client/components/activity-/{bowner-view.js → bowner-view.ts} +27 -35
  2. package/client/components/{activity-instance-preview.js → activity-instance-preview.ts} +39 -52
  3. package/client/components/activity-intro-view.ts +0 -1
  4. package/client/components/{activity-reporter-view.js → activity-reporter-view.ts} +27 -40
  5. package/client/components/{activity-starter-form.js → activity-starter-form.ts} +55 -71
  6. package/client/pages/activity/{activity-list-page.js → activity-list-page.ts} +26 -35
  7. package/client/pages/activity/{activity-model-item-list.js → activity-model-item-list.ts} +15 -19
  8. package/client/pages/activity/{activity-page.js → activity-page.ts} +37 -42
  9. package/client/pages/activity/{starter-list-page.js → starter-list-page.ts} +15 -20
  10. package/client/pages/activity-instance/{activity-instance-list-page.js → activity-instance-list-page.ts} +22 -30
  11. package/client/pages/activity-instance/{activity-instance-page.js → activity-instance-page.ts} +37 -42
  12. package/client/pages/activity-store/{activity-store-page.js → activity-store-page.ts} +22 -29
  13. package/client/pages/activity-supervisor/{reporter-list-page.js → reporter-list-page.ts} +14 -21
  14. package/client/pages/activity-template/{activity-template-importer.js → activity-template-importer.ts} +32 -38
  15. package/client/pages/activity-template/{activity-template-list-page.js → activity-template-list-page.ts} +30 -37
  16. package/client/pages/activity-template/{activity-template-model-item-list.js → activity-template-model-item-list.ts} +5 -4
  17. package/client/pages/activity-thread/{activity-thread-importer.js → activity-thread-importer.ts} +32 -37
  18. package/client/pages/activity-thread/{activity-thread-list-page.js → activity-thread-list-page.ts} +20 -27
  19. package/client/pages/activity-thread/{activity-thread-page.js → activity-thread-page.ts} +37 -41
  20. package/client/pages/dashboard/{dashboard-home.js → dashboard-home.ts} +3 -7
  21. package/client/pages/todo/{assigned-list-page.js → assigned-list-page.ts} +13 -20
  22. package/client/pages/todo/{draft-list-page.js → draft-list-page.ts} +15 -20
  23. package/client/pages/todo/{pickable-list-page.js → pickable-list-page.ts} +13 -20
  24. package/client/pages/todo/{todo-list-page.js → todo-list-page.ts} +12 -19
  25. package/client/pages/{worklist-home.js → worklist-home.ts} +3 -7
  26. package/dist-client/components/activity-/bowner-view.d.ts +1 -1
  27. package/dist-client/components/activity-/bowner-view.js +44 -37
  28. package/dist-client/components/activity-/bowner-view.js.map +1 -1
  29. package/dist-client/components/activity-instance-preview.d.ts +2 -1
  30. package/dist-client/components/activity-instance-preview.js +59 -53
  31. package/dist-client/components/activity-instance-preview.js.map +1 -1
  32. package/dist-client/components/activity-intro-view.d.ts +0 -1
  33. package/dist-client/components/activity-intro-view.js +0 -1
  34. package/dist-client/components/activity-intro-view.js.map +1 -1
  35. package/dist-client/components/activity-reporter-view.d.ts +1 -1
  36. package/dist-client/components/activity-reporter-view.js +44 -38
  37. package/dist-client/components/activity-reporter-view.js.map +1 -1
  38. package/dist-client/components/activity-starter-form.d.ts +16 -0
  39. package/dist-client/components/activity-starter-form.js +70 -70
  40. package/dist-client/components/activity-starter-form.js.map +1 -1
  41. package/dist-client/pages/activity/activity-list-page.d.ts +13 -262
  42. package/dist-client/pages/activity/activity-list-page.js +49 -35
  43. package/dist-client/pages/activity/activity-list-page.js.map +1 -1
  44. package/dist-client/pages/activity/activity-model-item-list.d.ts +13 -155
  45. package/dist-client/pages/activity/activity-model-item-list.js +56 -45
  46. package/dist-client/pages/activity/activity-model-item-list.js.map +1 -1
  47. package/dist-client/pages/activity/activity-page.d.ts +29 -22
  48. package/dist-client/pages/activity/activity-page.js +54 -46
  49. package/dist-client/pages/activity/activity-page.js.map +1 -1
  50. package/dist-client/pages/activity/starter-list-page.d.ts +14 -120
  51. package/dist-client/pages/activity/starter-list-page.js +47 -31
  52. package/dist-client/pages/activity/starter-list-page.js.map +1 -1
  53. package/dist-client/pages/activity-instance/activity-instance-list-page.d.ts +9 -114
  54. package/dist-client/pages/activity-instance/activity-instance-list-page.js +40 -30
  55. package/dist-client/pages/activity-instance/activity-instance-list-page.js.map +1 -1
  56. package/dist-client/pages/activity-instance/activity-instance-page.d.ts +22 -22
  57. package/dist-client/pages/activity-instance/activity-instance-page.js +58 -45
  58. package/dist-client/pages/activity-instance/activity-instance-page.js.map +1 -1
  59. package/dist-client/pages/activity-store/activity-store-page.d.ts +23 -150
  60. package/dist-client/pages/activity-store/activity-store-page.js +40 -31
  61. package/dist-client/pages/activity-store/activity-store-page.js.map +1 -1
  62. package/dist-client/pages/activity-supervisor/reporter-list-page.d.ts +13 -120
  63. package/dist-client/pages/activity-supervisor/reporter-list-page.js +47 -31
  64. package/dist-client/pages/activity-supervisor/reporter-list-page.js.map +1 -1
  65. package/dist-client/pages/activity-template/activity-template-importer.d.ts +7 -21
  66. package/dist-client/pages/activity-template/activity-template-importer.js +42 -36
  67. package/dist-client/pages/activity-template/activity-template-importer.js.map +1 -1
  68. package/dist-client/pages/activity-template/activity-template-list-page.d.ts +17 -218
  69. package/dist-client/pages/activity-template/activity-template-list-page.js +58 -37
  70. package/dist-client/pages/activity-template/activity-template-list-page.js.map +1 -1
  71. package/dist-client/pages/activity-template/activity-template-model-item-list.js +10 -5
  72. package/dist-client/pages/activity-template/activity-template-model-item-list.js.map +1 -1
  73. package/dist-client/pages/activity-thread/activity-thread-importer.d.ts +7 -21
  74. package/dist-client/pages/activity-thread/activity-thread-importer.js +42 -36
  75. package/dist-client/pages/activity-thread/activity-thread-importer.js.map +1 -1
  76. package/dist-client/pages/activity-thread/activity-thread-list-page.d.ts +16 -100
  77. package/dist-client/pages/activity-thread/activity-thread-list-page.js +55 -36
  78. package/dist-client/pages/activity-thread/activity-thread-list-page.js.map +1 -1
  79. package/dist-client/pages/activity-thread/activity-thread-page.d.ts +26 -19
  80. package/dist-client/pages/activity-thread/activity-thread-page.js +54 -45
  81. package/dist-client/pages/activity-thread/activity-thread-page.js.map +1 -1
  82. package/dist-client/pages/dashboard/dashboard-home.js +8 -7
  83. package/dist-client/pages/dashboard/dashboard-home.js.map +1 -1
  84. package/dist-client/pages/todo/assigned-list-page.d.ts +12 -100
  85. package/dist-client/pages/todo/assigned-list-page.js +45 -30
  86. package/dist-client/pages/todo/assigned-list-page.js.map +1 -1
  87. package/dist-client/pages/todo/draft-list-page.d.ts +13 -174
  88. package/dist-client/pages/todo/draft-list-page.js +48 -30
  89. package/dist-client/pages/todo/draft-list-page.js.map +1 -1
  90. package/dist-client/pages/todo/pickable-list-page.d.ts +13 -126
  91. package/dist-client/pages/todo/pickable-list-page.js +46 -30
  92. package/dist-client/pages/todo/pickable-list-page.js.map +1 -1
  93. package/dist-client/pages/todo/todo-list-page.d.ts +12 -206
  94. package/dist-client/pages/todo/todo-list-page.js +44 -30
  95. package/dist-client/pages/todo/todo-list-page.js.map +1 -1
  96. package/dist-client/pages/worklist-home.js +8 -7
  97. package/dist-client/pages/worklist-home.js.map +1 -1
  98. package/dist-client/route.d.ts +1 -1
  99. package/dist-client/tsconfig.tsbuildinfo +1 -1
  100. package/dist-server/controllers/activity-instance/abort.js +8 -6
  101. package/dist-server/controllers/activity-instance/abort.js.map +1 -1
  102. package/dist-server/controllers/activity-instance/adjust.js +5 -3
  103. package/dist-server/controllers/activity-instance/adjust.js.map +1 -1
  104. package/dist-server/controllers/activity-instance/assign.js +11 -25
  105. package/dist-server/controllers/activity-instance/assign.js.map +1 -1
  106. package/dist-server/controllers/activity-instance/delegate.js +8 -6
  107. package/dist-server/controllers/activity-instance/delegate.js.map +1 -1
  108. package/dist-server/controllers/activity-instance/draft.js +9 -8
  109. package/dist-server/controllers/activity-instance/draft.js.map +1 -1
  110. package/dist-server/controllers/activity-instance/end.js +8 -6
  111. package/dist-server/controllers/activity-instance/end.js.map +1 -1
  112. package/dist-server/controllers/activity-instance/pick.js +9 -6
  113. package/dist-server/controllers/activity-instance/pick.js.map +1 -1
  114. package/dist-server/controllers/activity-instance/post.js +26 -6
  115. package/dist-server/controllers/activity-instance/post.js.map +1 -1
  116. package/dist-server/controllers/activity-instance/start.js +5 -3
  117. package/dist-server/controllers/activity-instance/start.js.map +1 -1
  118. package/dist-server/controllers/activity-instance/terminate.js +8 -6
  119. package/dist-server/controllers/activity-instance/terminate.js.map +1 -1
  120. package/dist-server/controllers/activity-thread/abort.js +7 -5
  121. package/dist-server/controllers/activity-thread/abort.js.map +1 -1
  122. package/dist-server/controllers/activity-thread/adjust.js +4 -2
  123. package/dist-server/controllers/activity-thread/adjust.js.map +1 -1
  124. package/dist-server/controllers/activity-thread/delegate.js +7 -5
  125. package/dist-server/controllers/activity-thread/delegate.js.map +1 -1
  126. package/dist-server/controllers/activity-thread/end.js +7 -5
  127. package/dist-server/controllers/activity-thread/end.js.map +1 -1
  128. package/dist-server/controllers/activity-thread/save.js +4 -2
  129. package/dist-server/controllers/activity-thread/save.js.map +1 -1
  130. package/dist-server/controllers/activity-thread/start.js +6 -4
  131. package/dist-server/controllers/activity-thread/start.js.map +1 -1
  132. package/dist-server/controllers/activity-thread/terminate.js +7 -5
  133. package/dist-server/controllers/activity-thread/terminate.js.map +1 -1
  134. package/dist-server/controllers/common.js +31 -10
  135. package/dist-server/controllers/common.js.map +1 -1
  136. package/dist-server/service/activity/activity-history.js +6 -7
  137. package/dist-server/service/activity/activity-history.js.map +1 -1
  138. package/dist-server/service/activity/activity-mutation.js +10 -4
  139. package/dist-server/service/activity/activity-mutation.js.map +1 -1
  140. package/dist-server/service/activity/activity-query.js +18 -19
  141. package/dist-server/service/activity/activity-query.js.map +1 -1
  142. package/dist-server/service/activity/activity-type.js +6 -7
  143. package/dist-server/service/activity/activity-type.js.map +1 -1
  144. package/dist-server/service/activity/activity.js +6 -7
  145. package/dist-server/service/activity/activity.js.map +1 -1
  146. package/dist-server/service/activity-instance/activity-instance-history.js +7 -8
  147. package/dist-server/service/activity-instance/activity-instance-history.js.map +1 -1
  148. package/dist-server/service/activity-instance/activity-instance-mutation.js +17 -19
  149. package/dist-server/service/activity-instance/activity-instance-mutation.js.map +1 -1
  150. package/dist-server/service/activity-instance/activity-instance-query.js +24 -25
  151. package/dist-server/service/activity-instance/activity-instance-query.js.map +1 -1
  152. package/dist-server/service/activity-instance/activity-instance-subscription.js +1 -2
  153. package/dist-server/service/activity-instance/activity-instance-subscription.js.map +1 -1
  154. package/dist-server/service/activity-instance/activity-instance-type.js +13 -6
  155. package/dist-server/service/activity-instance/activity-instance-type.js.map +1 -1
  156. package/dist-server/service/activity-instance/activity-instance.js +7 -8
  157. package/dist-server/service/activity-instance/activity-instance.js.map +1 -1
  158. package/dist-server/service/activity-instance/event-subscriber.js +0 -5
  159. package/dist-server/service/activity-instance/event-subscriber.js.map +1 -1
  160. package/dist-server/service/activity-template/activity-template-history.js +3 -4
  161. package/dist-server/service/activity-template/activity-template-history.js.map +1 -1
  162. package/dist-server/service/activity-template/activity-template-mutation.js +4 -4
  163. package/dist-server/service/activity-template/activity-template-mutation.js.map +1 -1
  164. package/dist-server/service/activity-template/activity-template-query.js +23 -11
  165. package/dist-server/service/activity-template/activity-template-query.js.map +1 -1
  166. package/dist-server/service/activity-template/activity-template.js +3 -4
  167. package/dist-server/service/activity-template/activity-template.js.map +1 -1
  168. package/dist-server/service/activity-thread/activity-thread-mutation.js +15 -11
  169. package/dist-server/service/activity-thread/activity-thread-mutation.js.map +1 -1
  170. package/dist-server/service/activity-thread/activity-thread-query.js +11 -13
  171. package/dist-server/service/activity-thread/activity-thread-query.js.map +1 -1
  172. package/dist-server/service/activity-thread/activity-thread.js +4 -5
  173. package/dist-server/service/activity-thread/activity-thread.js.map +1 -1
  174. package/dist-server/service/activity-thread/event-subscriber.js +15 -3
  175. package/dist-server/service/activity-thread/event-subscriber.js.map +1 -1
  176. package/dist-server/tsconfig.tsbuildinfo +1 -1
  177. package/package.json +7 -7
  178. package/server/controllers/activity-instance/abort.ts +9 -6
  179. package/server/controllers/activity-instance/adjust.ts +7 -4
  180. package/server/controllers/activity-instance/assign.ts +16 -44
  181. package/server/controllers/activity-instance/delegate.ts +10 -7
  182. package/server/controllers/activity-instance/draft.ts +9 -8
  183. package/server/controllers/activity-instance/end.ts +9 -7
  184. package/server/controllers/activity-instance/pick.ts +15 -7
  185. package/server/controllers/activity-instance/post.ts +30 -7
  186. package/server/controllers/activity-instance/start.ts +7 -4
  187. package/server/controllers/activity-instance/terminate.ts +10 -7
  188. package/server/controllers/activity-thread/abort.ts +7 -5
  189. package/server/controllers/activity-thread/adjust.ts +5 -3
  190. package/server/controllers/activity-thread/delegate.ts +8 -6
  191. package/server/controllers/activity-thread/end.ts +8 -6
  192. package/server/controllers/activity-thread/save.ts +5 -7
  193. package/server/controllers/activity-thread/start.ts +7 -4
  194. package/server/controllers/activity-thread/terminate.ts +6 -5
  195. package/server/controllers/common.ts +44 -21
  196. package/server/service/activity/activity-mutation.ts +19 -10
  197. package/server/service/activity/activity-query.ts +14 -14
  198. package/server/service/activity-instance/activity-instance-mutation.ts +18 -20
  199. package/server/service/activity-instance/activity-instance-query.ts +27 -21
  200. package/server/service/activity-instance/activity-instance-subscription.ts +1 -2
  201. package/server/service/activity-instance/activity-instance-type.ts +10 -4
  202. package/server/service/activity-instance/event-subscriber.ts +0 -6
  203. package/server/service/activity-template/activity-template-mutation.ts +13 -10
  204. package/server/service/activity-template/activity-template-query.ts +18 -9
  205. package/server/service/activity-thread/activity-thread-mutation.ts +27 -20
  206. package/server/service/activity-thread/activity-thread-query.ts +10 -11
  207. package/server/service/activity-thread/event-subscriber.ts +15 -3
  208. package/translations/en.json +3 -0
  209. package/translations/ko.json +3 -0
  210. package/translations/ms.json +3 -0
  211. package/translations/zh.json +3 -0
@@ -12,7 +12,7 @@ export class ActivityTemplateMutation {
12
12
  @Mutation(returns => ActivityTemplate, { description: 'To create new ActivityTemplate' })
13
13
  async createActivityTemplate(
14
14
  @Arg('activityTemplate') activityTemplate: NewActivityTemplate,
15
- @Ctx() context: any
15
+ @Ctx() context: ResolverContext
16
16
  ): Promise<ActivityTemplate> {
17
17
  const { domain, user, tx } = context.state
18
18
 
@@ -45,13 +45,13 @@ export class ActivityTemplateMutation {
45
45
  async updateActivityTemplate(
46
46
  @Arg('id') id: string,
47
47
  @Arg('patch') patch: ActivityTemplatePatch,
48
- @Ctx() context: any
48
+ @Ctx() context: ResolverContext
49
49
  ): Promise<ActivityTemplate> {
50
50
  const { domain, user, tx } = context.state
51
51
 
52
52
  const repository = tx.getRepository(ActivityTemplate)
53
53
  const activityTemplate = await repository.findOne({
54
- where: { domain, id }
54
+ where: { domain: { id: domain.id }, id }
55
55
  })
56
56
 
57
57
  const result = await repository.save({
@@ -82,7 +82,7 @@ export class ActivityTemplateMutation {
82
82
  @Mutation(returns => [ActivityTemplate], { description: "To modify multiple ActivityTemplates' information" })
83
83
  async updateMultipleActivityTemplate(
84
84
  @Arg('patches', type => [ActivityTemplatePatch]) patches: ActivityTemplatePatch[],
85
- @Ctx() context: any
85
+ @Ctx() context: ResolverContext
86
86
  ): Promise<ActivityTemplate[]> {
87
87
  const { domain, user, tx } = context.state
88
88
 
@@ -123,7 +123,7 @@ export class ActivityTemplateMutation {
123
123
  if (_updateRecords.length > 0) {
124
124
  for (let i = 0; i < _updateRecords.length; i++) {
125
125
  const newRecord = _updateRecords[i]
126
- const activityTemplate = await activityTemplateRepo.findOne(newRecord.id)
126
+ const activityTemplate = await activityTemplateRepo.findOneBy({ id: newRecord.id })
127
127
 
128
128
  const result = await activityTemplateRepo.save({
129
129
  ...activityTemplate,
@@ -155,10 +155,10 @@ export class ActivityTemplateMutation {
155
155
 
156
156
  @Directive('@transaction')
157
157
  @Mutation(returns => Boolean, { description: 'To delete ActivityTemplate' })
158
- async deleteActivityTemplate(@Arg('id') id: string, @Ctx() context: any): Promise<boolean> {
158
+ async deleteActivityTemplate(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
159
159
  const { domain, tx } = context.state
160
160
 
161
- await tx.getRepository(ActivityTemplate).delete({ domain, id })
161
+ await tx.getRepository(ActivityTemplate).delete({ domain: { id: domain.id }, id })
162
162
  await deleteAttachmentsByRef(null, { refBys: [id] }, context)
163
163
 
164
164
  return true
@@ -166,11 +166,14 @@ export class ActivityTemplateMutation {
166
166
 
167
167
  @Directive('@transaction')
168
168
  @Mutation(returns => Boolean, { description: 'To delete multiple ActivityTemplates' })
169
- async deleteActivityTemplates(@Arg('ids', type => [String]) ids: string[], @Ctx() context: any): Promise<boolean> {
169
+ async deleteActivityTemplates(
170
+ @Arg('ids', type => [String]) ids: string[],
171
+ @Ctx() context: ResolverContext
172
+ ): Promise<boolean> {
170
173
  const { domain, tx } = context.state
171
174
 
172
175
  await tx.getRepository(ActivityTemplate).delete({
173
- domain,
176
+ domain: { id: domain.id },
174
177
  id: In(ids)
175
178
  })
176
179
 
@@ -183,7 +186,7 @@ export class ActivityTemplateMutation {
183
186
  @Mutation(returns => Boolean, { description: 'To import multiple ActivityTemplates' })
184
187
  async importActivityTemplates(
185
188
  @Arg('activityTemplates', type => [ActivityTemplatePatch]) activityTemplates: ActivityTemplatePatch[],
186
- @Ctx() context: any
189
+ @Ctx() context: ResolverContext
187
190
  ): Promise<boolean> {
188
191
  const { domain, tx } = context.state
189
192
 
@@ -1,26 +1,26 @@
1
1
  import { Arg, Args, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'
2
- import { getRepository } from 'typeorm'
3
2
 
4
3
  import { Attachment } from '@things-factory/attachment-base'
5
4
  import { User } from '@things-factory/auth-base'
6
- import { Domain, getQueryBuilderFromListParams, ListParam } from '@things-factory/shell'
5
+ import { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
7
6
 
7
+ import { ActivityModelItem } from '../activity/activity-model-type'
8
8
  import { ActivityTemplate } from './activity-template'
9
9
  import { ActivityTemplateList } from './activity-template-type'
10
10
 
11
11
  @Resolver(ActivityTemplate)
12
12
  export class ActivityTemplateQuery {
13
13
  @Query(returns => ActivityTemplate!, { nullable: true, description: 'To fetch a ActivityTemplate' })
14
- async activityTemplate(@Arg('id') id: string, @Ctx() context: any): Promise<ActivityTemplate> {
14
+ async activityTemplate(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<ActivityTemplate> {
15
15
  const { domain } = context.state
16
16
 
17
17
  return await getRepository(ActivityTemplate).findOne({
18
- where: { domain, id }
18
+ where: { domain: { id: domain.id }, id }
19
19
  })
20
20
  }
21
21
 
22
22
  @Query(returns => ActivityTemplateList, { description: 'To fetch multiple ActivityTemplates' })
23
- async activityTemplates(@Args() params: ListParam, @Ctx() context: any): Promise<ActivityTemplateList> {
23
+ async activityTemplates(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<ActivityTemplateList> {
24
24
  const { domain } = context.state
25
25
 
26
26
  const queryBuilder = getQueryBuilderFromListParams({
@@ -35,11 +35,20 @@ export class ActivityTemplateQuery {
35
35
  return { items, total }
36
36
  }
37
37
 
38
+ @FieldResolver(type => [ActivityModelItem])
39
+ async model(@Root() activityTemplate: ActivityTemplate): Promise<ActivityModelItem[]> {
40
+ if (activityTemplate.model instanceof Array) {
41
+ return activityTemplate.model.filter(model => model.name)
42
+ }
43
+
44
+ return []
45
+ }
46
+
38
47
  @FieldResolver(type => String)
39
48
  async thumbnail(@Root() activityTemplate: ActivityTemplate): Promise<string | undefined> {
40
49
  const attachment: Attachment = await getRepository(Attachment).findOne({
41
50
  where: {
42
- domain: activityTemplate.domainId,
51
+ domain: { id: activityTemplate.domainId },
43
52
  refType: ActivityTemplate.name,
44
53
  refBy: activityTemplate.id
45
54
  }
@@ -50,16 +59,16 @@ export class ActivityTemplateQuery {
50
59
 
51
60
  @FieldResolver(type => Domain)
52
61
  async domain(@Root() activityTemplate: ActivityTemplate): Promise<Domain> {
53
- return await getRepository(Domain).findOne(activityTemplate.domainId)
62
+ return await getRepository(Domain).findOneBy({ id: activityTemplate.domainId })
54
63
  }
55
64
 
56
65
  @FieldResolver(type => User)
57
66
  async updater(@Root() activityTemplate: ActivityTemplate): Promise<User> {
58
- return await getRepository(User).findOne(activityTemplate.updaterId)
67
+ return await getRepository(User).findOneBy({ id: activityTemplate.updaterId })
59
68
  }
60
69
 
61
70
  @FieldResolver(type => User)
62
71
  async creator(@Root() activityTemplate: ActivityTemplate): Promise<User> {
63
- return await getRepository(User).findOne(activityTemplate.creatorId)
72
+ return await getRepository(User).findOneBy({ id: activityTemplate.creatorId })
64
73
  }
65
74
  }
@@ -13,7 +13,7 @@ export class ActivityThreadMutation {
13
13
  @Mutation(returns => ActivityThread, { description: 'To create new ActivityThread' })
14
14
  async createActivityThread(
15
15
  @Arg('activityThread') activityThread: NewActivityThread,
16
- @Ctx() context: any
16
+ @Ctx() context: ResolverContext
17
17
  ): Promise<ActivityThread> {
18
18
  const { domain, user, tx } = context.state
19
19
 
@@ -30,13 +30,14 @@ export class ActivityThreadMutation {
30
30
  async updateActivityThread(
31
31
  @Arg('id') id: string,
32
32
  @Arg('patch') patch: ActivityThreadPatch,
33
- @Ctx() context: any
33
+ @Ctx() context: ResolverContext
34
34
  ): Promise<ActivityThread> {
35
35
  const { domain, user, tx } = context.state
36
36
 
37
37
  const repository = tx.getRepository(ActivityThread)
38
38
  const activityThread = await repository.findOne({
39
- where: { domain, id }
39
+ where: { domain: { id: domain.id }, id },
40
+ relations: ['domain', 'activityInstance', 'assignee', 'creator', 'updater']
40
41
  })
41
42
 
42
43
  return await repository.save({
@@ -50,7 +51,7 @@ export class ActivityThreadMutation {
50
51
  @Mutation(returns => [ActivityThread], { description: "To modify multiple ActivityThreads' information" })
51
52
  async updateMultipleActivityThread(
52
53
  @Arg('patches', type => [ActivityThreadPatch]) patches: ActivityThreadPatch[],
53
- @Ctx() context: any
54
+ @Ctx() context: ResolverContext
54
55
  ): Promise<ActivityThread[]> {
55
56
  const { domain, user, tx } = context.state
56
57
 
@@ -77,7 +78,10 @@ export class ActivityThreadMutation {
77
78
  if (_updateRecords.length > 0) {
78
79
  for (let i = 0; i < _updateRecords.length; i++) {
79
80
  const newRecord = _updateRecords[i]
80
- const activityThread = await activityThreadRepo.findOne(newRecord.id)
81
+ const activityThread = await activityThreadRepo.findOne({
82
+ where: { domain: { id: domain.id }, id: newRecord.id },
83
+ relations: ['domain', 'activityInstance', 'assignee', 'creator', 'updater']
84
+ })
81
85
 
82
86
  const result = await activityThreadRepo.save({
83
87
  ...activityThread,
@@ -94,20 +98,23 @@ export class ActivityThreadMutation {
94
98
 
95
99
  @Directive('@transaction')
96
100
  @Mutation(returns => Boolean, { description: 'To delete ActivityThread' })
97
- async deleteActivityThread(@Arg('id') id: string, @Ctx() context: any): Promise<boolean> {
101
+ async deleteActivityThread(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
98
102
  const { domain, tx } = context.state
99
103
 
100
- await tx.getRepository(ActivityThread).delete({ domain, id })
104
+ await tx.getRepository(ActivityThread).delete({ domain: { id: domain.id }, id })
101
105
  return true
102
106
  }
103
107
 
104
108
  @Directive('@transaction')
105
109
  @Mutation(returns => Boolean, { description: 'To delete multiple ActivityThreads' })
106
- async deleteActivityThreads(@Arg('ids', type => [String]) ids: string[], @Ctx() context: any): Promise<boolean> {
110
+ async deleteActivityThreads(
111
+ @Arg('ids', type => [String]) ids: string[],
112
+ @Ctx() context: ResolverContext
113
+ ): Promise<boolean> {
107
114
  const { domain, tx } = context.state
108
115
 
109
116
  await tx.getRepository(ActivityThread).delete({
110
- domain,
117
+ domain: { id: domain.id },
111
118
  id: In(ids)
112
119
  })
113
120
 
@@ -118,7 +125,7 @@ export class ActivityThreadMutation {
118
125
  @Mutation(returns => Boolean, { description: 'To import multiple ActivityThreads' })
119
126
  async importActivityThreads(
120
127
  @Arg('activityThreads', type => [ActivityThreadPatch]) activityThreads: ActivityThreadPatch[],
121
- @Ctx() context: any
128
+ @Ctx() context: ResolverContext
122
129
  ): Promise<boolean> {
123
130
  const { domain, tx } = context.state
124
131
 
@@ -141,9 +148,9 @@ export class ActivityThreadMutation {
141
148
  @Arg('id') id: string,
142
149
  @Arg('output', type => ScalarObject, { nullable: true }) output: { [key: string]: any },
143
150
  @Arg('reason', { nullable: true }) reason: string,
144
- @Ctx() context: any
151
+ @Ctx() context: ResolverContext
145
152
  ): Promise<ActivityThread> {
146
- return await start(id, output, reason, context.state)
153
+ return await start(id, output, reason, context)
147
154
  }
148
155
 
149
156
  @Directive('@transaction')
@@ -153,9 +160,9 @@ export class ActivityThreadMutation {
153
160
  @Arg('assigneeRole', type => ObjectRef, { nullable: true }) assigneeRole: ObjectRef,
154
161
  @Arg('dueAt', { nullable: true }) dueAt: Date,
155
162
  @Arg('reason', { nullable: true }) reason: string,
156
- @Ctx() context: any
163
+ @Ctx() context: ResolverContext
157
164
  ): Promise<ActivityThread> {
158
- return await delegate({ id, assigneeRole, dueAt, reason }, context.state)
165
+ return await delegate({ id, assigneeRole, dueAt, reason }, context)
159
166
  }
160
167
 
161
168
  @Directive('@transaction')
@@ -163,9 +170,9 @@ export class ActivityThreadMutation {
163
170
  async saveActivityThread(
164
171
  @Arg('id') id: string,
165
172
  @Arg('save') save: ActivityThreadSave,
166
- @Ctx() context: any
173
+ @Ctx() context: ResolverContext
167
174
  ): Promise<ActivityThread> {
168
- return await saveActivityThread(id, save, context.state)
175
+ return await saveActivityThread(id, save, context)
169
176
  }
170
177
 
171
178
  @Directive('@transaction')
@@ -174,9 +181,9 @@ export class ActivityThreadMutation {
174
181
  @Arg('id') id: string,
175
182
  @Arg('output', type => ScalarObject, { nullable: true }) output: { [key: string]: any },
176
183
  @Arg('reason', { nullable: true }) reason: string,
177
- @Ctx() context: any
184
+ @Ctx() context: ResolverContext
178
185
  ): Promise<ActivityThread> {
179
- return await end({ id, output, reason }, context.state)
186
+ return await end({ id, output, reason }, context)
180
187
  }
181
188
 
182
189
  @Directive('@transaction')
@@ -184,8 +191,8 @@ export class ActivityThreadMutation {
184
191
  async abortActivityThread(
185
192
  @Arg('id') id: string,
186
193
  @Arg('reason', { nullable: true }) reason: string,
187
- @Ctx() context: any
194
+ @Ctx() context: ResolverContext
188
195
  ): Promise<ActivityThread> {
189
- return await abort({ id, reason }, context.state)
196
+ return await abort({ id, reason }, context)
190
197
  }
191
198
  }
@@ -1,8 +1,7 @@
1
1
  import { Arg, Args, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'
2
- import { getRepository } from 'typeorm'
3
2
 
4
3
  import { User } from '@things-factory/auth-base'
5
- import { Domain, getQueryBuilderFromListParams, ListParam } from '@things-factory/shell'
4
+ import { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
6
5
 
7
6
  import { ActivityInstance } from '../activity-instance/activity-instance'
8
7
  import { ActivityThread, ActivityThreadStatus } from './activity-thread'
@@ -11,16 +10,16 @@ import { ActivityThreadList } from './activity-thread-type'
11
10
  @Resolver(ActivityThread)
12
11
  export class ActivityThreadQuery {
13
12
  @Query(returns => ActivityThread!, { nullable: true, description: 'To fetch a ActivityThread' })
14
- async activityThread(@Arg('id') id: string, @Ctx() context: any): Promise<ActivityThread> {
13
+ async activityThread(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<ActivityThread> {
15
14
  const { domain } = context.state
16
15
 
17
16
  return await getRepository(ActivityThread).findOne({
18
- where: { domain, id }
17
+ where: { domain: { id: domain.id }, id }
19
18
  })
20
19
  }
21
20
 
22
21
  @Query(returns => ActivityThreadList, { description: 'To fetch multiple ActivityThreads' })
23
- async activityThreads(@Args() params: ListParam, @Ctx() context: any): Promise<ActivityThreadList> {
22
+ async activityThreads(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<ActivityThreadList> {
24
23
  const { domain } = context.state
25
24
 
26
25
  const queryBuilder = getQueryBuilderFromListParams({
@@ -36,7 +35,7 @@ export class ActivityThreadQuery {
36
35
  }
37
36
 
38
37
  @Query(returns => ActivityThreadList, { description: 'To fetch my own ActivityThreads' })
39
- async todoList(@Args() params: ListParam, @Ctx() context: any): Promise<ActivityThreadList> {
38
+ async todoList(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<ActivityThreadList> {
40
39
  var { domain, user } = context.state
41
40
 
42
41
  const status = [ActivityThreadStatus.Assigned, ActivityThreadStatus.Started]
@@ -62,27 +61,27 @@ export class ActivityThreadQuery {
62
61
  @FieldResolver(type => User)
63
62
  async assignee(@Root() activityThread: ActivityThread): Promise<User> {
64
63
  return activityThread.assigneeId
65
- ? activityThread.assignee || (await getRepository(User).findOne(activityThread.assigneeId))
64
+ ? activityThread.assignee || (await getRepository(User).findOneBy({ id: activityThread.assigneeId }))
66
65
  : null
67
66
  }
68
67
 
69
68
  @FieldResolver(type => ActivityInstance)
70
69
  async activityInstance(@Root() activityThread: ActivityThread): Promise<ActivityInstance> {
71
- return await getRepository(ActivityInstance).findOne(activityThread.activityInstanceId)
70
+ return await getRepository(ActivityInstance).findOneBy({ id: activityThread.activityInstanceId })
72
71
  }
73
72
 
74
73
  @FieldResolver(type => Domain)
75
74
  async domain(@Root() activityThread: ActivityThread): Promise<Domain> {
76
- return await getRepository(Domain).findOne(activityThread.domainId)
75
+ return await getRepository(Domain).findOneBy({ id: activityThread.domainId })
77
76
  }
78
77
 
79
78
  @FieldResolver(type => User)
80
79
  async updater(@Root() activityThread: ActivityThread): Promise<User> {
81
- return await getRepository(User).findOne(activityThread.updaterId)
80
+ return await getRepository(User).findOneBy({ id: activityThread.updaterId })
82
81
  }
83
82
 
84
83
  @FieldResolver(type => User)
85
84
  async creator(@Root() activityThread: ActivityThread): Promise<User> {
86
- return await getRepository(User).findOne(activityThread.creatorId)
85
+ return await getRepository(User).findOneBy({ id: activityThread.creatorId })
87
86
  }
88
87
  }
@@ -14,8 +14,12 @@ export class ActivityThreadSubscriber implements EntitySubscriberInterface<Activ
14
14
 
15
15
  async afterInsert(event: InsertEvent<ActivityThread>): Promise<any> {
16
16
  const activityThread = event.entity
17
+ const { domain, creator: user } = activityThread
17
18
 
18
- await updateActivityInstanceState(activityThread.activityInstanceId, { tx: event.manager })
19
+ await updateActivityInstanceState(activityThread.activityInstanceId, {
20
+ state: { tx: event.manager, domain, user },
21
+ t: null
22
+ })
19
23
 
20
24
  pubsub.publish('activity-thread', {
21
25
  activityThread
@@ -26,8 +30,12 @@ export class ActivityThreadSubscriber implements EntitySubscriberInterface<Activ
26
30
 
27
31
  async afterUpdate(event: UpdateEvent<ActivityThread>): Promise<any> {
28
32
  const activityThread = event.entity
33
+ const { domain, updater: user } = activityThread
29
34
 
30
- await updateActivityInstanceState(activityThread.activityInstanceId, { tx: event.manager })
35
+ await updateActivityInstanceState(activityThread.activityInstanceId, {
36
+ state: { tx: event.manager, domain, user },
37
+ t: null
38
+ })
31
39
 
32
40
  pubsub.publish('activity-thread', {
33
41
  activityThread
@@ -37,7 +45,11 @@ export class ActivityThreadSubscriber implements EntitySubscriberInterface<Activ
37
45
 
38
46
  async afterRemove(event: RemoveEvent<ActivityThread>): Promise<any> {
39
47
  const activityThread = event.entity
48
+ const { domain, updater: user } = activityThread
40
49
 
41
- await updateActivityInstanceState(activityThread.activityInstanceId, { tx: event.manager })
50
+ await updateActivityInstanceState(activityThread.activityInstanceId, {
51
+ state: { tx: event.manager, domain, user },
52
+ t: null
53
+ })
42
54
  }
43
55
  }
@@ -1,6 +1,9 @@
1
1
  {
2
2
  "button.assign": "assign",
3
+ "button.buy": "buy",
4
+ "button.draft": "draft",
3
5
  "button.finish": "finish",
6
+ "button.post": "post",
4
7
  "button.start": "start",
5
8
  "field.activity-type": "activity type",
6
9
  "field.assignee": "assignee",
@@ -1,6 +1,9 @@
1
1
  {
2
2
  "button.assign": "할당",
3
+ "button.buy": "구매",
4
+ "button.draft": "초안",
3
5
  "button.finish": "완료",
6
+ "button.post": "게시",
4
7
  "button.start": "시작",
5
8
  "field.activity-type": "업무 타입",
6
9
  "field.assignee": "피할당자",
@@ -1,6 +1,9 @@
1
1
  {
2
2
  "button.assign": "assign",
3
+ "button.buy": "buy",
4
+ "button.draft": "draft",
3
5
  "button.finish": "finish",
6
+ "button.post": "post",
4
7
  "button.start": "start",
5
8
  "field.activity-type": "activity type",
6
9
  "field.assignee": "assignee",
@@ -1,6 +1,9 @@
1
1
  {
2
2
  "button.assign": "assign",
3
+ "button.buy": "buy",
4
+ "button.draft": "draft",
3
5
  "button.finish": "finish",
6
+ "button.post": "post",
4
7
  "button.start": "start",
5
8
  "field.activity-type": "activity type",
6
9
  "field.assignee": "assignee",