@things-factory/worklist 6.2.105 → 6.2.111

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 (107) hide show
  1. package/client/components/activity-starter-form.ts +16 -23
  2. package/client/components/{activity-approval-timeline.ts → activity-thread-timeline.ts} +73 -10
  3. package/client/index.ts +2 -1
  4. package/client/pages/activity-approval/activity-approval-page.ts +19 -7
  5. package/client/pages/activity-instance/activity-instance-view.ts +10 -36
  6. package/client/pages/activity-thread/activity-thread-page.ts +19 -6
  7. package/client/pages/activity-thread/activity-thread-view-page.ts +26 -7
  8. package/client/pages/activity-thread/activity-thread-view.ts +44 -19
  9. package/client/templates/activity-approval-context-template.ts +8 -2
  10. package/client/templates/activity-thread-context-template.ts +4 -17
  11. package/client/types/activity-thread-history.ts +47 -0
  12. package/client/types/activity-thread.ts +5 -0
  13. package/dist-client/components/activity-starter-form.js +15 -21
  14. package/dist-client/components/activity-starter-form.js.map +1 -1
  15. package/dist-client/components/{activity-approval-timeline.d.ts → activity-thread-timeline.d.ts} +9 -3
  16. package/dist-client/components/{activity-approval-timeline.js → activity-thread-timeline.js} +74 -16
  17. package/dist-client/components/activity-thread-timeline.js.map +1 -0
  18. package/dist-client/index.d.ts +2 -1
  19. package/dist-client/index.js +2 -1
  20. package/dist-client/index.js.map +1 -1
  21. package/dist-client/pages/activity-approval/activity-approval-page.d.ts +1 -1
  22. package/dist-client/pages/activity-approval/activity-approval-page.js +19 -7
  23. package/dist-client/pages/activity-approval/activity-approval-page.js.map +1 -1
  24. package/dist-client/pages/activity-instance/activity-instance-view.js +8 -22
  25. package/dist-client/pages/activity-instance/activity-instance-view.js.map +1 -1
  26. package/dist-client/pages/activity-thread/activity-thread-page.d.ts +1 -0
  27. package/dist-client/pages/activity-thread/activity-thread-page.js +19 -6
  28. package/dist-client/pages/activity-thread/activity-thread-page.js.map +1 -1
  29. package/dist-client/pages/activity-thread/activity-thread-view-page.d.ts +1 -1
  30. package/dist-client/pages/activity-thread/activity-thread-view-page.js +26 -7
  31. package/dist-client/pages/activity-thread/activity-thread-view-page.js.map +1 -1
  32. package/dist-client/pages/activity-thread/activity-thread-view.js +44 -19
  33. package/dist-client/pages/activity-thread/activity-thread-view.js.map +1 -1
  34. package/dist-client/templates/activity-approval-context-template.d.ts +1 -1
  35. package/dist-client/templates/activity-approval-context-template.js +8 -2
  36. package/dist-client/templates/activity-approval-context-template.js.map +1 -1
  37. package/dist-client/templates/activity-thread-context-template.d.ts +1 -1
  38. package/dist-client/templates/activity-thread-context-template.js +5 -18
  39. package/dist-client/templates/activity-thread-context-template.js.map +1 -1
  40. package/dist-client/tsconfig.tsbuildinfo +1 -1
  41. package/dist-client/types/activity-thread-history.d.ts +28 -0
  42. package/dist-client/types/activity-thread-history.js +7 -0
  43. package/dist-client/types/activity-thread-history.js.map +1 -0
  44. package/dist-client/types/activity-thread.d.ts +3 -0
  45. package/dist-client/types/activity-thread.js.map +1 -1
  46. package/dist-server/controllers/activity-approval/_abort.js +3 -1
  47. package/dist-server/controllers/activity-approval/_abort.js.map +1 -1
  48. package/dist-server/controllers/activity-approval/abort.js.map +1 -1
  49. package/dist-server/controllers/activity-approval/approve.js +2 -2
  50. package/dist-server/controllers/activity-approval/approve.js.map +1 -1
  51. package/dist-server/controllers/activity-approval/delegate.js +2 -1
  52. package/dist-server/controllers/activity-approval/delegate.js.map +1 -1
  53. package/dist-server/controllers/activity-approval/reject.js +1 -1
  54. package/dist-server/controllers/activity-approval/reject.js.map +1 -1
  55. package/dist-server/controllers/activity-thread/_abort.js.map +1 -1
  56. package/dist-server/controllers/activity-thread/abort.js.map +1 -1
  57. package/dist-server/controllers/activity-thread/delegate.js +1 -2
  58. package/dist-server/controllers/activity-thread/delegate.js.map +1 -1
  59. package/dist-server/controllers/activity-thread/end.js.map +1 -1
  60. package/dist-server/controllers/activity-thread/restart.js.map +1 -1
  61. package/dist-server/controllers/activity-thread/save.js +1 -1
  62. package/dist-server/controllers/activity-thread/save.js.map +1 -1
  63. package/dist-server/controllers/activity-thread/start.js.map +1 -1
  64. package/dist-server/controllers/activity-thread/submit.js.map +1 -1
  65. package/dist-server/service/activity-approval/activity-approval-subscription.js.map +1 -1
  66. package/dist-server/service/activity-approval/activity-approval.js.map +1 -1
  67. package/dist-server/service/activity-thread/activity-thread-history-query.js +65 -0
  68. package/dist-server/service/activity-thread/activity-thread-history-query.js.map +1 -0
  69. package/dist-server/service/activity-thread/activity-thread-history.js +10 -11
  70. package/dist-server/service/activity-thread/activity-thread-history.js.map +1 -1
  71. package/dist-server/service/activity-thread/activity-thread-mutation.js +1 -1
  72. package/dist-server/service/activity-thread/activity-thread-mutation.js.map +1 -1
  73. package/dist-server/service/activity-thread/activity-thread-query.js +20 -3
  74. package/dist-server/service/activity-thread/activity-thread-query.js.map +1 -1
  75. package/dist-server/service/activity-thread/activity-thread.js +5 -0
  76. package/dist-server/service/activity-thread/activity-thread.js.map +1 -1
  77. package/dist-server/service/activity-thread/index.js +2 -1
  78. package/dist-server/service/activity-thread/index.js.map +1 -1
  79. package/dist-server/tsconfig.tsbuildinfo +1 -1
  80. package/package.json +4 -4
  81. package/server/controllers/activity-approval/_abort.ts +12 -1
  82. package/server/controllers/activity-approval/abort.ts +2 -9
  83. package/server/controllers/activity-approval/approve.ts +3 -4
  84. package/server/controllers/activity-approval/delegate.ts +6 -6
  85. package/server/controllers/activity-approval/reject.ts +3 -9
  86. package/server/controllers/activity-thread/_abort.ts +1 -4
  87. package/server/controllers/activity-thread/abort.ts +1 -4
  88. package/server/controllers/activity-thread/delegate.ts +1 -1
  89. package/server/controllers/activity-thread/end.ts +1 -4
  90. package/server/controllers/activity-thread/restart.ts +1 -6
  91. package/server/controllers/activity-thread/save.ts +1 -1
  92. package/server/controllers/activity-thread/start.ts +1 -6
  93. package/server/controllers/activity-thread/submit.ts +2 -6
  94. package/server/service/activity-approval/activity-approval-subscription.ts +1 -2
  95. package/server/service/activity-approval/activity-approval.ts +1 -11
  96. package/server/service/activity-thread/activity-thread-history-query.ts +34 -0
  97. package/server/service/activity-thread/activity-thread-history.ts +10 -22
  98. package/server/service/activity-thread/activity-thread-mutation.ts +4 -20
  99. package/server/service/activity-thread/activity-thread-query.ts +15 -7
  100. package/server/service/activity-thread/activity-thread.ts +8 -19
  101. package/server/service/activity-thread/index.ts +2 -1
  102. package/translations/en.json +11 -1
  103. package/translations/ja.json +12 -2
  104. package/translations/ko.json +12 -2
  105. package/translations/ms.json +12 -2
  106. package/translations/zh.json +11 -1
  107. package/dist-client/components/activity-approval-timeline.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/worklist",
3
- "version": "6.2.105",
3
+ "version": "6.2.111",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "things-factory": true,
@@ -32,12 +32,12 @@
32
32
  "@operato/grist-editor": "^1.0.0",
33
33
  "@things-factory/attachment-base": "^6.2.103",
34
34
  "@things-factory/auth-base": "^6.2.103",
35
- "@things-factory/board-service": "^6.2.105",
35
+ "@things-factory/board-service": "^6.2.111",
36
36
  "@things-factory/context-ui": "^6.2.103",
37
- "@things-factory/organization": "^6.2.103",
37
+ "@things-factory/organization": "^6.2.111",
38
38
  "@things-factory/scheduler-client": "^6.2.103",
39
39
  "@things-factory/shell": "^6.2.103",
40
40
  "moment-timezone": "^0.5.40"
41
41
  },
42
- "gitHead": "891a2aea81fd948e4e8b342f88914ed579252c41"
42
+ "gitHead": "8424feb14ae84e99377321dc36454358631a560c"
43
43
  }
@@ -1,10 +1,11 @@
1
+ import { ActivityThread, ActivityThreadStatus } from '../../service/activity-thread/activity-thread'
1
2
  import { ActivityApproval, ActivityApprovalJudgment } from '../../service/activity-approval/activity-approval'
2
3
 
3
4
  export async function _abort(
4
5
  { activityApproval, comment }: { activityApproval: ActivityApproval; comment: string },
5
6
  context: ResolverContext
6
7
  ): Promise<ActivityApproval> {
7
- const { domain, user, tx } = context.state
8
+ const { user, tx } = context.state
8
9
 
9
10
  var result = await tx.getRepository(ActivityApproval).save({
10
11
  ...activityApproval,
@@ -16,5 +17,15 @@ export async function _abort(
16
17
  terminator: user
17
18
  })
18
19
 
20
+ await tx.getRepository(ActivityThread).save({
21
+ ...activityApproval.activityThread,
22
+ transaction: 'abort',
23
+ reason: comment,
24
+ state: ActivityThreadStatus.Aborted,
25
+ updater: user,
26
+ terminatedAt: new Date(),
27
+ terminator: user
28
+ })
29
+
19
30
  return result
20
31
  }
@@ -2,10 +2,7 @@ import { ActivityApproval, ActivityApprovalJudgment } from '../../service/activi
2
2
  import { updateActivityInstanceState } from '../common'
3
3
  import { _abort } from './_abort'
4
4
 
5
- export async function abort(
6
- { id, comment }: { id: string; comment: string },
7
- context: ResolverContext
8
- ): Promise<ActivityApproval> {
5
+ export async function abort({ id, comment }: { id: string; comment: string }, context: ResolverContext): Promise<ActivityApproval> {
9
6
  const { domain, user, tx } = context.state
10
7
 
11
8
  var repository = tx.getRepository(ActivityApproval)
@@ -38,11 +35,7 @@ export async function abort(
38
35
 
39
36
  var result = await _abort({ activityApproval, comment }, context)
40
37
 
41
- await updateActivityInstanceState(
42
- activityApproval.activityThread.activityInstanceId,
43
- { causedBy: [activityApproval.activityThread] },
44
- context
45
- )
38
+ await updateActivityInstanceState(activityApproval.activityThread.activityInstanceId, { causedBy: [activityApproval.activityThread] }, context)
46
39
 
47
40
  return result
48
41
  }
@@ -4,10 +4,7 @@ import { ActivityApproval, ActivityApprovalJudgment } from '../../service/activi
4
4
  import { ApprovalLineItem } from '@things-factory/organization'
5
5
  import { updateActivityInstanceState } from '../common'
6
6
 
7
- export async function approve(
8
- { id, comment }: { id: string; comment: string },
9
- context: ResolverContext
10
- ): Promise<ActivityApproval> {
7
+ export async function approve({ id, comment }: { id: string; comment: string }, context: ResolverContext): Promise<ActivityApproval> {
11
8
  const { domain, user, tx } = context.state
12
9
 
13
10
  var repository = tx.getRepository(ActivityApproval)
@@ -77,6 +74,7 @@ export async function approve(
77
74
  activityThread = await tx.getRepository(ActivityThread).save({
78
75
  ...activityThread,
79
76
  transaction: 'escalate',
77
+ reaseon: comment,
80
78
  state: ActivityThreadStatus.Escalated,
81
79
  updater: user
82
80
  })
@@ -84,6 +82,7 @@ export async function approve(
84
82
  activityThread = await tx.getRepository(ActivityThread).save({
85
83
  ...activityThread,
86
84
  transaction: 'approve',
85
+ reason: comment,
87
86
  state: ActivityThreadStatus.Ended,
88
87
  terminatedAt: new Date(),
89
88
  terminator: user,
@@ -1,11 +1,9 @@
1
1
  import { User } from '@things-factory/auth-base'
2
2
  import { ObjectRef } from '@things-factory/shell'
3
3
  import { ActivityApproval, ActivityApprovalJudgment } from '../../service/activity-approval/activity-approval'
4
+ import { ActivityThread } from '../../service/activity-thread/activity-thread'
4
5
 
5
- export async function delegate(
6
- { id, to, comment }: { id: string; to: ObjectRef; comment: string },
7
- context: ResolverContext
8
- ): Promise<ActivityApproval> {
6
+ export async function delegate({ id, to, comment }: { id: string; to: ObjectRef; comment: string }, context: ResolverContext): Promise<ActivityApproval> {
9
7
  const { domain, user, tx } = context.state
10
8
 
11
9
  var repository = tx.getRepository(ActivityApproval)
@@ -50,13 +48,15 @@ export async function delegate(
50
48
  })
51
49
 
52
50
  /* terminate origin approval */
53
- return await repository.save({
51
+ const result = await repository.save({
54
52
  ...activityApproval,
55
53
  judgment: ActivityApprovalJudgment.Delegated,
56
- comment,
54
+ reason: comment,
57
55
  transaction: 'delegate',
58
56
  updater: user,
59
57
  terminator: user,
60
58
  terminatedAt: new Date()
61
59
  })
60
+
61
+ return result
62
62
  }
@@ -2,10 +2,7 @@ import { ActivityThread, ActivityThreadStatus } from '../../service/activity-thr
2
2
  import { ActivityApproval, ActivityApprovalJudgment } from '../../service/activity-approval/activity-approval'
3
3
  import { updateActivityInstanceState } from '../common'
4
4
 
5
- export async function reject(
6
- { id, comment }: { id: string; comment: string },
7
- context: ResolverContext
8
- ): Promise<ActivityApproval> {
5
+ export async function reject({ id, comment }: { id: string; comment: string }, context: ResolverContext): Promise<ActivityApproval> {
9
6
  const { domain, user, tx } = context.state
10
7
 
11
8
  var repository = tx.getRepository(ActivityApproval)
@@ -49,15 +46,12 @@ export async function reject(
49
46
  var activityThread = await tx.getRepository(ActivityThread).save({
50
47
  ...activityApproval.activityThread,
51
48
  transaction: 'reject',
49
+ reason: comment,
52
50
  state: ActivityThreadStatus.Rejected,
53
51
  updater: user
54
52
  })
55
53
 
56
- await updateActivityInstanceState(
57
- activityApproval.activityThread.activityInstanceId,
58
- { causedBy: [activityThread] },
59
- context
60
- )
54
+ await updateActivityInstanceState(activityApproval.activityThread.activityInstanceId, { causedBy: [activityThread] }, context)
61
55
 
62
56
  return result
63
57
  }
@@ -2,10 +2,7 @@ import { ActivityThread, ActivityThreadStatus } from '../../service/activity-thr
2
2
  import { ActivityApproval, ActivityApprovalJudgment } from '../../service/activity-approval/activity-approval'
3
3
  import { _abort as abortActivityApproval } from '../activity-approval/_abort'
4
4
 
5
- export async function _abort(
6
- { activityThread, reason }: { activityThread: ActivityThread; reason: string },
7
- context: ResolverContext
8
- ): Promise<ActivityThread> {
5
+ export async function _abort({ activityThread, reason }: { activityThread: ActivityThread; reason: string }, context: ResolverContext): Promise<ActivityThread> {
9
6
  const { domain, user, tx } = context.state
10
7
 
11
8
  var repository = tx.getRepository(ActivityThread)
@@ -2,10 +2,7 @@ import { ActivityThread, ActivityThreadStatus } from '../../service/activity-thr
2
2
  import { updateActivityInstanceState } from '../common'
3
3
  import { _abort } from './_abort'
4
4
 
5
- export async function abort(
6
- { id, reason }: { id: string; reason: string },
7
- context: ResolverContext
8
- ): Promise<ActivityThread> {
5
+ export async function abort({ id, reason }: { id: string; reason: string }, context: ResolverContext): Promise<ActivityThread> {
9
6
  const { domain, user, tx } = context.state
10
7
 
11
8
  var repository = tx.getRepository(ActivityThread)
@@ -50,9 +50,9 @@ export async function delegate(
50
50
 
51
51
  const result = await repository.save({
52
52
  ...activityThread,
53
- reason,
54
53
  assignee,
55
54
  transaction: 'delegate',
55
+ reason,
56
56
  state: ActivityThreadStatus.Assigned,
57
57
  updater: user,
58
58
  assignedAt: new Date()
@@ -1,10 +1,7 @@
1
1
  import { ActivityThread, ActivityThreadStatus } from '../../service/activity-thread/activity-thread'
2
2
  import { updateActivityInstanceState } from '../common'
3
3
 
4
- export async function end(
5
- { id, output, reason }: { id: string; output?: object; reason?: string },
6
- context: ResolverContext
7
- ): Promise<ActivityThread> {
4
+ export async function end({ id, output, reason }: { id: string; output?: object; reason?: string }, context: ResolverContext): Promise<ActivityThread> {
8
5
  const { domain, user, tx } = context.state
9
6
 
10
7
  const repository = tx.getRepository(ActivityThread)
@@ -1,12 +1,7 @@
1
1
  import { ActivityThread, ActivityThreadStatus } from '../../service/activity-thread/activity-thread'
2
2
  import { updateActivityInstanceState } from '../common'
3
3
 
4
- export async function restart(
5
- id: string,
6
- output: object,
7
- reason: string,
8
- context: ResolverContext
9
- ): Promise<ActivityThread> {
4
+ export async function restart(id: string, output: object, reason: string, context: ResolverContext): Promise<ActivityThread> {
10
5
  const { domain, user, tx } = context.state
11
6
 
12
7
  const repository = tx.getRepository(ActivityThread)
@@ -2,7 +2,7 @@ import { ActivityThreadSave } from '../../service/activity-thread/activity-threa
2
2
  import { updateActivityInstanceState } from '../common'
3
3
  import { ActivityThread, ActivityThreadStatus } from '../../service/activity-thread/activity-thread'
4
4
 
5
- export async function save(id: string, save: ActivityThreadSave, context: ResolverContext): Promise<ActivityThread> {
5
+ export async function save(id: string, save: ActivityThreadSave, reason: string, context: ResolverContext): Promise<ActivityThread> {
6
6
  const { domain, user, tx } = context.state
7
7
  const repository = tx.getRepository(ActivityThread)
8
8
 
@@ -1,12 +1,7 @@
1
1
  import { ActivityThread, ActivityThreadStatus } from '../../service/activity-thread/activity-thread'
2
2
  import { updateActivityInstanceState } from '../common'
3
3
 
4
- export async function start(
5
- id: string,
6
- output: object,
7
- reason: string,
8
- context: ResolverContext
9
- ): Promise<ActivityThread> {
4
+ export async function start(id: string, output: object, reason: string, context: ResolverContext): Promise<ActivityThread> {
10
5
  const { domain, user, tx } = context.state
11
6
 
12
7
  const repository = tx.getRepository(ActivityThread)
@@ -1,13 +1,9 @@
1
1
  import { ActivityThread, ActivityThreadStatus } from '../../service/activity-thread/activity-thread'
2
2
  import { ActivityApproval, ActivityApprovalJudgment } from '../../service/activity-approval/activity-approval'
3
3
  import { getSystemUserFromOrgMemberItem, updateActivityInstanceState } from '../common'
4
- import { User } from '@things-factory/auth-base'
5
- import { Department, Employee, ApprovalLineItem, OrgMemberTargetType } from '@things-factory/organization'
4
+ import { ApprovalLineItem } from '@things-factory/organization'
6
5
 
7
- export async function submit(
8
- { id, output, reason }: { id: string; output?: object; reason?: string },
9
- context: ResolverContext
10
- ): Promise<ActivityThread> {
6
+ export async function submit({ id, output, reason }: { id: string; output?: object; reason?: string }, context: ResolverContext): Promise<ActivityThread> {
11
7
  const { domain, user, tx } = context.state
12
8
 
13
9
  const repository = tx.getRepository(ActivityThread)
@@ -1,8 +1,7 @@
1
1
  import { withFilter } from 'graphql-subscriptions'
2
2
  import { Resolver, Root, Subscription } from 'type-graphql'
3
3
 
4
- import { User } from '@things-factory/auth-base'
5
- import { getRepository, pubsub } from '@things-factory/shell'
4
+ import { pubsub } from '@things-factory/shell'
6
5
 
7
6
  import { ActivityApproval } from './activity-approval'
8
7
 
@@ -1,14 +1,4 @@
1
- import {
2
- CreateDateColumn,
3
- UpdateDateColumn,
4
- Entity,
5
- Index,
6
- Column,
7
- RelationId,
8
- ManyToOne,
9
- OneToMany,
10
- PrimaryGeneratedColumn
11
- } from 'typeorm'
1
+ import { CreateDateColumn, UpdateDateColumn, Entity, Index, Column, RelationId, ManyToOne, OneToMany, PrimaryGeneratedColumn } from 'typeorm'
12
2
  import { ObjectType, Field, Int, ID, registerEnumType } from 'type-graphql'
13
3
 
14
4
  import { Domain } from '@things-factory/shell'
@@ -0,0 +1,34 @@
1
+ import { FieldResolver, Resolver, Root } from 'type-graphql'
2
+
3
+ import { User } from '@things-factory/auth-base'
4
+ import { Domain, getRepository } from '@things-factory/shell'
5
+
6
+ import { ActivityThreadHistory } from './activity-thread-history'
7
+
8
+ @Resolver(ActivityThreadHistory)
9
+ export class ActivityThreadHistoryQuery {
10
+ @FieldResolver(type => User)
11
+ async assignee(@Root() activityThreadHistory: ActivityThreadHistory): Promise<User> {
12
+ return activityThreadHistory.assigneeId ? activityThreadHistory.assignee || (await getRepository(User).findOneBy({ id: activityThreadHistory.assigneeId })) : null
13
+ }
14
+
15
+ @FieldResolver(type => Domain)
16
+ async domain(@Root() activityThreadHistory: ActivityThreadHistory): Promise<Domain> {
17
+ return await getRepository(Domain).findOneBy({ id: activityThreadHistory.domainId })
18
+ }
19
+
20
+ @FieldResolver(type => User)
21
+ async updater(@Root() activityThreadHistory: ActivityThreadHistory): Promise<User> {
22
+ return activityThreadHistory.updaterId && (await getRepository(User).findOneBy({ id: activityThreadHistory.updaterId }))
23
+ }
24
+
25
+ @FieldResolver(type => User)
26
+ async creator(@Root() activityThreadHistory: ActivityThreadHistory): Promise<User> {
27
+ return activityThreadHistory.creatorId && (await getRepository(User).findOneBy({ id: activityThreadHistory.creatorId }))
28
+ }
29
+
30
+ @FieldResolver(type => User)
31
+ async terminator(@Root() activityThreadHistory: ActivityThreadHistory): Promise<User> {
32
+ return activityThreadHistory.terminatorId && (await getRepository(User).findOneBy({ id: activityThreadHistory.terminatorId }))
33
+ }
34
+ }
@@ -1,12 +1,7 @@
1
1
  import { Field, ID, Int, ObjectType } from 'type-graphql'
2
2
  import { Column, Entity, Index, ManyToOne, OneToMany, PrimaryGeneratedColumn, RelationId } from 'typeorm'
3
3
 
4
- import {
5
- HistoryActionColumn,
6
- HistoryActionType,
7
- HistoryEntityInterface,
8
- HistoryOriginalIdColumn
9
- } from '@operato/typeorm-history'
4
+ import { HistoryActionColumn, HistoryActionType, HistoryEntityInterface, HistoryOriginalIdColumn } from '@operato/typeorm-history'
10
5
  import { User } from '@things-factory/auth-base'
11
6
  import { config } from '@things-factory/env'
12
7
  import { Domain, ScalarObject } from '@things-factory/shell'
@@ -18,18 +13,12 @@ const ORMCONFIG = config.get('ormconfig', {})
18
13
  const DATABASE_TYPE = ORMCONFIG.type
19
14
 
20
15
  @Entity()
21
- @Index(
22
- 'ix_activity_thread_history_0',
23
- (activityThreadHistory: ActivityThreadHistory) => [activityThreadHistory.originalId, activityThreadHistory.version],
24
- { unique: true }
25
- )
16
+ @Index('ix_activity_thread_history_0', (activityThreadHistory: ActivityThreadHistory) => [activityThreadHistory.originalId, activityThreadHistory.version], {
17
+ unique: true
18
+ })
26
19
  @Index(
27
20
  'ix_activity_thread_history_1',
28
- (activityThreadHistory: ActivityThreadHistory) => [
29
- activityThreadHistory.domain,
30
- activityThreadHistory.originalId,
31
- activityThreadHistory.version
32
- ],
21
+ (activityThreadHistory: ActivityThreadHistory) => [activityThreadHistory.domain, activityThreadHistory.originalId, activityThreadHistory.version],
33
22
  { unique: true }
34
23
  )
35
24
  @ObjectType({ description: 'History Entity of ActivityThread' })
@@ -82,6 +71,10 @@ export class ActivityThreadHistory implements HistoryEntityInterface<ActivityThr
82
71
  @Field({ nullable: true })
83
72
  transaction: string
84
73
 
74
+ @Column({ nullable: true })
75
+ @Field({ nullable: true, description: 'Specific reason for the execution of the last transaction' })
76
+ reason?: string
77
+
85
78
  @Column({ nullable: true })
86
79
  @Field({ nullable: true })
87
80
  dueAt?: Date
@@ -132,12 +125,7 @@ export class ActivityThreadHistory implements HistoryEntityInterface<ActivityThr
132
125
 
133
126
  @HistoryActionColumn({
134
127
  nullable: false,
135
- type:
136
- DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
137
- ? 'enum'
138
- : DATABASE_TYPE == 'oracle'
139
- ? 'varchar2'
140
- : 'smallint',
128
+ type: DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb' ? 'enum' : DATABASE_TYPE == 'oracle' ? 'varchar2' : 'smallint',
141
129
  enum: HistoryActionType
142
130
  })
143
131
  public action!: HistoryActionType
@@ -3,15 +3,7 @@ import { In } from 'typeorm'
3
3
 
4
4
  import { ObjectRef, ScalarObject } from '@things-factory/shell'
5
5
 
6
- import {
7
- abort,
8
- delegate,
9
- end,
10
- restart,
11
- save as saveActivityThread,
12
- start,
13
- submit
14
- } from '../../controllers/activity-thread'
6
+ import { abort, delegate, end, restart, save as saveActivityThread, start, submit } from '../../controllers/activity-thread'
15
7
  import { ActivityThread } from './activity-thread'
16
8
  import { ActivityThreadSave } from './activity-thread-type'
17
9
 
@@ -55,12 +47,8 @@ export class ActivityThreadMutation {
55
47
 
56
48
  @Directive('@transaction')
57
49
  @Mutation(returns => ActivityThread, { description: 'To save ActivityThread information' })
58
- async saveActivityThread(
59
- @Arg('id') id: string,
60
- @Arg('save') save: ActivityThreadSave,
61
- @Ctx() context: ResolverContext
62
- ): Promise<ActivityThread> {
63
- return await saveActivityThread(id, save, context)
50
+ async saveActivityThread(@Arg('id') id: string, @Arg('save') save: ActivityThreadSave, @Ctx() context: ResolverContext): Promise<ActivityThread> {
51
+ return await saveActivityThread(id, save, '', context)
64
52
  }
65
53
 
66
54
  @Directive('@transaction')
@@ -87,11 +75,7 @@ export class ActivityThreadMutation {
87
75
 
88
76
  @Directive('@transaction')
89
77
  @Mutation(returns => ActivityThread, { description: 'To abort a ActivityThread' })
90
- async abortActivityThread(
91
- @Arg('id') id: string,
92
- @Arg('reason', { nullable: true }) reason: string,
93
- @Ctx() context: ResolverContext
94
- ): Promise<ActivityThread> {
78
+ async abortActivityThread(@Arg('id') id: string, @Arg('reason', { nullable: true }) reason: string, @Ctx() context: ResolverContext): Promise<ActivityThread> {
95
79
  return await abort({ id, reason }, context)
96
80
  }
97
81
 
@@ -7,6 +7,7 @@ import { ActivityInstance } from '../activity-instance/activity-instance'
7
7
  import { ActivityThread, ActivityThreadStatus } from './activity-thread'
8
8
  import { ActivityApproval } from '../activity-approval/activity-approval'
9
9
  import { ActivityThreadList } from './activity-thread-type'
10
+ import { ActivityThreadHistory } from './activity-thread-history'
10
11
 
11
12
  @Resolver(ActivityThread)
12
13
  export class ActivityThreadQuery {
@@ -95,9 +96,7 @@ export class ActivityThreadQuery {
95
96
 
96
97
  @FieldResolver(type => User)
97
98
  async assignee(@Root() activityThread: ActivityThread): Promise<User> {
98
- return activityThread.assigneeId
99
- ? activityThread.assignee || (await getRepository(User).findOneBy({ id: activityThread.assigneeId }))
100
- : null
99
+ return activityThread.assigneeId ? activityThread.assignee || (await getRepository(User).findOneBy({ id: activityThread.assigneeId })) : null
101
100
  }
102
101
 
103
102
  @FieldResolver(type => ActivityInstance)
@@ -106,15 +105,24 @@ export class ActivityThreadQuery {
106
105
  }
107
106
 
108
107
  @FieldResolver(type => [ActivityApproval])
109
- async activityApprovals(
110
- @Root() activityThread: ActivityThread,
111
- @Ctx() context: ResolverContext
112
- ): Promise<ActivityApproval[]> {
108
+ async activityApprovals(@Root() activityThread: ActivityThread, @Ctx() context: ResolverContext): Promise<ActivityApproval[]> {
113
109
  return await getRepository(ActivityApproval).findBy({
114
110
  activityThread: { id: activityThread.id }
115
111
  })
116
112
  }
117
113
 
114
+ @FieldResolver(type => [ActivityThreadHistory])
115
+ async activityThreadHistories(@Root() activityThread: ActivityThread, @Ctx() context: ResolverContext): Promise<ActivityThreadHistory[]> {
116
+ return await getRepository(ActivityThreadHistory).find({
117
+ where: {
118
+ originalId: activityThread.id
119
+ },
120
+ order: {
121
+ version: 'ASC'
122
+ }
123
+ })
124
+ }
125
+
118
126
  @FieldResolver(type => Domain)
119
127
  async domain(@Root() activityThread: ActivityThread): Promise<Domain> {
120
128
  return await getRepository(Domain).findOneBy({ id: activityThread.domainId })
@@ -1,16 +1,5 @@
1
1
  import { Field, ID, ObjectType, registerEnumType } from 'type-graphql'
2
- import {
3
- Column,
4
- CreateDateColumn,
5
- Entity,
6
- Index,
7
- OneToMany,
8
- ManyToOne,
9
- PrimaryGeneratedColumn,
10
- RelationId,
11
- VersionColumn,
12
- UpdateDateColumn
13
- } from 'typeorm'
2
+ import { Column, CreateDateColumn, Entity, Index, OneToMany, ManyToOne, PrimaryGeneratedColumn, RelationId, VersionColumn, UpdateDateColumn } from 'typeorm'
14
3
 
15
4
  import { User } from '@things-factory/auth-base'
16
5
  import { Domain, ScalarObject } from '@things-factory/shell'
@@ -34,13 +23,9 @@ registerEnumType(ActivityThreadStatus, {
34
23
  })
35
24
 
36
25
  @Entity()
37
- @Index(
38
- 'ix_activity_thread_0',
39
- (activityThread: ActivityThread) => [activityThread.activityInstance, activityThread.assignee],
40
- {
41
- unique: true
42
- }
43
- )
26
+ @Index('ix_activity_thread_0', (activityThread: ActivityThread) => [activityThread.activityInstance, activityThread.assignee], {
27
+ unique: true
28
+ })
44
29
  @ObjectType({ description: 'Entity for ActivityThread' })
45
30
  export class ActivityThread {
46
31
  @PrimaryGeneratedColumn('uuid')
@@ -88,6 +73,10 @@ export class ActivityThread {
88
73
  @Field({ nullable: true })
89
74
  transaction?: string
90
75
 
76
+ @Column({ nullable: true })
77
+ @Field({ nullable: true, description: 'Specific reason for the execution of the last transaction' })
78
+ reason?: string
79
+
91
80
  @OneToMany(type => ActivityApproval, activityApproval => activityApproval.activityThread)
92
81
  @Field(type => [ActivityApproval])
93
82
  activityApprovals?: ActivityApproval[]
@@ -2,9 +2,10 @@ import { ActivityThread } from './activity-thread'
2
2
  import { ActivityThreadHistory } from './activity-thread-history'
3
3
  import { ActivityThreadMutation } from './activity-thread-mutation'
4
4
  import { ActivityThreadQuery } from './activity-thread-query'
5
+ import { ActivityThreadHistoryQuery } from './activity-thread-history-query'
5
6
  import { ActivityThreadSubscription } from './activity-thread-subscription'
6
7
  import { ActivityThreadHistoryEntitySubscriber, ActivityThreadSubscriber } from './event-subscriber'
7
8
 
8
9
  export const entities = [ActivityThread, ActivityThreadHistory]
9
- export const resolvers = [ActivityThreadQuery, ActivityThreadMutation, ActivityThreadSubscription]
10
+ export const resolvers = [ActivityThreadQuery, ActivityThreadHistoryQuery, ActivityThreadMutation, ActivityThreadSubscription]
10
11
  export const subscribers = [ActivityThreadSubscriber, ActivityThreadHistoryEntitySubscriber]
@@ -82,6 +82,15 @@
82
82
  "label.activity-state-rejected": "rejected",
83
83
  "label.activity-state-ended": "ended",
84
84
  "label.activity-state-aborted": "aborted",
85
+ "label.activity-transaction-abort": "abort",
86
+ "label.activity-transaction-approve": "approve",
87
+ "label.activity-transaction-end": "end",
88
+ "label.activity-transaction-issue": "issue",
89
+ "label.activity-transaction-post": "post",
90
+ "label.activity-transaction-reject": "reject",
91
+ "label.activity-transaction-restart": "restart",
92
+ "label.activity-transaction-save": "save",
93
+ "label.activity-transaction-submit": "submit",
85
94
  "label.days": "days",
86
95
  "label.filter-released": "released",
87
96
  "label.filter-draft": "aborted",
@@ -97,11 +106,12 @@
97
106
  "label.hours": "hours",
98
107
  "label.information": "information",
99
108
  "label.minutes": "minutes",
100
- "label.review-and-approval": "review and approval",
101
109
  "label.seconds": "seconds",
110
+ "label.timeline": "timeline",
102
111
  "text.assign": "assign",
103
112
  "text.draft": "draft",
104
113
  "text.installable-activities": "installable activities",
114
+ "text.no activity thread info": "no activity thread information",
105
115
  "text.pick": "pick",
106
116
  "text.save": "save",
107
117
  "text.enter a comment": "please, enter a comment",
@@ -73,7 +73,7 @@
73
73
  "label.activity-state-deprecated": "廃棄済み",
74
74
  "label.activity-state-pending-assignment": "割当待機",
75
75
  "label.activity-state-assigned": "割当済み",
76
- "label.activity-state-started": "進行中",
76
+ "label.activity-state-started": "開始された",
77
77
  "label.activity-state-delegated": "委任済み",
78
78
  "label.activity-state-submitted": "提出済み",
79
79
  "label.activity-state-escalated": "上位承認中",
@@ -82,6 +82,15 @@
82
82
  "label.activity-state-approved": "承認済み",
83
83
  "label.activity-state-ended": "完了済み",
84
84
  "label.activity-state-aborted": "キャンセル済み",
85
+ "label.activity-transaction-abort": "中止",
86
+ "label.activity-transaction-approve": "承認",
87
+ "label.activity-transaction-end": "終了",
88
+ "label.activity-transaction-issue": "発行",
89
+ "label.activity-transaction-post": "投稿",
90
+ "label.activity-transaction-reject": "拒否",
91
+ "label.activity-transaction-restart": "再開",
92
+ "label.activity-transaction-save": "保存",
93
+ "label.activity-transaction-submit": "提出",
85
94
  "label.days": "日",
86
95
  "label.filter-released": "配布",
87
96
  "label.filter-draft": "ドラフト",
@@ -97,8 +106,8 @@
97
106
  "label.hours": "時間",
98
107
  "label.information": "基本情報",
99
108
  "label.minutes": "分",
100
- "label.review-and-approval": "レビューと承認",
101
109
  "label.seconds": "秒",
110
+ "label.timeline": "タイムライン",
102
111
  "text.assign": "割当",
103
112
  "text.draft": "ドラフト保存",
104
113
  "text.installable-activities": "設置可能業務",
@@ -106,6 +115,7 @@
106
115
  "text.save": "保存",
107
116
  "text.enter a comment": "コメントを残してください。",
108
117
  "text.explain the reason for approval/rejection": "承認/却下の理由を簡潔に説明してください。",
118
+ "text.no activity thread info": "アクティビティスレッド情報なし",
109
119
  "text.task_is_finished_successfully": "業務が成功的に完了しました。",
110
120
  "text.task_is_saved_successfully": "業務が正常に保存されました。",
111
121
  "text.task_is_started_successfully": "業務が正常に開始されました。",