@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.
- package/client/components/activity-/{bowner-view.js → bowner-view.ts} +27 -35
- package/client/components/{activity-instance-preview.js → activity-instance-preview.ts} +39 -52
- package/client/components/activity-intro-view.ts +0 -1
- package/client/components/{activity-reporter-view.js → activity-reporter-view.ts} +27 -40
- package/client/components/{activity-starter-form.js → activity-starter-form.ts} +55 -71
- package/client/pages/activity/{activity-list-page.js → activity-list-page.ts} +26 -35
- package/client/pages/activity/{activity-model-item-list.js → activity-model-item-list.ts} +15 -19
- package/client/pages/activity/{activity-page.js → activity-page.ts} +37 -42
- package/client/pages/activity/{starter-list-page.js → starter-list-page.ts} +15 -20
- package/client/pages/activity-instance/{activity-instance-list-page.js → activity-instance-list-page.ts} +22 -30
- package/client/pages/activity-instance/{activity-instance-page.js → activity-instance-page.ts} +37 -42
- package/client/pages/activity-store/{activity-store-page.js → activity-store-page.ts} +22 -29
- package/client/pages/activity-supervisor/{reporter-list-page.js → reporter-list-page.ts} +14 -21
- package/client/pages/activity-template/{activity-template-importer.js → activity-template-importer.ts} +32 -38
- package/client/pages/activity-template/{activity-template-list-page.js → activity-template-list-page.ts} +30 -37
- package/client/pages/activity-template/{activity-template-model-item-list.js → activity-template-model-item-list.ts} +5 -4
- package/client/pages/activity-thread/{activity-thread-importer.js → activity-thread-importer.ts} +32 -37
- package/client/pages/activity-thread/{activity-thread-list-page.js → activity-thread-list-page.ts} +20 -27
- package/client/pages/activity-thread/{activity-thread-page.js → activity-thread-page.ts} +37 -41
- package/client/pages/dashboard/{dashboard-home.js → dashboard-home.ts} +3 -7
- package/client/pages/todo/{assigned-list-page.js → assigned-list-page.ts} +13 -20
- package/client/pages/todo/{draft-list-page.js → draft-list-page.ts} +15 -20
- package/client/pages/todo/{pickable-list-page.js → pickable-list-page.ts} +13 -20
- package/client/pages/todo/{todo-list-page.js → todo-list-page.ts} +12 -19
- package/client/pages/{worklist-home.js → worklist-home.ts} +3 -7
- package/dist-client/components/activity-/bowner-view.d.ts +1 -1
- package/dist-client/components/activity-/bowner-view.js +44 -37
- package/dist-client/components/activity-/bowner-view.js.map +1 -1
- package/dist-client/components/activity-instance-preview.d.ts +2 -1
- package/dist-client/components/activity-instance-preview.js +59 -53
- 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.d.ts +1 -1
- package/dist-client/components/activity-reporter-view.js +44 -38
- package/dist-client/components/activity-reporter-view.js.map +1 -1
- package/dist-client/components/activity-starter-form.d.ts +16 -0
- package/dist-client/components/activity-starter-form.js +70 -70
- package/dist-client/components/activity-starter-form.js.map +1 -1
- package/dist-client/pages/activity/activity-list-page.d.ts +13 -262
- package/dist-client/pages/activity/activity-list-page.js +49 -35
- package/dist-client/pages/activity/activity-list-page.js.map +1 -1
- package/dist-client/pages/activity/activity-model-item-list.d.ts +13 -155
- package/dist-client/pages/activity/activity-model-item-list.js +56 -45
- package/dist-client/pages/activity/activity-model-item-list.js.map +1 -1
- package/dist-client/pages/activity/activity-page.d.ts +29 -22
- package/dist-client/pages/activity/activity-page.js +54 -46
- package/dist-client/pages/activity/activity-page.js.map +1 -1
- package/dist-client/pages/activity/starter-list-page.d.ts +14 -120
- package/dist-client/pages/activity/starter-list-page.js +47 -31
- package/dist-client/pages/activity/starter-list-page.js.map +1 -1
- package/dist-client/pages/activity-instance/activity-instance-list-page.d.ts +9 -114
- package/dist-client/pages/activity-instance/activity-instance-list-page.js +40 -30
- package/dist-client/pages/activity-instance/activity-instance-list-page.js.map +1 -1
- package/dist-client/pages/activity-instance/activity-instance-page.d.ts +22 -22
- package/dist-client/pages/activity-instance/activity-instance-page.js +58 -45
- package/dist-client/pages/activity-instance/activity-instance-page.js.map +1 -1
- package/dist-client/pages/activity-store/activity-store-page.d.ts +23 -150
- package/dist-client/pages/activity-store/activity-store-page.js +40 -31
- package/dist-client/pages/activity-store/activity-store-page.js.map +1 -1
- package/dist-client/pages/activity-supervisor/reporter-list-page.d.ts +13 -120
- package/dist-client/pages/activity-supervisor/reporter-list-page.js +47 -31
- package/dist-client/pages/activity-supervisor/reporter-list-page.js.map +1 -1
- package/dist-client/pages/activity-template/activity-template-importer.d.ts +7 -21
- package/dist-client/pages/activity-template/activity-template-importer.js +42 -36
- package/dist-client/pages/activity-template/activity-template-importer.js.map +1 -1
- package/dist-client/pages/activity-template/activity-template-list-page.d.ts +17 -218
- package/dist-client/pages/activity-template/activity-template-list-page.js +58 -37
- package/dist-client/pages/activity-template/activity-template-list-page.js.map +1 -1
- package/dist-client/pages/activity-template/activity-template-model-item-list.js +10 -5
- package/dist-client/pages/activity-template/activity-template-model-item-list.js.map +1 -1
- package/dist-client/pages/activity-thread/activity-thread-importer.d.ts +7 -21
- package/dist-client/pages/activity-thread/activity-thread-importer.js +42 -36
- package/dist-client/pages/activity-thread/activity-thread-importer.js.map +1 -1
- package/dist-client/pages/activity-thread/activity-thread-list-page.d.ts +16 -100
- package/dist-client/pages/activity-thread/activity-thread-list-page.js +55 -36
- package/dist-client/pages/activity-thread/activity-thread-list-page.js.map +1 -1
- package/dist-client/pages/activity-thread/activity-thread-page.d.ts +26 -19
- package/dist-client/pages/activity-thread/activity-thread-page.js +54 -45
- package/dist-client/pages/activity-thread/activity-thread-page.js.map +1 -1
- package/dist-client/pages/dashboard/dashboard-home.js +8 -7
- package/dist-client/pages/dashboard/dashboard-home.js.map +1 -1
- package/dist-client/pages/todo/assigned-list-page.d.ts +12 -100
- package/dist-client/pages/todo/assigned-list-page.js +45 -30
- package/dist-client/pages/todo/assigned-list-page.js.map +1 -1
- package/dist-client/pages/todo/draft-list-page.d.ts +13 -174
- package/dist-client/pages/todo/draft-list-page.js +48 -30
- package/dist-client/pages/todo/draft-list-page.js.map +1 -1
- package/dist-client/pages/todo/pickable-list-page.d.ts +13 -126
- package/dist-client/pages/todo/pickable-list-page.js +46 -30
- package/dist-client/pages/todo/pickable-list-page.js.map +1 -1
- package/dist-client/pages/todo/todo-list-page.d.ts +12 -206
- package/dist-client/pages/todo/todo-list-page.js +44 -30
- package/dist-client/pages/todo/todo-list-page.js.map +1 -1
- package/dist-client/pages/worklist-home.js +8 -7
- package/dist-client/pages/worklist-home.js.map +1 -1
- package/dist-client/route.d.ts +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/controllers/activity-instance/abort.js +8 -6
- package/dist-server/controllers/activity-instance/abort.js.map +1 -1
- package/dist-server/controllers/activity-instance/adjust.js +5 -3
- package/dist-server/controllers/activity-instance/adjust.js.map +1 -1
- package/dist-server/controllers/activity-instance/assign.js +11 -25
- package/dist-server/controllers/activity-instance/assign.js.map +1 -1
- package/dist-server/controllers/activity-instance/delegate.js +8 -6
- package/dist-server/controllers/activity-instance/delegate.js.map +1 -1
- package/dist-server/controllers/activity-instance/draft.js +9 -8
- package/dist-server/controllers/activity-instance/draft.js.map +1 -1
- package/dist-server/controllers/activity-instance/end.js +8 -6
- package/dist-server/controllers/activity-instance/end.js.map +1 -1
- package/dist-server/controllers/activity-instance/pick.js +9 -6
- package/dist-server/controllers/activity-instance/pick.js.map +1 -1
- package/dist-server/controllers/activity-instance/post.js +26 -6
- package/dist-server/controllers/activity-instance/post.js.map +1 -1
- package/dist-server/controllers/activity-instance/start.js +5 -3
- package/dist-server/controllers/activity-instance/start.js.map +1 -1
- package/dist-server/controllers/activity-instance/terminate.js +8 -6
- package/dist-server/controllers/activity-instance/terminate.js.map +1 -1
- package/dist-server/controllers/activity-thread/abort.js +7 -5
- package/dist-server/controllers/activity-thread/abort.js.map +1 -1
- package/dist-server/controllers/activity-thread/adjust.js +4 -2
- package/dist-server/controllers/activity-thread/adjust.js.map +1 -1
- package/dist-server/controllers/activity-thread/delegate.js +7 -5
- package/dist-server/controllers/activity-thread/delegate.js.map +1 -1
- package/dist-server/controllers/activity-thread/end.js +7 -5
- package/dist-server/controllers/activity-thread/end.js.map +1 -1
- package/dist-server/controllers/activity-thread/save.js +4 -2
- package/dist-server/controllers/activity-thread/save.js.map +1 -1
- package/dist-server/controllers/activity-thread/start.js +6 -4
- package/dist-server/controllers/activity-thread/start.js.map +1 -1
- package/dist-server/controllers/activity-thread/terminate.js +7 -5
- package/dist-server/controllers/activity-thread/terminate.js.map +1 -1
- package/dist-server/controllers/common.js +31 -10
- package/dist-server/controllers/common.js.map +1 -1
- package/dist-server/service/activity/activity-history.js +6 -7
- package/dist-server/service/activity/activity-history.js.map +1 -1
- package/dist-server/service/activity/activity-mutation.js +10 -4
- package/dist-server/service/activity/activity-mutation.js.map +1 -1
- package/dist-server/service/activity/activity-query.js +18 -19
- package/dist-server/service/activity/activity-query.js.map +1 -1
- package/dist-server/service/activity/activity-type.js +6 -7
- package/dist-server/service/activity/activity-type.js.map +1 -1
- package/dist-server/service/activity/activity.js +6 -7
- package/dist-server/service/activity/activity.js.map +1 -1
- package/dist-server/service/activity-instance/activity-instance-history.js +7 -8
- package/dist-server/service/activity-instance/activity-instance-history.js.map +1 -1
- package/dist-server/service/activity-instance/activity-instance-mutation.js +17 -19
- package/dist-server/service/activity-instance/activity-instance-mutation.js.map +1 -1
- package/dist-server/service/activity-instance/activity-instance-query.js +24 -25
- package/dist-server/service/activity-instance/activity-instance-query.js.map +1 -1
- package/dist-server/service/activity-instance/activity-instance-subscription.js +1 -2
- package/dist-server/service/activity-instance/activity-instance-subscription.js.map +1 -1
- package/dist-server/service/activity-instance/activity-instance-type.js +13 -6
- package/dist-server/service/activity-instance/activity-instance-type.js.map +1 -1
- package/dist-server/service/activity-instance/activity-instance.js +7 -8
- package/dist-server/service/activity-instance/activity-instance.js.map +1 -1
- package/dist-server/service/activity-instance/event-subscriber.js +0 -5
- package/dist-server/service/activity-instance/event-subscriber.js.map +1 -1
- package/dist-server/service/activity-template/activity-template-history.js +3 -4
- package/dist-server/service/activity-template/activity-template-history.js.map +1 -1
- package/dist-server/service/activity-template/activity-template-mutation.js +4 -4
- package/dist-server/service/activity-template/activity-template-mutation.js.map +1 -1
- package/dist-server/service/activity-template/activity-template-query.js +23 -11
- package/dist-server/service/activity-template/activity-template-query.js.map +1 -1
- package/dist-server/service/activity-template/activity-template.js +3 -4
- package/dist-server/service/activity-template/activity-template.js.map +1 -1
- package/dist-server/service/activity-thread/activity-thread-mutation.js +15 -11
- package/dist-server/service/activity-thread/activity-thread-mutation.js.map +1 -1
- package/dist-server/service/activity-thread/activity-thread-query.js +11 -13
- package/dist-server/service/activity-thread/activity-thread-query.js.map +1 -1
- package/dist-server/service/activity-thread/activity-thread.js +4 -5
- package/dist-server/service/activity-thread/activity-thread.js.map +1 -1
- package/dist-server/service/activity-thread/event-subscriber.js +15 -3
- package/dist-server/service/activity-thread/event-subscriber.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/server/controllers/activity-instance/abort.ts +9 -6
- package/server/controllers/activity-instance/adjust.ts +7 -4
- package/server/controllers/activity-instance/assign.ts +16 -44
- package/server/controllers/activity-instance/delegate.ts +10 -7
- package/server/controllers/activity-instance/draft.ts +9 -8
- package/server/controllers/activity-instance/end.ts +9 -7
- package/server/controllers/activity-instance/pick.ts +15 -7
- package/server/controllers/activity-instance/post.ts +30 -7
- package/server/controllers/activity-instance/start.ts +7 -4
- package/server/controllers/activity-instance/terminate.ts +10 -7
- package/server/controllers/activity-thread/abort.ts +7 -5
- package/server/controllers/activity-thread/adjust.ts +5 -3
- package/server/controllers/activity-thread/delegate.ts +8 -6
- package/server/controllers/activity-thread/end.ts +8 -6
- package/server/controllers/activity-thread/save.ts +5 -7
- package/server/controllers/activity-thread/start.ts +7 -4
- package/server/controllers/activity-thread/terminate.ts +6 -5
- package/server/controllers/common.ts +44 -21
- package/server/service/activity/activity-mutation.ts +19 -10
- package/server/service/activity/activity-query.ts +14 -14
- package/server/service/activity-instance/activity-instance-mutation.ts +18 -20
- package/server/service/activity-instance/activity-instance-query.ts +27 -21
- package/server/service/activity-instance/activity-instance-subscription.ts +1 -2
- package/server/service/activity-instance/activity-instance-type.ts +10 -4
- package/server/service/activity-instance/event-subscriber.ts +0 -6
- package/server/service/activity-template/activity-template-mutation.ts +13 -10
- package/server/service/activity-template/activity-template-query.ts +18 -9
- package/server/service/activity-thread/activity-thread-mutation.ts +27 -20
- package/server/service/activity-thread/activity-thread-query.ts +10 -11
- package/server/service/activity-thread/event-subscriber.ts +15 -3
- package/translations/en.json +3 -0
- package/translations/ko.json +3 -0
- package/translations/ms.json +3 -0
- 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:
|
|
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:
|
|
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:
|
|
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.
|
|
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:
|
|
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(
|
|
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:
|
|
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:
|
|
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:
|
|
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).
|
|
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).
|
|
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).
|
|
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:
|
|
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:
|
|
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:
|
|
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(
|
|
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:
|
|
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(
|
|
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:
|
|
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:
|
|
151
|
+
@Ctx() context: ResolverContext
|
|
145
152
|
): Promise<ActivityThread> {
|
|
146
|
-
return await start(id, output, reason, context
|
|
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:
|
|
163
|
+
@Ctx() context: ResolverContext
|
|
157
164
|
): Promise<ActivityThread> {
|
|
158
|
-
return await delegate({ id, assigneeRole, dueAt, reason }, context
|
|
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:
|
|
173
|
+
@Ctx() context: ResolverContext
|
|
167
174
|
): Promise<ActivityThread> {
|
|
168
|
-
return await saveActivityThread(id, save, context
|
|
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:
|
|
184
|
+
@Ctx() context: ResolverContext
|
|
178
185
|
): Promise<ActivityThread> {
|
|
179
|
-
return await end({ id, output, reason }, context
|
|
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:
|
|
194
|
+
@Ctx() context: ResolverContext
|
|
188
195
|
): Promise<ActivityThread> {
|
|
189
|
-
return await abort({ id, reason }, context
|
|
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:
|
|
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:
|
|
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:
|
|
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).
|
|
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).
|
|
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).
|
|
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).
|
|
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).
|
|
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, {
|
|
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, {
|
|
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, {
|
|
50
|
+
await updateActivityInstanceState(activityThread.activityInstanceId, {
|
|
51
|
+
state: { tx: event.manager, domain, user },
|
|
52
|
+
t: null
|
|
53
|
+
})
|
|
42
54
|
}
|
|
43
55
|
}
|
package/translations/en.json
CHANGED
package/translations/ko.json
CHANGED
package/translations/ms.json
CHANGED
package/translations/zh.json
CHANGED