@things-factory/worklist 10.1.44 → 10.1.46
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/dist-client/components/activity-thread-timeline.d.ts +2 -2
- package/dist-client/pages/activity-instance/activity-instance-view.js +6 -3
- package/dist-client/pages/activity-instance/activity-instance-view.js.map +1 -1
- package/dist-client/pages/activity-thread/activity-thread-view.d.ts +1 -1
- package/dist-client/route.d.ts +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/service/activity-summary/activity-summary-query.js +6 -53
- package/dist-server/service/activity-summary/activity-summary-query.js.map +1 -1
- package/dist-server/service/activity-summary/index.d.ts +2 -1
- package/dist-server/service/activity-summary/index.js +2 -1
- package/dist-server/service/activity-summary/index.js.map +1 -1
- package/dist-server/service/activity-summary/open-work.d.ts +5 -0
- package/dist-server/service/activity-summary/open-work.js +63 -0
- package/dist-server/service/activity-summary/open-work.js.map +1 -0
- package/dist-server/service/activity-summary/person-open-work.d.ts +17 -0
- package/dist-server/service/activity-summary/person-open-work.js +68 -0
- package/dist-server/service/activity-summary/person-open-work.js.map +1 -0
- package/dist-server/service/index.d.ts +3 -3
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -10
- package/tests/person-open-work.test.ts +91 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/worklist",
|
|
3
|
-
"version": "10.1.
|
|
3
|
+
"version": "10.1.46",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "dist-client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -37,14 +37,14 @@
|
|
|
37
37
|
"@operato/moment-timezone-es": "^10.0.0",
|
|
38
38
|
"@operato/p13n": "^10.0.0",
|
|
39
39
|
"@operato/popup": "^10.15.0",
|
|
40
|
-
"@things-factory/attachment-base": "^10.1.
|
|
41
|
-
"@things-factory/auth-base": "^10.1.
|
|
42
|
-
"@things-factory/board-service": "^10.1.
|
|
43
|
-
"@things-factory/context-ui": "^10.1.
|
|
44
|
-
"@things-factory/organization": "^10.1.
|
|
45
|
-
"@things-factory/personalization": "^10.1.
|
|
46
|
-
"@things-factory/scheduler-client": "^10.1.
|
|
47
|
-
"@things-factory/shell": "^10.1.
|
|
40
|
+
"@things-factory/attachment-base": "^10.1.46",
|
|
41
|
+
"@things-factory/auth-base": "^10.1.46",
|
|
42
|
+
"@things-factory/board-service": "^10.1.46",
|
|
43
|
+
"@things-factory/context-ui": "^10.1.46",
|
|
44
|
+
"@things-factory/organization": "^10.1.46",
|
|
45
|
+
"@things-factory/personalization": "^10.1.46",
|
|
46
|
+
"@things-factory/scheduler-client": "^10.1.46",
|
|
47
|
+
"@things-factory/shell": "^10.1.46"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "d3467cde550453f3348fed0ed6c79a12a6ba0db4"
|
|
50
50
|
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { join } from 'path'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* What a person holds, asked by someone else - through the real resolvers on sqlite.
|
|
5
|
+
*
|
|
6
|
+
* The person 360 shows a colleague's open work as counts (ADR-0067, the person 360 ruling; ADR-0091
|
|
7
|
+
* keeps the cases themselves to the people on them). The counts must be the same answer that person's
|
|
8
|
+
* own badges give - one rule, `open-work.ts` - and a person who is not a member of this domain gets
|
|
9
|
+
* no answer at all.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const { createSqliteTestDataSource } = require(
|
|
13
|
+
join(__dirname, '..', '..', 'ops-master', 'test', 'support', 'database.cjs')
|
|
14
|
+
)
|
|
15
|
+
const DIST = join(__dirname, '..', 'dist-server')
|
|
16
|
+
const { ActivityInstance } = require(join(DIST, 'service', 'activity-instance', 'activity-instance.js'))
|
|
17
|
+
const { ActivityThread } = require(join(DIST, 'service', 'activity-thread', 'activity-thread.js'))
|
|
18
|
+
const { ActivityApproval } = require(join(DIST, 'service', 'activity-approval', 'activity-approval.js'))
|
|
19
|
+
const { PersonOpenWorkQuery } = require(join(DIST, 'service', 'activity-summary', 'person-open-work.js'))
|
|
20
|
+
const { ActivitySummaryQuery } = require(join(DIST, 'service', 'activity-summary', 'activity-summary-query.js'))
|
|
21
|
+
const shell = require('@things-factory/shell')
|
|
22
|
+
const { User } = require('@things-factory/auth-base')
|
|
23
|
+
|
|
24
|
+
let db: any
|
|
25
|
+
let here: any
|
|
26
|
+
let elsewhere: any
|
|
27
|
+
let viewer: any
|
|
28
|
+
let worker: any
|
|
29
|
+
let stranger: any
|
|
30
|
+
|
|
31
|
+
const asViewer = () => ({ state: { domain: here, user: viewer }, t: (key: string) => key }) as any
|
|
32
|
+
const asWorker = () => ({ state: { domain: here, user: worker }, t: (key: string) => key }) as any
|
|
33
|
+
const openWork = (userId: string) => new PersonOpenWorkQuery().personOpenWork(userId, asViewer())
|
|
34
|
+
|
|
35
|
+
beforeAll(async () => {
|
|
36
|
+
db = createSqliteTestDataSource([ActivityInstance, ActivityThread, ActivityApproval])
|
|
37
|
+
await db.initialize()
|
|
38
|
+
shell.addDataSource('default', db)
|
|
39
|
+
|
|
40
|
+
here = await db.getRepository(shell.Domain).save({ name: 'here', subdomain: 'here' })
|
|
41
|
+
elsewhere = await db.getRepository(shell.Domain).save({ name: 'elsewhere', subdomain: 'elsewhere' })
|
|
42
|
+
|
|
43
|
+
const person = (name: string, domains: any[]) =>
|
|
44
|
+
db.getRepository(User).save({ name, email: `${name}@example.com`, password: 'x', status: 'activated', domains })
|
|
45
|
+
|
|
46
|
+
viewer = await person('viewer', [here])
|
|
47
|
+
worker = await person('worker', [here])
|
|
48
|
+
stranger = await person('stranger', [elsewhere])
|
|
49
|
+
|
|
50
|
+
const aCase = (name: string) =>
|
|
51
|
+
db.getRepository(ActivityInstance).save({ domain: here, name, state: 'issued', issuer: viewer })
|
|
52
|
+
const instance = await aCase('i')
|
|
53
|
+
|
|
54
|
+
/* Two threads the worker holds and one that ended - the ended one is not work. One thread per case and person. */
|
|
55
|
+
for (const state of ['assigned', 'started', 'ended']) {
|
|
56
|
+
await db
|
|
57
|
+
.getRepository(ActivityThread)
|
|
58
|
+
.save({ domain: here, name: state, round: 1, state, assignee: worker, activityInstance: await aCase(state) })
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/* One approval waiting on the worker (ActivityApprovalJudgment.Pending is the empty string). */
|
|
62
|
+
const submitted = await db
|
|
63
|
+
.getRepository(ActivityThread)
|
|
64
|
+
.save({ domain: here, name: 's', round: 1, state: 'submitted', activityInstance: instance })
|
|
65
|
+
await db
|
|
66
|
+
.getRepository(ActivityApproval)
|
|
67
|
+
.save({ domain: here, activityThread: submitted, approver: worker, order: 1, round: 1, judgment: '' })
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
afterAll(async () => db?.destroy())
|
|
71
|
+
|
|
72
|
+
it('★ counts what a colleague holds - threads not finished and approvals waiting', async () => {
|
|
73
|
+
const work = await openWork(worker.id)
|
|
74
|
+
expect(work).toEqual({ toDos: 2, approvalsPending: 1 })
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
it("★ gives the same numbers the person's own badges give", async () => {
|
|
78
|
+
const summary = new ActivitySummaryQuery()
|
|
79
|
+
const work = await openWork(worker.id)
|
|
80
|
+
|
|
81
|
+
expect(await summary.numberOfToDos({}, asWorker())).toBe(work.toDos)
|
|
82
|
+
expect(await summary.numberOfApprovalPendings({}, asWorker())).toBe(work.approvalsPending)
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
it('★ answers nothing for a person who is not a member of this domain', async () => {
|
|
86
|
+
expect(await openWork(stranger.id)).toBeNull()
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
it('holds zero for a member with nothing, which is not the same as no answer', async () => {
|
|
90
|
+
expect(await openWork(viewer.id)).toEqual({ toDos: 0, approvalsPending: 0 })
|
|
91
|
+
})
|