@things-factory/compliance 10.1.263 → 10.1.265
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.
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import gql from 'graphql-tag';
|
|
2
2
|
import { client } from '@operato/graphql';
|
|
3
3
|
import { i18next } from '@operato/i18n';
|
|
4
|
+
import { hasPrivilege } from '@things-factory/auth-base/dist-client';
|
|
4
5
|
import { localDayOf, registerWorkCalendarSource } from '@things-factory/worklist/dist-client';
|
|
5
6
|
/*
|
|
6
7
|
* 분쟁 기일 on 「내 업무 달력」 (ADR-0187 decision 25) - the calendar module has no door for a module's dated facts; the
|
|
7
8
|
* work calendar takes sources, so a dispute's hearings go there for those who keep the disputes. Anyone else has no
|
|
8
|
-
* chip
|
|
9
|
+
* chip. Check the profile before querying: a refused probe also reaches the global GraphQL error notifier.
|
|
9
10
|
*/
|
|
10
11
|
const HEARINGS = gql `
|
|
11
12
|
query ($from: String!, $to: String!) {
|
|
@@ -18,15 +19,15 @@ const read = async (from, to) => {
|
|
|
18
19
|
throw response;
|
|
19
20
|
return response.data.disputeHearings.items;
|
|
20
21
|
};
|
|
22
|
+
const mayReadHearings = async () => Boolean(await hasPrivilege({ category: 'dispute', privilege: 'query', domainOwnerGranted: true }));
|
|
21
23
|
export function registerDisputeCalendarSource() {
|
|
22
24
|
registerWorkCalendarSource({
|
|
23
25
|
key: 'compliance-dispute-hearings',
|
|
24
26
|
label: () => i18next.t('label.calendar-dispute-hearings'),
|
|
25
|
-
|
|
26
|
-
const today = localDayOf(new Date());
|
|
27
|
-
return await read(today, today).then(() => true, () => false);
|
|
28
|
-
},
|
|
27
|
+
applies: mayReadHearings,
|
|
29
28
|
async load(from, to) {
|
|
29
|
+
if (!(await mayReadHearings()))
|
|
30
|
+
return [];
|
|
30
31
|
/* [from, to) - the last day drawn is the day before `to`. */
|
|
31
32
|
const last = localDayOf(new Date(to.getTime() - 1));
|
|
32
33
|
return (await read(localDayOf(from), last)).map(one => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispute-calendar-source.js","sourceRoot":"","sources":["../../client/legal-record/dispute-calendar-source.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,aAAa,CAAA;AAE7B,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,0BAA0B,EAA0B,MAAM,sCAAsC,CAAA;AAErH;;;;GAIG;AAEH,MAAM,QAAQ,GAAG,GAAG,CAAA;;;;CAInB,CAAA;AAED,MAAM,IAAI,GAAG,KAAK,EAAE,IAAY,EAAE,EAAU,EAAE,EAAE;IAC9C,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC,CAAA;IAC9G,IAAI,QAAQ,CAAC,MAAM,EAAE,MAAM;QAAE,MAAM,QAAQ,CAAA;IAC3C,OAAO,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,KAAc,CAAA;AACrD,CAAC,CAAA;AAED,MAAM,
|
|
1
|
+
{"version":3,"file":"dispute-calendar-source.js","sourceRoot":"","sources":["../../client/legal-record/dispute-calendar-source.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,aAAa,CAAA;AAE7B,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAA;AACpE,OAAO,EAAE,UAAU,EAAE,0BAA0B,EAA0B,MAAM,sCAAsC,CAAA;AAErH;;;;GAIG;AAEH,MAAM,QAAQ,GAAG,GAAG,CAAA;;;;CAInB,CAAA;AAED,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AM,CAAC,CAAA;gBAC5D,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;gBAChE,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,QAAQ,CAAA;gBAC/C,OAAO;oBACL,EAAE,EAAE,GAAG,CAAC,EAAE;oBACV,IAAI,EAAE,GAAG,GAAG,CAAC,IAAI,MAAM,GAAG,CAAC,OAAO,EAAE,KAAK,IAAI,EAAE,EAAE;oBACjD,IAAI,EAAE,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,EAAE,GAAG,EAAE,IAAI,IAAI,CAAC,EAAE,MAAM,IAAI,CAAC,CAAC;oBAC5D,MAAM,EAAE,CAAC,GAAG,CAAC,MAAM;oBACnB,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;oBACpB,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;oBACxB,IAAI,EAAE,OAAO;oBACb,IAAI,EAAE,cAAc;oBACpB,IAAI,EAAE,GAAG,CAAC,KAAK,IAAI,SAAS;iBACR,CAAA;YACxB,CAAC,CAAC,CAAA;QACJ,CAAC;KACF,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import gql from 'graphql-tag'\n\nimport { client } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\nimport { hasPrivilege } from '@things-factory/auth-base/dist-client'\nimport { localDayOf, registerWorkCalendarSource, type WorkCalendarEntry } from '@things-factory/worklist/dist-client'\n\n/*\n * 분쟁 기일 on 「내 업무 달력」 (ADR-0187 decision 25) - the calendar module has no door for a module's dated facts; the\n * work calendar takes sources, so a dispute's hearings go there for those who keep the disputes. Anyone else has no\n * chip. Check the profile before querying: a refused probe also reaches the global GraphQL error notifier.\n */\n\nconst HEARINGS = gql`\n query ($from: String!, $to: String!) {\n disputeHearings(from: $from, to: $to) { items { id heldOn heldAt name place dispute { id title status } } }\n }\n`\n\nconst read = async (from: string, to: string) => {\n const response = await client.query({ query: HEARINGS, variables: { from, to }, fetchPolicy: 'network-only' })\n if (response.errors?.length) throw response\n return response.data.disputeHearings.items as any[]\n}\n\nconst mayReadHearings = async () => Boolean(await hasPrivilege({ category: 'dispute', privilege: 'query', domainOwnerGranted: true }))\n\nexport function registerDisputeCalendarSource(): void {\n registerWorkCalendarSource({\n key: 'compliance-dispute-hearings',\n label: () => i18next.t('label.calendar-dispute-hearings'),\n applies: mayReadHearings,\n async load(from: Date, to: Date): Promise<WorkCalendarEntry[]> {\n if (!(await mayReadHearings())) return []\n /* [from, to) - the last day drawn is the day before `to`. */\n const last = localDayOf(new Date(to.getTime() - 1))\n return (await read(localDayOf(from), last)).map(one => {\n const [year, month, day] = one.heldOn.split('-').map(Number)\n const [hour, minute] = (one.heldAt ?? '').split(':').map(Number)\n const closed = one.dispute?.status === 'CLOSED'\n return {\n id: one.id,\n name: `${one.name} · ${one.dispute?.title ?? ''}`,\n date: new Date(year, month - 1, day, hour || 0, minute || 0),\n allDay: !one.heldAt,\n rank: closed ? 2 : 0,\n priority: closed ? 0 : 2,\n icon: 'gavel',\n href: 'dispute-list',\n note: one.place ?? undefined\n } as WorkCalendarEntry\n })\n }\n })\n}\n"]}
|