@things-factory/worklist 5.0.11 → 5.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/components/activity-/bowner-view.js +0 -1
- package/client/components/activity-instance-preview.js +1 -2
- package/client/components/activity-intro-view.ts +0 -1
- package/client/components/activity-reporter-view.js +0 -1
- package/client/components/activity-starter-form.js +2 -3
- package/client/pages/activity/{activity-list-page.js → activity-list-page.ts} +24 -34
- package/client/pages/activity/activity-model-item-list.js +4 -1
- package/client/pages/activity/activity-page.js +1 -2
- package/client/pages/activity-instance/activity-instance-page.js +1 -1
- package/client/pages/activity-thread/activity-thread-page.js +1 -1
- package/client/pages/todo/draft-list-page.js +2 -0
- package/client/pages/{worklist-home.js → worklist-home.ts} +2 -6
- package/dist-client/components/activity-/bowner-view.js +0 -1
- package/dist-client/components/activity-/bowner-view.js.map +1 -1
- package/dist-client/components/activity-instance-preview.js +1 -2
- package/dist-client/components/activity-instance-preview.js.map +1 -1
- package/dist-client/components/activity-intro-view.d.ts +0 -1
- package/dist-client/components/activity-intro-view.js +0 -1
- package/dist-client/components/activity-intro-view.js.map +1 -1
- package/dist-client/components/activity-reporter-view.js +0 -1
- package/dist-client/components/activity-reporter-view.js.map +1 -1
- package/dist-client/components/activity-starter-form.js +2 -3
- package/dist-client/components/activity-starter-form.js.map +1 -1
- package/dist-client/pages/activity/activity-list-page.d.ts +12 -262
- package/dist-client/pages/activity/activity-list-page.js +45 -34
- package/dist-client/pages/activity/activity-list-page.js.map +1 -1
- package/dist-client/pages/activity/activity-model-item-list.d.ts +25 -0
- package/dist-client/pages/activity/activity-model-item-list.js +4 -1
- package/dist-client/pages/activity/activity-model-item-list.js.map +1 -1
- package/dist-client/pages/activity/activity-page.js +1 -2
- package/dist-client/pages/activity/activity-page.js.map +1 -1
- package/dist-client/pages/activity-instance/activity-instance-page.js +1 -1
- package/dist-client/pages/activity-instance/activity-instance-page.js.map +1 -1
- package/dist-client/pages/activity-thread/activity-thread-page.js +1 -1
- package/dist-client/pages/activity-thread/activity-thread-page.js.map +1 -1
- package/dist-client/pages/todo/draft-list-page.js +2 -0
- package/dist-client/pages/todo/draft-list-page.js.map +1 -1
- package/dist-client/pages/worklist-home.js +7 -6
- package/dist-client/pages/worklist-home.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/controllers/activity-instance/abort.js +4 -3
- package/dist-server/controllers/activity-instance/abort.js.map +1 -1
- package/dist-server/controllers/activity-instance/adjust.js +3 -2
- package/dist-server/controllers/activity-instance/adjust.js.map +1 -1
- package/dist-server/controllers/activity-instance/assign.js +9 -23
- package/dist-server/controllers/activity-instance/assign.js.map +1 -1
- package/dist-server/controllers/activity-instance/delegate.js +5 -4
- package/dist-server/controllers/activity-instance/delegate.js.map +1 -1
- package/dist-server/controllers/activity-instance/draft.js +6 -5
- package/dist-server/controllers/activity-instance/draft.js.map +1 -1
- package/dist-server/controllers/activity-instance/end.js +5 -4
- package/dist-server/controllers/activity-instance/end.js.map +1 -1
- package/dist-server/controllers/activity-instance/pick.js +6 -4
- package/dist-server/controllers/activity-instance/pick.js.map +1 -1
- package/dist-server/controllers/activity-instance/post.js +10 -4
- package/dist-server/controllers/activity-instance/post.js.map +1 -1
- package/dist-server/controllers/activity-instance/start.js +3 -2
- package/dist-server/controllers/activity-instance/start.js.map +1 -1
- package/dist-server/controllers/activity-instance/terminate.js +5 -4
- package/dist-server/controllers/activity-instance/terminate.js.map +1 -1
- package/dist-server/controllers/activity-thread/abort.js +3 -2
- package/dist-server/controllers/activity-thread/abort.js.map +1 -1
- package/dist-server/controllers/activity-thread/adjust.js +2 -1
- package/dist-server/controllers/activity-thread/adjust.js.map +1 -1
- package/dist-server/controllers/activity-thread/delegate.js +4 -3
- package/dist-server/controllers/activity-thread/delegate.js.map +1 -1
- package/dist-server/controllers/activity-thread/end.js +4 -3
- package/dist-server/controllers/activity-thread/end.js.map +1 -1
- package/dist-server/controllers/activity-thread/save.js +2 -1
- package/dist-server/controllers/activity-thread/save.js.map +1 -1
- package/dist-server/controllers/activity-thread/start.js +4 -3
- package/dist-server/controllers/activity-thread/start.js.map +1 -1
- package/dist-server/controllers/activity-thread/terminate.js +3 -2
- package/dist-server/controllers/activity-thread/terminate.js.map +1 -1
- package/dist-server/controllers/common.js +23 -6
- package/dist-server/controllers/common.js.map +1 -1
- package/dist-server/service/activity-instance/activity-instance-mutation.js +15 -17
- package/dist-server/service/activity-instance/activity-instance-mutation.js.map +1 -1
- package/dist-server/service/activity-instance/activity-instance-type.js +9 -1
- package/dist-server/service/activity-instance/activity-instance-type.js.map +1 -1
- package/dist-server/service/activity-template/activity-template-query.js +14 -0
- package/dist-server/service/activity-template/activity-template-query.js.map +1 -1
- package/dist-server/service/activity-thread/activity-thread-mutation.js +5 -5
- package/dist-server/service/activity-thread/activity-thread-mutation.js.map +1 -1
- package/dist-server/service/activity-thread/event-subscriber.js +3 -3
- package/dist-server/service/activity-thread/event-subscriber.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/server/controllers/activity-instance/abort.ts +6 -7
- package/server/controllers/activity-instance/adjust.ts +5 -7
- package/server/controllers/activity-instance/assign.ts +14 -42
- package/server/controllers/activity-instance/delegate.ts +7 -5
- package/server/controllers/activity-instance/draft.ts +7 -9
- package/server/controllers/activity-instance/end.ts +6 -5
- package/server/controllers/activity-instance/pick.ts +12 -5
- package/server/controllers/activity-instance/post.ts +14 -8
- package/server/controllers/activity-instance/start.ts +5 -3
- package/server/controllers/activity-instance/terminate.ts +7 -5
- package/server/controllers/activity-thread/abort.ts +4 -6
- package/server/controllers/activity-thread/adjust.ts +3 -6
- package/server/controllers/activity-thread/delegate.ts +5 -4
- package/server/controllers/activity-thread/end.ts +5 -4
- package/server/controllers/activity-thread/save.ts +3 -6
- package/server/controllers/activity-thread/start.ts +5 -8
- package/server/controllers/activity-thread/terminate.ts +3 -3
- package/server/controllers/common.ts +33 -14
- package/server/service/activity-instance/activity-instance-mutation.ts +10 -12
- package/server/service/activity-instance/activity-instance-type.ts +10 -4
- package/server/service/activity-template/activity-template-query.ts +10 -0
- package/server/service/activity-thread/activity-thread-mutation.ts +5 -5
- package/server/service/activity-thread/event-subscriber.ts +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/worklist",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.13",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "dist-client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"@things-factory/board-service": "^5.0.11",
|
|
34
34
|
"@things-factory/shell": "^5.0.11"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "72dfd33e398eab9872600e91d1b13fef0595c174"
|
|
37
37
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { getRepository } from 'typeorm'
|
|
2
2
|
|
|
3
3
|
import { ActivityInstance } from '../../service/activity-instance/activity-instance'
|
|
4
|
-
import {
|
|
4
|
+
import { evalActivityInstanceState } from '../common'
|
|
5
|
+
|
|
6
|
+
export async function abort({ id, reason }: { id: string; reason: string }, context: any): Promise<ActivityInstance> {
|
|
7
|
+
const { domain, user, tx } = context.state
|
|
5
8
|
|
|
6
|
-
export async function abort(
|
|
7
|
-
{ id, reason }: { id: string; reason: string },
|
|
8
|
-
{ domain, user, tx, t }: ContextStatus
|
|
9
|
-
): Promise<ActivityInstance> {
|
|
10
9
|
var repository = getRepository(ActivityInstance)
|
|
11
10
|
|
|
12
11
|
var activityInstance = await repository.findOne({
|
|
@@ -15,7 +14,7 @@ export async function abort(
|
|
|
15
14
|
|
|
16
15
|
if (!activityInstance) {
|
|
17
16
|
throw new Error(
|
|
18
|
-
t('error.activity-instance not found', {
|
|
17
|
+
context.t('error.activity-instance not found', {
|
|
19
18
|
activityInstance: id
|
|
20
19
|
})
|
|
21
20
|
)
|
|
@@ -24,7 +23,7 @@ export async function abort(
|
|
|
24
23
|
return await tx.getRepository(ActivityInstance).save({
|
|
25
24
|
...activityInstance,
|
|
26
25
|
reason,
|
|
27
|
-
state: await evalActivityInstanceState(id,
|
|
26
|
+
state: await evalActivityInstanceState(id, context),
|
|
28
27
|
transaction: 'abort',
|
|
29
28
|
updater: user,
|
|
30
29
|
terminatedAt: new Date(),
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { ActivityInstance } from '../../service/activity-instance/activity-instance'
|
|
2
2
|
import { ActivityInstancePatch } from '../../service/activity-instance/activity-instance-type'
|
|
3
|
-
import {
|
|
3
|
+
import { evalActivityInstanceState } from '../common'
|
|
4
|
+
|
|
5
|
+
export async function adjust(id: string, patch: ActivityInstancePatch, context: any): Promise<ActivityInstance> {
|
|
6
|
+
const { domain, user, tx } = context.state
|
|
4
7
|
|
|
5
|
-
export async function adjust(
|
|
6
|
-
id: string,
|
|
7
|
-
patch: ActivityInstancePatch,
|
|
8
|
-
{ domain, user, tx, t }: ContextStatus
|
|
9
|
-
): Promise<ActivityInstance> {
|
|
10
8
|
const repository = tx.getRepository(ActivityInstance)
|
|
11
9
|
const activityInstance = await repository.findOne({
|
|
12
10
|
where: { domain, id }
|
|
@@ -16,7 +14,7 @@ export async function adjust(
|
|
|
16
14
|
...activityInstance,
|
|
17
15
|
...patch,
|
|
18
16
|
transaction: 'adjust',
|
|
19
|
-
state: await evalActivityInstanceState(id,
|
|
17
|
+
state: await evalActivityInstanceState(id, context),
|
|
20
18
|
updater: user
|
|
21
19
|
})
|
|
22
20
|
}
|
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { In } from 'typeorm'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { User } from '@things-factory/auth-base'
|
|
4
4
|
|
|
5
5
|
import { ActivityInstance } from '../../service/activity-instance/activity-instance'
|
|
6
|
-
import {
|
|
6
|
+
import { createActivityThreadsForUsers } from '../common'
|
|
7
7
|
|
|
8
8
|
export async function assign(
|
|
9
|
-
{
|
|
10
|
-
|
|
11
|
-
assigneeRole,
|
|
12
|
-
supervisoryRole,
|
|
13
|
-
reason,
|
|
14
|
-
dueAt
|
|
15
|
-
}: { id: string; assigneeRole?: string; supervisoryRole?: string; reason?: string; dueAt?: Date },
|
|
16
|
-
{ domain, user, tx, t }: ContextStatus
|
|
9
|
+
{ id, assignees, reason, dueAt }: { id: string; assignees?: string[]; reason?: string; dueAt?: Date },
|
|
10
|
+
context: any
|
|
17
11
|
): Promise<ActivityInstance> {
|
|
18
|
-
|
|
12
|
+
const { domain, user, tx } = context.state
|
|
13
|
+
|
|
14
|
+
const repository = tx.getRepository(ActivityInstance)
|
|
19
15
|
|
|
20
16
|
var activityInstance = await repository.findOne({
|
|
21
17
|
where: { domain, id },
|
|
@@ -24,7 +20,7 @@ export async function assign(
|
|
|
24
20
|
|
|
25
21
|
if (!activityInstance) {
|
|
26
22
|
throw new Error(
|
|
27
|
-
t('error.activity-instance not found', {
|
|
23
|
+
context.t('error.activity-instance not found', {
|
|
28
24
|
activityInstance: id
|
|
29
25
|
})
|
|
30
26
|
)
|
|
@@ -34,35 +30,11 @@ export async function assign(
|
|
|
34
30
|
activityInstance.dueAt = dueAt
|
|
35
31
|
}
|
|
36
32
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
name: assigneeRole
|
|
41
|
-
})
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (supervisoryRole) {
|
|
45
|
-
activityInstance.supervisoryRole = await getRepository(Role).findOne({
|
|
46
|
-
domain,
|
|
47
|
-
name: supervisoryRole
|
|
48
|
-
})
|
|
49
|
-
}
|
|
33
|
+
const assignedUsers = await tx.getRepository(User).find({
|
|
34
|
+
email: In(assignees)
|
|
35
|
+
})
|
|
50
36
|
|
|
51
|
-
|
|
52
|
-
throw new Error(
|
|
53
|
-
t('error.activity-instance assignee role not found', {
|
|
54
|
-
activityInstance: id,
|
|
55
|
-
role: assigneeRole
|
|
56
|
-
})
|
|
57
|
-
)
|
|
58
|
-
}
|
|
37
|
+
await createActivityThreadsForUsers('assign', activityInstance, assignedUsers, context)
|
|
59
38
|
|
|
60
|
-
|
|
61
|
-
return await tx.getRepository(ActivityInstance).save({
|
|
62
|
-
...activityInstance,
|
|
63
|
-
reason,
|
|
64
|
-
transaction: 'assign',
|
|
65
|
-
state: await evalActivityInstanceState(id, { domain, user, tx, t }),
|
|
66
|
-
updater: user
|
|
67
|
-
})
|
|
39
|
+
return await tx.getRepository(ActivityInstance).findOne(activityInstance.id)
|
|
68
40
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getRepository } from 'typeorm'
|
|
2
2
|
|
|
3
3
|
import { ActivityInstance } from '../../service/activity-instance/activity-instance'
|
|
4
|
-
import {
|
|
4
|
+
import { evalActivityInstanceState } from '../common'
|
|
5
5
|
|
|
6
6
|
export async function delegate(
|
|
7
7
|
{
|
|
@@ -15,9 +15,11 @@ export async function delegate(
|
|
|
15
15
|
dueAt?: Date
|
|
16
16
|
reason?: string
|
|
17
17
|
},
|
|
18
|
-
|
|
18
|
+
context: any
|
|
19
19
|
): Promise<ActivityInstance> {
|
|
20
|
-
|
|
20
|
+
const { domain, user, tx } = context.state
|
|
21
|
+
|
|
22
|
+
const repository = getRepository(ActivityInstance)
|
|
21
23
|
|
|
22
24
|
var activityInstance = await repository.findOne({
|
|
23
25
|
where: { domain, id }
|
|
@@ -25,7 +27,7 @@ export async function delegate(
|
|
|
25
27
|
|
|
26
28
|
if (!activityInstance) {
|
|
27
29
|
throw new Error(
|
|
28
|
-
t('error.activity-instance not found', {
|
|
30
|
+
context.t('error.activity-instance not found', {
|
|
29
31
|
activityInstance: id
|
|
30
32
|
})
|
|
31
33
|
)
|
|
@@ -40,7 +42,7 @@ export async function delegate(
|
|
|
40
42
|
reason,
|
|
41
43
|
assigneeRole,
|
|
42
44
|
transaction: 'delegate',
|
|
43
|
-
state: await evalActivityInstanceState(id,
|
|
45
|
+
state: await evalActivityInstanceState(id, context),
|
|
44
46
|
updater: user,
|
|
45
47
|
assignedAt: new Date()
|
|
46
48
|
})
|
|
@@ -3,12 +3,9 @@ import { getRepository } from 'typeorm'
|
|
|
3
3
|
import { ActivityInstance, ActivityInstanceStatus } from '../../service/activity-instance/activity-instance'
|
|
4
4
|
import { NewActivityInstance } from '../../service/activity-instance/activity-instance-type'
|
|
5
5
|
import { Activity } from '../../service/activity/activity'
|
|
6
|
-
import { type ContextStatus } from '../common'
|
|
7
6
|
|
|
8
|
-
export async function draft(
|
|
9
|
-
|
|
10
|
-
{ domain, user, tx, t }: ContextStatus
|
|
11
|
-
): Promise<ActivityInstance> {
|
|
7
|
+
export async function draft(activityInstance: NewActivityInstance, context: any): Promise<ActivityInstance> {
|
|
8
|
+
const { domain, user, tx } = context.state
|
|
12
9
|
const { activityId, input, dueAt } = activityInstance
|
|
13
10
|
|
|
14
11
|
var repository = getRepository(Activity)
|
|
@@ -22,16 +19,16 @@ export async function draft(
|
|
|
22
19
|
|
|
23
20
|
if (!activity) {
|
|
24
21
|
throw new Error(
|
|
25
|
-
t('error.activity not found', {
|
|
22
|
+
context.t('error.activity not found', {
|
|
26
23
|
activity: activityId
|
|
27
24
|
})
|
|
28
25
|
)
|
|
29
26
|
}
|
|
30
|
-
|
|
31
|
-
activity.adhocType = 'standard'
|
|
32
|
-
activity.refBy = activityId
|
|
33
27
|
}
|
|
34
28
|
|
|
29
|
+
activityInstance.adhocType = 'standard'
|
|
30
|
+
activityInstance.refBy = activityId
|
|
31
|
+
|
|
35
32
|
if (!dueAt && activity.standardTime) {
|
|
36
33
|
activityInstance.dueAt = new Date(Date.now() + activity.standardTime * 1000)
|
|
37
34
|
}
|
|
@@ -46,6 +43,7 @@ export async function draft(
|
|
|
46
43
|
refBy: activity.refBy,
|
|
47
44
|
...activityInstance,
|
|
48
45
|
transaction: 'draft',
|
|
46
|
+
activity,
|
|
49
47
|
state: ActivityInstanceStatus.Draft,
|
|
50
48
|
domain,
|
|
51
49
|
creator: user,
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { getRepository } from 'typeorm'
|
|
2
2
|
|
|
3
3
|
import { ActivityInstance } from '../../service/activity-instance/activity-instance'
|
|
4
|
-
import {
|
|
4
|
+
import { evalActivityInstanceState } from '../common'
|
|
5
5
|
|
|
6
6
|
export async function end(
|
|
7
7
|
{ id, output, reason }: { id: string; output?: object; reason?: string },
|
|
8
|
-
|
|
8
|
+
context: any
|
|
9
9
|
): Promise<ActivityInstance> {
|
|
10
|
-
|
|
10
|
+
const { domain, user, tx } = context.state
|
|
11
|
+
const repository = getRepository(ActivityInstance)
|
|
11
12
|
|
|
12
13
|
var activityInstance = await repository.findOne({
|
|
13
14
|
where: { domain, id }
|
|
@@ -15,7 +16,7 @@ export async function end(
|
|
|
15
16
|
|
|
16
17
|
if (!activityInstance) {
|
|
17
18
|
throw new Error(
|
|
18
|
-
t('error.activity-instance not found', {
|
|
19
|
+
context.t('error.activity-instance not found', {
|
|
19
20
|
activityInstance: id
|
|
20
21
|
})
|
|
21
22
|
)
|
|
@@ -26,7 +27,7 @@ export async function end(
|
|
|
26
27
|
reason,
|
|
27
28
|
output,
|
|
28
29
|
transaction: 'end',
|
|
29
|
-
state: await evalActivityInstanceState(id,
|
|
30
|
+
state: await evalActivityInstanceState(id, context),
|
|
30
31
|
updater: user,
|
|
31
32
|
terminatedAt: new Date(),
|
|
32
33
|
terminator: user
|
|
@@ -2,10 +2,11 @@ import { getRepository } from 'typeorm'
|
|
|
2
2
|
|
|
3
3
|
import { ActivityInstance } from '../../service/activity-instance/activity-instance'
|
|
4
4
|
import { ActivityThread } from '../../service/activity-thread/activity-thread'
|
|
5
|
-
import {
|
|
5
|
+
import { createActivityThreadsForUsers } from '../common'
|
|
6
6
|
|
|
7
|
-
export async function pick(id: string,
|
|
8
|
-
|
|
7
|
+
export async function pick(id: string, context: any): Promise<ActivityThread> {
|
|
8
|
+
const { domain, user, tx } = context.state
|
|
9
|
+
const repository = getRepository(ActivityInstance)
|
|
9
10
|
|
|
10
11
|
var activityInstance = await repository.findOne({
|
|
11
12
|
where: { domain, id }
|
|
@@ -13,11 +14,17 @@ export async function pick(id: string, { domain, user, tx, t }: ContextStatus):
|
|
|
13
14
|
|
|
14
15
|
if (!activityInstance) {
|
|
15
16
|
throw new Error(
|
|
16
|
-
t('error.activity-instance not found', {
|
|
17
|
+
context.t('error.activity-instance not found', {
|
|
17
18
|
activityInstance: id
|
|
18
19
|
})
|
|
19
20
|
)
|
|
20
21
|
}
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
const picked = await tx.getRepository(ActivityInstance).save({
|
|
24
|
+
...activityInstance,
|
|
25
|
+
transaction: 'pick',
|
|
26
|
+
updater: user
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
return (await createActivityThreadsForUsers('pick', picked, [user], context))[0]
|
|
23
30
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import { In } from 'typeorm'
|
|
2
|
+
|
|
3
|
+
import { User } from '@things-factory/auth-base'
|
|
4
|
+
|
|
1
5
|
import { ActivityInstance, ActivityInstanceStatus } from '../../service/activity-instance/activity-instance'
|
|
2
6
|
import { ActivityInstancePost } from '../../service/activity-instance/activity-instance-type'
|
|
3
|
-
import {
|
|
7
|
+
import { createActivityThreadsForAllRoleUsers, createActivityThreadsForUsers } from '../common'
|
|
4
8
|
|
|
5
|
-
export async function post(
|
|
6
|
-
|
|
7
|
-
{ domain, user, tx, t }: ContextStatus
|
|
8
|
-
): Promise<ActivityInstance> {
|
|
9
|
+
export async function post(activityInstance: ActivityInstancePost, context: any): Promise<ActivityInstance> {
|
|
10
|
+
const { domain, user, tx } = context.state
|
|
9
11
|
const { id, assignees } = activityInstance
|
|
10
12
|
|
|
11
13
|
var origin = id ? await tx.getRepository(ActivityInstance).findOne(id) : null
|
|
@@ -20,12 +22,16 @@ export async function post(
|
|
|
20
22
|
updater: user
|
|
21
23
|
})
|
|
22
24
|
|
|
25
|
+
const assignedUsers = await tx.getRepository(User).find({
|
|
26
|
+
email: In(assignees || [])
|
|
27
|
+
})
|
|
28
|
+
|
|
23
29
|
if (posted.threadsMin === 0 && posted.assigneeRoleId) {
|
|
24
|
-
await createActivityThreadsForAllRoleUsers(
|
|
30
|
+
await createActivityThreadsForAllRoleUsers('post', posted, context)
|
|
25
31
|
}
|
|
26
32
|
|
|
27
|
-
if (
|
|
28
|
-
await createActivityThreadsForUsers(
|
|
33
|
+
if (assignedUsers.length > 0) {
|
|
34
|
+
await createActivityThreadsForUsers('post', posted, assignedUsers, context)
|
|
29
35
|
}
|
|
30
36
|
|
|
31
37
|
return await tx.getRepository(ActivityInstance).findOne(posted.id)
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { ActivityInstance } from '../../service/activity-instance/activity-instance'
|
|
2
|
-
import {
|
|
2
|
+
import { evalActivityInstanceState } from '../common'
|
|
3
|
+
|
|
4
|
+
export async function start(id: string, context: any): Promise<ActivityInstance> {
|
|
5
|
+
const { domain, user, tx } = context.state
|
|
3
6
|
|
|
4
|
-
export async function start(id: string, { domain, user, tx, t }: ContextStatus): Promise<ActivityInstance> {
|
|
5
7
|
const repository = tx.getRepository(ActivityInstance)
|
|
6
8
|
const activityInstance = await repository.findOne({
|
|
7
9
|
where: { domain, id }
|
|
@@ -10,7 +12,7 @@ export async function start(id: string, { domain, user, tx, t }: ContextStatus):
|
|
|
10
12
|
return await repository.save({
|
|
11
13
|
...activityInstance,
|
|
12
14
|
transaction: 'start',
|
|
13
|
-
state: await evalActivityInstanceState(id,
|
|
15
|
+
state: await evalActivityInstanceState(id, context),
|
|
14
16
|
updater: user,
|
|
15
17
|
startedAt: new Date()
|
|
16
18
|
})
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { getRepository } from 'typeorm'
|
|
2
2
|
|
|
3
3
|
import { ActivityInstance } from '../../service/activity-instance/activity-instance'
|
|
4
|
-
import {
|
|
4
|
+
import { evalActivityInstanceState } from '../common'
|
|
5
5
|
|
|
6
6
|
export async function terminate(
|
|
7
7
|
{ id, output, reason }: { id: string; output?: object; reason?: string },
|
|
8
|
-
|
|
8
|
+
context: any
|
|
9
9
|
): Promise<ActivityInstance> {
|
|
10
|
-
|
|
10
|
+
const { domain, user, tx } = context.state
|
|
11
|
+
|
|
12
|
+
const repository = getRepository(ActivityInstance)
|
|
11
13
|
|
|
12
14
|
var activityInstance = await repository.findOne({
|
|
13
15
|
where: { domain, id }
|
|
@@ -15,7 +17,7 @@ export async function terminate(
|
|
|
15
17
|
|
|
16
18
|
if (!activityInstance) {
|
|
17
19
|
throw new Error(
|
|
18
|
-
t('error.activity-instance not found', {
|
|
20
|
+
context.t('error.activity-instance not found', {
|
|
19
21
|
activityInstance: id
|
|
20
22
|
})
|
|
21
23
|
)
|
|
@@ -26,7 +28,7 @@ export async function terminate(
|
|
|
26
28
|
reason,
|
|
27
29
|
output,
|
|
28
30
|
transaction: 'terminate',
|
|
29
|
-
state: await evalActivityInstanceState(id,
|
|
31
|
+
state: await evalActivityInstanceState(id, context),
|
|
30
32
|
updater: user,
|
|
31
33
|
terminatedAt: new Date(),
|
|
32
34
|
terminator: user
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { getRepository } from 'typeorm'
|
|
2
2
|
|
|
3
3
|
import { ActivityThread, ActivityThreadStatus } from '../../service/activity-thread/activity-thread'
|
|
4
|
-
import { type ContextStatus } from '../common'
|
|
5
4
|
|
|
6
|
-
export async function abort(
|
|
7
|
-
{
|
|
8
|
-
|
|
9
|
-
): Promise<ActivityThread> {
|
|
5
|
+
export async function abort({ id, reason }: { id: string; reason: string }, context: any): Promise<ActivityThread> {
|
|
6
|
+
const { domain, user, tx } = context.state
|
|
7
|
+
|
|
10
8
|
var repository = getRepository(ActivityThread)
|
|
11
9
|
|
|
12
10
|
var activityThread = await repository.findOne({
|
|
@@ -15,7 +13,7 @@ export async function abort(
|
|
|
15
13
|
|
|
16
14
|
if (!activityThread) {
|
|
17
15
|
throw new Error(
|
|
18
|
-
t('error.activity-instance not found', {
|
|
16
|
+
context.t('error.activity-instance not found', {
|
|
19
17
|
activityThread: id
|
|
20
18
|
})
|
|
21
19
|
)
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { ActivityThread } from '../../service/activity-thread/activity-thread'
|
|
2
2
|
import { ActivityThreadPatch } from '../../service/activity-thread/activity-thread-type'
|
|
3
|
-
import { type ContextStatus } from '../common'
|
|
4
3
|
|
|
5
|
-
export async function adjust(
|
|
6
|
-
|
|
7
|
-
patch: ActivityThreadPatch,
|
|
8
|
-
{ domain, user, tx, t }: ContextStatus
|
|
9
|
-
): Promise<ActivityThread> {
|
|
4
|
+
export async function adjust(id: string, patch: ActivityThreadPatch, context: any): Promise<ActivityThread> {
|
|
5
|
+
const { domain, user, tx } = context.state
|
|
10
6
|
const repository = tx.getRepository(ActivityThread)
|
|
7
|
+
|
|
11
8
|
const activityThread = await repository.findOne({
|
|
12
9
|
where: { domain, id }
|
|
13
10
|
})
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { getRepository } from 'typeorm'
|
|
2
2
|
|
|
3
3
|
import { ActivityThread, ActivityThreadStatus } from '../../service/activity-thread/activity-thread'
|
|
4
|
-
import { type ContextStatus } from '../common'
|
|
5
4
|
|
|
6
5
|
export async function delegate(
|
|
7
6
|
{
|
|
@@ -15,9 +14,11 @@ export async function delegate(
|
|
|
15
14
|
dueAt?: Date
|
|
16
15
|
reason?: string
|
|
17
16
|
},
|
|
18
|
-
|
|
17
|
+
context: any
|
|
19
18
|
): Promise<ActivityThread> {
|
|
20
|
-
|
|
19
|
+
const { domain, user, tx } = context.state
|
|
20
|
+
|
|
21
|
+
const repository = getRepository(ActivityThread)
|
|
21
22
|
|
|
22
23
|
var activityThread = await repository.findOne({
|
|
23
24
|
where: { domain, id }
|
|
@@ -25,7 +26,7 @@ export async function delegate(
|
|
|
25
26
|
|
|
26
27
|
if (!activityThread) {
|
|
27
28
|
throw new Error(
|
|
28
|
-
t('error.activity-instance not found', {
|
|
29
|
+
context.t('error.activity-instance not found', {
|
|
29
30
|
activityThread: id
|
|
30
31
|
})
|
|
31
32
|
)
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { getRepository } from 'typeorm'
|
|
2
2
|
|
|
3
3
|
import { ActivityThread, ActivityThreadStatus } from '../../service/activity-thread/activity-thread'
|
|
4
|
-
import { type ContextStatus } from '../common'
|
|
5
4
|
|
|
6
5
|
export async function end(
|
|
7
6
|
{ id, output, reason }: { id: string; output?: object; reason?: string },
|
|
8
|
-
|
|
7
|
+
context: any
|
|
9
8
|
): Promise<ActivityThread> {
|
|
10
|
-
|
|
9
|
+
const { domain, user, tx } = context.state
|
|
10
|
+
|
|
11
|
+
const repository = getRepository(ActivityThread)
|
|
11
12
|
|
|
12
13
|
var activityThread = await repository.findOne({
|
|
13
14
|
where: { domain, id }
|
|
@@ -15,7 +16,7 @@ export async function end(
|
|
|
15
16
|
|
|
16
17
|
if (!activityThread) {
|
|
17
18
|
throw new Error(
|
|
18
|
-
t('error.activity-thread not found', {
|
|
19
|
+
context.t('error.activity-thread not found', {
|
|
19
20
|
activityThread: id
|
|
20
21
|
})
|
|
21
22
|
)
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { ActivityThread } from '../../service/activity-thread/activity-thread'
|
|
2
2
|
import { ActivityThreadSave } from '../../service/activity-thread/activity-thread-type'
|
|
3
|
-
import { type ContextStatus } from '../common'
|
|
4
3
|
|
|
5
|
-
export async function save(
|
|
6
|
-
|
|
7
|
-
save: ActivityThreadSave,
|
|
8
|
-
{ domain, user, tx, t }: ContextStatus
|
|
9
|
-
): Promise<ActivityThread> {
|
|
4
|
+
export async function save(id: string, save: ActivityThreadSave, context: any): Promise<ActivityThread> {
|
|
5
|
+
const { domain, user, tx } = context.state
|
|
10
6
|
const repository = tx.getRepository(ActivityThread)
|
|
7
|
+
|
|
11
8
|
const activityThread = await repository.findOne({
|
|
12
9
|
where: { domain, id }
|
|
13
10
|
})
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { ActivityThread, ActivityThreadStatus } from '../../service/activity-thread/activity-thread'
|
|
2
|
-
import { type ContextStatus } from '../common'
|
|
3
2
|
|
|
4
|
-
export async function start(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
reason: string,
|
|
8
|
-
{ domain, user, tx, t }: ContextStatus
|
|
9
|
-
): Promise<ActivityThread> {
|
|
3
|
+
export async function start(id: string, output: object, reason: string, context: any): Promise<ActivityThread> {
|
|
4
|
+
const { domain, user, tx } = context.state
|
|
5
|
+
|
|
10
6
|
const repository = tx.getRepository(ActivityThread)
|
|
11
7
|
const activityThread = await repository.findOne({
|
|
12
8
|
where: { domain, id }
|
|
@@ -14,7 +10,7 @@ export async function start(
|
|
|
14
10
|
|
|
15
11
|
if (!activityThread) {
|
|
16
12
|
throw new Error(
|
|
17
|
-
t('error.activity-instance not found', {
|
|
13
|
+
context.t('error.activity-instance not found', {
|
|
18
14
|
activityInstance: id
|
|
19
15
|
})
|
|
20
16
|
)
|
|
@@ -28,6 +24,7 @@ export async function start(
|
|
|
28
24
|
...activityThread,
|
|
29
25
|
reason,
|
|
30
26
|
state: ActivityThreadStatus.Started,
|
|
27
|
+
transaction: 'start',
|
|
31
28
|
updater: user,
|
|
32
29
|
startedAt: new Date()
|
|
33
30
|
})
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { getRepository } from 'typeorm'
|
|
2
2
|
|
|
3
3
|
import { ActivityThread, ActivityThreadStatus } from '../../service/activity-thread/activity-thread'
|
|
4
|
-
import { type ContextStatus } from '../common'
|
|
5
4
|
|
|
6
5
|
export async function terminate(
|
|
7
6
|
{ id, output, reason }: { id: string; output?: object; reason?: string },
|
|
8
|
-
|
|
7
|
+
context: any
|
|
9
8
|
): Promise<ActivityThread> {
|
|
9
|
+
const { domain, user, tx } = context.state
|
|
10
10
|
var repository = getRepository(ActivityThread)
|
|
11
11
|
|
|
12
12
|
var activityThread = await repository.findOne({
|
|
@@ -15,7 +15,7 @@ export async function terminate(
|
|
|
15
15
|
|
|
16
16
|
if (!activityThread) {
|
|
17
17
|
throw new Error(
|
|
18
|
-
t('error.activity-instance not found', {
|
|
18
|
+
context.t('error.activity-instance not found', {
|
|
19
19
|
activityThread: id
|
|
20
20
|
})
|
|
21
21
|
)
|