@things-factory/dataset 8.0.0-alpha.29 → 8.0.0-alpha.30

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. package/client/activities/activity-ooc-resolve-edit.ts +1 -1
  2. package/client/activities/activity-ooc-review-edit.ts +1 -1
  3. package/client/pages/data-entry/data-entry-list-page.ts +7 -0
  4. package/client/pages/data-set/data-set-list-page.ts +14 -15
  5. package/dist-client/activities/activity-ooc-resolve-edit.js +1 -1
  6. package/dist-client/activities/activity-ooc-resolve-edit.js.map +1 -1
  7. package/dist-client/activities/activity-ooc-review-edit.js +1 -1
  8. package/dist-client/activities/activity-ooc-review-edit.js.map +1 -1
  9. package/dist-client/pages/data-entry/data-entry-list-page.js +7 -0
  10. package/dist-client/pages/data-entry/data-entry-list-page.js.map +1 -1
  11. package/dist-client/pages/data-ooc/data-ooc-view.d.ts +1 -1
  12. package/dist-client/pages/data-sample/data-sample-view.d.ts +1 -1
  13. package/dist-client/pages/data-set/data-set-list-page.js +14 -15
  14. package/dist-client/pages/data-set/data-set-list-page.js.map +1 -1
  15. package/dist-client/tsconfig.tsbuildinfo +1 -1
  16. package/dist-server/activities/activity-data-collect.js.map +1 -1
  17. package/dist-server/activities/activity-ooc-review.js +12 -4
  18. package/dist-server/activities/activity-ooc-review.js.map +1 -1
  19. package/dist-server/controllers/create-data-sample.js +16 -10
  20. package/dist-server/controllers/create-data-sample.js.map +1 -1
  21. package/dist-server/controllers/issue-data-collection-task.js +5 -4
  22. package/dist-server/controllers/issue-data-collection-task.js.map +1 -1
  23. package/dist-server/service/data-set/data-set-mutation.js +4 -34
  24. package/dist-server/service/data-set/data-set-mutation.js.map +1 -1
  25. package/dist-server/service/data-set/data-set-query.d.ts +1 -0
  26. package/dist-server/service/data-set/data-set-query.js +15 -0
  27. package/dist-server/service/data-set/data-set-query.js.map +1 -1
  28. package/dist-server/service/data-set/data-set-type.d.ts +2 -3
  29. package/dist-server/service/data-set/data-set-type.js +6 -6
  30. package/dist-server/service/data-set/data-set-type.js.map +1 -1
  31. package/dist-server/service/data-set/data-set.d.ts +2 -0
  32. package/dist-server/service/data-set/data-set.js +12 -0
  33. package/dist-server/service/data-set/data-set.js.map +1 -1
  34. package/dist-server/service/index.d.ts +1 -1
  35. package/dist-server/tsconfig.tsbuildinfo +1 -1
  36. package/package.json +5 -5
  37. package/server/activities/activity-data-collect.ts +11 -2
  38. package/server/activities/activity-ooc-review.ts +28 -7
  39. package/server/controllers/create-data-sample.ts +16 -10
  40. package/server/controllers/issue-data-collection-task.ts +5 -3
  41. package/server/service/data-set/data-set-mutation.ts +0 -38
  42. package/server/service/data-set/data-set-query.ts +12 -0
  43. package/server/service/data-set/data-set-type.ts +4 -4
  44. package/server/service/data-set/data-set.ts +10 -0
  45. package/translations/en.json +1 -0
  46. package/translations/ja.json +1 -0
  47. package/translations/ko.json +1 -0
  48. package/translations/ms.json +1 -0
  49. package/translations/zh.json +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/dataset",
3
- "version": "8.0.0-alpha.29",
3
+ "version": "8.0.0-alpha.30",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "things-factory": true,
@@ -42,19 +42,19 @@
42
42
  "@operato/utils": "^8.0.0-alpha",
43
43
  "@things-factory/auth-base": "^8.0.0-alpha.29",
44
44
  "@things-factory/aws-base": "^8.0.0-alpha.29",
45
- "@things-factory/board-service": "^8.0.0-alpha.29",
45
+ "@things-factory/board-service": "^8.0.0-alpha.30",
46
46
  "@things-factory/env": "^8.0.0-alpha.8",
47
- "@things-factory/integration-base": "^8.0.0-alpha.29",
47
+ "@things-factory/integration-base": "^8.0.0-alpha.30",
48
48
  "@things-factory/organization": "^8.0.0-alpha.29",
49
49
  "@things-factory/personalization": "^8.0.0-alpha.29",
50
50
  "@things-factory/scheduler-client": "^8.0.0-alpha.29",
51
51
  "@things-factory/shell": "^8.0.0-alpha.29",
52
52
  "@things-factory/work-shift": "^8.0.0-alpha.29",
53
- "@things-factory/worklist": "^8.0.0-alpha.29",
53
+ "@things-factory/worklist": "^8.0.0-alpha.30",
54
54
  "cron-parser": "^4.3.0",
55
55
  "moment-timezone": "^0.5.45",
56
56
  "simple-statistics": "^7.8.3",
57
57
  "statistics": "^3.3.0"
58
58
  },
59
- "gitHead": "a7592d7dc0886734d2798ee5756c51b0c0aa13fa"
59
+ "gitHead": "f01fac46630cf06e1697edc185dfb4cddcd61365"
60
60
  }
@@ -1,11 +1,20 @@
1
1
  import { In } from 'typeorm'
2
2
 
3
3
  import { User } from '@things-factory/auth-base'
4
- import { Activity, ActivityInstance, ActivityInstanceStatus, UpdateActivityInstanceStateAddendum } from '@things-factory/worklist'
4
+ import {
5
+ Activity,
6
+ ActivityInstance,
7
+ ActivityInstanceStatus,
8
+ UpdateActivityInstanceStateAddendum
9
+ } from '@things-factory/worklist'
5
10
  import { NewDataSample } from 'service/data-sample/data-sample-type'
6
11
  import { createDataSample } from '../controllers/create-data-sample'
7
12
 
8
- async function callback(activityInstance: ActivityInstance, addendum: UpdateActivityInstanceStateAddendum, context: ResolverContext) {
13
+ async function callback(
14
+ activityInstance: ActivityInstance,
15
+ addendum: UpdateActivityInstanceStateAddendum,
16
+ context: ResolverContext
17
+ ) {
9
18
  const { domain, tx } = context.state
10
19
  const { input, output, state } = activityInstance
11
20
 
@@ -1,10 +1,20 @@
1
1
  import { In } from 'typeorm'
2
- import { Activity, ActivityInstance, ActivityInstanceStatus, UpdateActivityInstanceStateAddendum } from '@things-factory/worklist'
2
+ import {
3
+ Activity,
4
+ ActivityInstance,
5
+ ActivityInstanceStatus,
6
+ UpdateActivityInstanceStateAddendum
7
+ } from '@things-factory/worklist'
3
8
  import { issue } from '@things-factory/worklist/dist-server/controllers/activity-instance/issue'
9
+ import { Role } from '@things-factory/auth-base'
4
10
 
5
11
  import { DataOoc, DataOocStatus } from '../service/data-ooc/data-ooc'
6
12
 
7
- async function callback(activityInstance: ActivityInstance, addendum: UpdateActivityInstanceStateAddendum, context: ResolverContext) {
13
+ async function callback(
14
+ activityInstance: ActivityInstance,
15
+ addendum: UpdateActivityInstanceStateAddendum,
16
+ context: ResolverContext
17
+ ) {
8
18
  const { domain, user, tx } = context.state
9
19
  const { input, output, state, terminatedAt } = activityInstance
10
20
  const { causedBy } = addendum || {}
@@ -28,7 +38,7 @@ async function callback(activityInstance: ActivityInstance, addendum: UpdateActi
28
38
  })
29
39
 
30
40
  const dataSet = dataOoc.dataSet
31
- const { assignees, outlierApprovalLine } = dataSet
41
+ const { resolverRoleId, outlierApprovalLine } = dataSet
32
42
 
33
43
  /* dataOoc Review 결과를 dataOoc 엔티티에 반영한다. */
34
44
  dataOoc = await tx.getRepository(DataOoc).save({
@@ -39,8 +49,15 @@ async function callback(activityInstance: ActivityInstance, addendum: UpdateActi
39
49
  state: DataOocStatus.REVIEWED
40
50
  })
41
51
 
42
- /* 해당 dataset의 작업 담당자(assignees)에게 OOC 해결을 위한 태스크를 지시한다. */
43
- if (assignees && assignees instanceof Array && assignees.length > 0) {
52
+ const assigneeRole =
53
+ resolverRoleId &&
54
+ (await tx.getRepository(Role).findOneBy({
55
+ domain: { id: In([domain.id, domain.parentId].filter(Boolean)) },
56
+ id: resolverRoleId
57
+ }))
58
+
59
+ /* 해당 dataset의 작업 담당자(resolverRole)에게 OOC 해결을 위한 태스크를 지시한다. */
60
+ if (assigneeRole) {
44
61
  const activityInstance = {
45
62
  name: `[OOC 조치] ${dataSet.name}`,
46
63
  description: dataSet.description,
@@ -50,14 +67,18 @@ async function callback(activityInstance: ActivityInstance, addendum: UpdateActi
50
67
  dataOocId,
51
68
  instruction: correctiveInstruction
52
69
  },
53
- assignees,
70
+ assigneeRole,
71
+ threadsMin: 1,
72
+ threadsMax: 1,
54
73
  approvalLine: outlierApprovalLine
55
74
  }
56
75
 
57
76
  dataOoc.resolveActivityInstance = await issue(activityInstance, context)
58
77
  await tx.getRepository(DataOoc).save(dataOoc)
59
78
  } else {
60
- console.error(`Assignees are not set. So, Data OOC Resolve task for ${dataOoc.name}(${dataOoc.id}) could not be issued.`)
79
+ console.error(
80
+ `Assignees are not set. So, Data OOC Resolve task for ${dataOoc.name}(${dataOoc.id}) could not be issued.`
81
+ )
61
82
  }
62
83
  } else {
63
84
  console.error('OOC Resolve Activity not installed.')
@@ -260,17 +260,19 @@ export async function createDataSample(newDataSample: NewDataSample, context: Re
260
260
  })) as Activity
261
261
 
262
262
  if (activity) {
263
- const assignee =
263
+ const assigneeRole =
264
264
  dataSet.supervisoryRoleId &&
265
265
  (await tx.getRepository(Role).findOneBy({
266
266
  domain: { id: In([domain.id, domain.parentId].filter(Boolean)) },
267
267
  id: dataSet.supervisoryRoleId
268
268
  }))
269
269
 
270
- const assignees = dataSet.supervisoryRoleId ? [{ type: 'Role', value: dataSet.supervisoryRoleId, assignee }] : []
270
+ // const assignees = dataSet.supervisoryRoleId
271
+ // ? [{ type: 'Role', value: dataSet.supervisoryRoleId, assigneeRole }]
272
+ // : []
271
273
 
272
274
  /* 해당 dataset의 supervisor로 하여금, OOC를 리뷰하고 instruction을 작성해서, OOC 해결을 위한 태스크를 dataset assignees에게 지시하도록 한다. */
273
- if (assignees && assignees instanceof Array && assignees.length > 0) {
275
+ if (assigneeRole) {
274
276
  const activityInstance = {
275
277
  name: `[OOC 검토] ${dataSet.name}`,
276
278
  description: dataSet.description,
@@ -279,7 +281,9 @@ export async function createDataSample(newDataSample: NewDataSample, context: Re
279
281
  input: {
280
282
  dataOocId: dataOoc.id
281
283
  },
282
- assignees,
284
+ assigneeRole,
285
+ threadsMin: 1,
286
+ threadsMax: 1,
283
287
  approvalLine: []
284
288
  }
285
289
 
@@ -362,19 +366,19 @@ export async function createDataSample(newDataSample: NewDataSample, context: Re
362
366
  })) as Activity
363
367
 
364
368
  if (activity) {
365
- const assignee =
369
+ const assigneeRole =
366
370
  dataSet.supervisoryRoleId &&
367
371
  (await tx.getRepository(Role).findOneBy({
368
372
  domain: { id: In([domain.id, domain.parentId].filter(Boolean)) },
369
373
  id: dataSet.supervisoryRoleId
370
374
  }))
371
375
 
372
- const assignees = dataSet.supervisoryRoleId
373
- ? [{ type: 'Role', value: dataSet.supervisoryRoleId, assignee }]
374
- : []
376
+ // const assignees = dataSet.supervisoryRoleId
377
+ // ? [{ type: 'Role', value: dataSet.supervisoryRoleId, assigneeRole }]
378
+ // : []
375
379
 
376
380
  /* 해당 dataset의 supervisor로 하여금, data를 리뷰하고 instruction을 작성해서, approvalLine을 이용해서 승인을 한다. */
377
- if (assignees && assignees instanceof Array && assignees.length > 0) {
381
+ if (assigneeRole) {
378
382
  dataSample.dataItems = dataItems
379
383
  const activityInstance = {
380
384
  name: `[Data 검토] ${dataSet.name}`,
@@ -384,7 +388,9 @@ export async function createDataSample(newDataSample: NewDataSample, context: Re
384
388
  input: {
385
389
  dataSampleId: dataSample.id
386
390
  },
387
- assignees,
391
+ assigneeRole,
392
+ threadsMin: 1,
393
+ threadsMax: 1,
388
394
  approvalLine: dataSet.reviewApprovalLine
389
395
  }
390
396
 
@@ -36,10 +36,10 @@ export async function issueDataCollectionTask(
36
36
  if (activity) {
37
37
  const { entryRole } = dataSet
38
38
 
39
- const assignees = entryRole ? [{ type: OrgMemberTargetType.Role, value: entryRole.id, assignee: entryRole }] : []
39
+ // const assignees = entryRole ? [{ type: OrgMemberTargetType.Role, value: entryRole.id, assignee: entryRole }] : []
40
40
 
41
41
  /* 해당 dataset에 대한 데이타 수집 태스크를 dataset entryRole에게 할당한다. */
42
- if (assignees && assignees instanceof Array && assignees.length > 0) {
42
+ if (entryRole) {
43
43
  const activityInstance = {
44
44
  name: `[Data 수집] ${dataSet.name}`,
45
45
  description: dataSet.description,
@@ -49,7 +49,9 @@ export async function issueDataCollectionTask(
49
49
  dataSetId: dataSet.id,
50
50
  dataSetName: dataSet.name
51
51
  },
52
- assignees
52
+ assigneeRole: entryRole,
53
+ threadsMin: 1,
54
+ threadsMax: 1
53
55
  }
54
56
 
55
57
  context.state = {
@@ -6,7 +6,6 @@ import { User } from '@things-factory/auth-base'
6
6
  import { createAttachment, deleteAttachmentsByRef } from '@things-factory/attachment-base'
7
7
  import { ApprovalLineItem, OrgMemberTargetType } from '@things-factory/organization'
8
8
  import { Application, CallbackBase, registerSchedule, unregisterSchedule } from '@things-factory/scheduler-client'
9
- import { Activity, AssigneeItem, issue } from '@things-factory/worklist'
10
9
 
11
10
  import { getDataFinalizeCrontabSchedule } from '../../controllers/finalize-data-collection'
12
11
  import { DataSet } from './data-set'
@@ -81,39 +80,6 @@ function getOutlierApprovalLineValue(patch: NewDataSet | DataSetPatch): Approval
81
80
  })
82
81
  }
83
82
 
84
- function getAssigneesValue(patch: NewDataSet | DataSetPatch): AssigneeItem[] {
85
- const { assignees } = patch
86
-
87
- if (!('assignees' in patch)) {
88
- /* assignees이 언급되지 않았다면, 업데이트하지 않는다. */
89
- return
90
- }
91
-
92
- if (!assignees || !(assignees instanceof Array)) {
93
- /* assignees의 값이 없거나 배열이 아니라면, 클리어시킨다. */
94
- return null
95
- }
96
-
97
- return assignees
98
- .map(m => {
99
- return {
100
- type: m.type,
101
- assignee: m.assignee
102
- }
103
- })
104
- .filter(m => m.type)
105
- .filter(m => {
106
- switch (m.type) {
107
- case OrgMemberTargetType.Employee:
108
- case OrgMemberTargetType.Department:
109
- case OrgMemberTargetType.Role:
110
- return !!m.assignee?.id
111
- default:
112
- return true
113
- }
114
- })
115
- }
116
-
117
83
  @Resolver(DataSet)
118
84
  export class DataSetMutation {
119
85
  @Directive('@privilege(category: "data-set", privilege: "mutation", domainOwnerGranted: true)')
@@ -126,7 +92,6 @@ export class DataSetMutation {
126
92
  const result = await dataSetRepo.save({
127
93
  ...dataSet,
128
94
  approvalLine: getApprovalLineValue(dataSet),
129
- assignees: getAssigneesValue(dataSet),
130
95
  outlierApprovalLineValue: getOutlierApprovalLineValue(dataSet),
131
96
  version: 1,
132
97
  domain,
@@ -161,7 +126,6 @@ export class DataSetMutation {
161
126
  ...patch,
162
127
  approvalLine: getApprovalLineValue(patch),
163
128
  outlierApprovalLineValue: getOutlierApprovalLineValue(patch),
164
- assignees: getAssigneesValue(patch),
165
129
  updater: user
166
130
  })
167
131
 
@@ -192,7 +156,6 @@ export class DataSetMutation {
192
156
  const result = await dataSetRepo.save({
193
157
  ...newRecord,
194
158
  approvalLine: getApprovalLineValue(newRecord),
195
- assignees: getAssigneesValue(newRecord),
196
159
  outlierApprovalLineValue: getOutlierApprovalLineValue(newRecord),
197
160
  domain,
198
161
  creator: user,
@@ -223,7 +186,6 @@ export class DataSetMutation {
223
186
  ...updateRecord,
224
187
  approvalLine: getApprovalLineValue(updateRecord),
225
188
  outlierApprovalLineValue: getOutlierApprovalLineValue(updateRecord),
226
- assignees: getAssigneesValue(updateRecord),
227
189
  updater: user
228
190
  })
229
191
 
@@ -184,6 +184,18 @@ export class DataSetQuery {
184
184
  )
185
185
  }
186
186
 
187
+ // 데이터셋의 resolver 역할을 조회
188
+ @FieldResolver(type => Role, { description: 'Retrieves the resolver role for the dataset' })
189
+ async resolverRole(@Root() dataSet: DataSet): Promise<Role> {
190
+ return (
191
+ dataSet.resolverRole ||
192
+ (dataSet.resolverRoleId &&
193
+ (await getRepository(Role).findOneBy({
194
+ id: dataSet.resolverRoleId
195
+ })))
196
+ )
197
+ }
198
+
187
199
  @FieldResolver(type => [AssigneeItem], { description: 'Retrieves the assignee items for the dataset' })
188
200
  async assignees(@Root() dataSet: DataSet, @Ctx() context: ResolverContext): Promise<AssigneeItem[]> {
189
201
  const { domain, user } = context.state
@@ -29,8 +29,8 @@ export class NewDataSet {
29
29
  @Field(type => ObjectRef, { nullable: true })
30
30
  supervisoryRole?: ObjectRef
31
31
 
32
- @Field(type => ScalarObject, { nullable: true })
33
- assignees?: AssigneeItem[]
32
+ @Field(type => ObjectRef, { nullable: true })
33
+ resolverRole?: ObjectRef
34
34
 
35
35
  @Field(type => ScalarObject, { nullable: true })
36
36
  reviewApprovalLine?: ApprovalLineItem[]
@@ -116,8 +116,8 @@ export class DataSetPatch {
116
116
  @Field(type => ObjectRef, { nullable: true })
117
117
  entryRole?: ObjectRef
118
118
 
119
- @Field(type => ScalarObject, { nullable: true })
120
- assignees?: AssigneeItem[]
119
+ @Field(type => ObjectRef, { nullable: true })
120
+ resolverRole?: ObjectRef
121
121
 
122
122
  @Field(type => ScalarObject, { nullable: true })
123
123
  reviewApprovalLine?: ApprovalLineItem[]
@@ -150,6 +150,16 @@ export class DataSet {
150
150
  @RelationId((dataSet: DataSet) => dataSet.supervisoryRole)
151
151
  supervisoryRoleId?: string
152
152
 
153
+ @ManyToOne(type => Role, { nullable: true })
154
+ @Field(type => Role, {
155
+ nullable: true,
156
+ description: 'The final authority on resolving outlier related to that dataset.'
157
+ })
158
+ resolverRole?: Role
159
+
160
+ @RelationId((dataSet: DataSet) => dataSet.resolverRole)
161
+ resolverRoleId?: string
162
+
153
163
  @Column('simple-json', { nullable: true })
154
164
  @Field(type => [AssigneeItem], { nullable: true, description: 'Who to contact for OOC issues' })
155
165
  assignees?: AssigneeItem[]
@@ -70,6 +70,7 @@
70
70
  "field.report-view": "report view",
71
71
  "field.request-params": "request parameters",
72
72
  "field.requires-review": "requires review",
73
+ "field.resolver-role": "resolver role",
73
74
  "field.review-approval-line": "review approval line",
74
75
  "field.role": "role",
75
76
  "field.serial-no": "serial #",
@@ -71,6 +71,7 @@
71
71
  "field.report-view": "レポート用画面",
72
72
  "field.request-params": "リクエスト パラメータ",
73
73
  "field.requires-review": "見直しが必要",
74
+ "field.resolver-role": "解決者役割",
74
75
  "field.review-approval-line": "決済ライン",
75
76
  "field.role": "ロール",
76
77
  "field.serial-no": "シリアル番号",
@@ -71,6 +71,7 @@
71
71
  "field.report-view": "리포트용 화면",
72
72
  "field.request-params": "요청 매개변수",
73
73
  "field.requires-review": "검토 요청",
74
+ "field.resolver-role": "해결자 역할",
74
75
  "field.review-approval-line": "결재라인",
75
76
  "field.role": "역할",
76
77
  "field.serial-no": "시리얼번호",
@@ -71,6 +71,7 @@
71
71
  "field.report-view": "paparan laporan",
72
72
  "field.request-params": "parameter permintaan",
73
73
  "field.requires-review": "memerlukan semakan",
74
+ "field.resolver-role": "peranan penyelesai",
74
75
  "field.review-approval-line": "baris kelulusan",
75
76
  "field.role": "peranan",
76
77
  "field.serial-no": "no. siri",
@@ -71,6 +71,7 @@
71
71
  "field.report-view": "报告界面",
72
72
  "field.request-params": "请求参数",
73
73
  "field.requires-review": "需要审查",
74
+ "field.resolver-role": "解决者角色",
74
75
  "field.review-approval-line": "审批线",
75
76
  "field.role": "角色",
76
77
  "field.serial-no": "序列号",