@things-factory/organization 10.1.259 → 10.1.261
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/pages/department/department-list-page.d.ts +8 -4
- package/dist-client/pages/department/department-list-page.js +28 -33
- package/dist-client/pages/department/department-list-page.js.map +1 -1
- package/dist-client/pages/employee/employee-list-page.d.ts +20 -6
- package/dist-client/pages/employee/employee-list-page.js +154 -97
- package/dist-client/pages/employee/employee-list-page.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/service/certificate/employment-certificates.js +3 -10
- package/dist-server/service/certificate/employment-certificates.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -7
- package/tests/department-query-shape.test.ts +1 -1
|
@@ -20,20 +20,13 @@ exports.CAREER_CERTIFICATE_KIND = 'organization.career-certificate';
|
|
|
20
20
|
['employee-certificate', 'query'],
|
|
21
21
|
['employee-certificate', 'mutation']
|
|
22
22
|
]);
|
|
23
|
-
/** What the caller holds, asked as the doors ask it. */
|
|
24
|
-
async function holds(context, category, privilege) {
|
|
25
|
-
const { domain, user, unsafeIP, prohibitedPrivileges } = context?.state ?? {};
|
|
26
|
-
if (!domain || !user)
|
|
27
|
-
return false;
|
|
28
|
-
return !!(await (0, auth_base_1.checkPermission)({ category, privilege, owner: true }, user, domain, unsafeIP, prohibitedPrivileges));
|
|
29
|
-
}
|
|
30
23
|
/** Who is asking about whom: theirs, and what they hold. */
|
|
31
24
|
async function standingOf(context, employeeId) {
|
|
32
25
|
return {
|
|
33
26
|
own: !!employeeId && (await (0, my_employee_1.myEmployeeIds)(context)).includes(employeeId),
|
|
34
|
-
self: await
|
|
35
|
-
issuing: await
|
|
36
|
-
reading: await
|
|
27
|
+
self: await (0, auth_base_1.requestHolds)(context, 'employee-self', 'mutation'),
|
|
28
|
+
issuing: await (0, auth_base_1.requestHolds)(context, 'employee-certificate', 'mutation'),
|
|
29
|
+
reading: await (0, auth_base_1.requestHolds)(context, 'employee-certificate', 'query')
|
|
37
30
|
};
|
|
38
31
|
}
|
|
39
32
|
async function employeeOf(context, id) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"employment-certificates.js","sourceRoot":"","sources":["../../../server/service/certificate/employment-certificates.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"employment-certificates.js","sourceRoot":"","sources":["../../../server/service/certificate/employment-certificates.ts"],"names":[],"mappings":";;;AAAA,yDAA2E;AAC3E,6CAAgE;AAChE,iDAA2E;AAE3E,mDAA+C;AAC/C,yDAAuD;AACvD,iFAA0G;AAC1G,yFAAyF;AAEzF;;;;GAIG;AACU,QAAA,2BAA2B,GAAG,qCAAqC,CAAA;AACnE,QAAA,uBAAuB,GAAG,iCAAiC,CAAA;AAExE,gGAAgG;AAChG,IAAA,6BAAiB,EAAC,sCAAsC,EAAE;IACxD,CAAC,sBAAsB,EAAE,OAAO,CAAC;IACjC,CAAC,sBAAsB,EAAE,UAAU,CAAC;CACrC,CAAC,CAAA;AAEF,4DAA4D;AAC5D,KAAK,UAAU,UAAU,CAAC,OAAY,EAAE,UAAqC;IAC3E,OAAO;QACL,GAAG,EAAE,CAAC,CAAC,UAAU,IAAI,CAAC,MAAM,IAAA,2BAAa,EAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC;QACxE,IAAI,EAAE,MAAM,IAAA,wBAAY,EAAC,OAAO,EAAE,eAAe,EAAE,UAAU,CAAC;QAC9D,OAAO,EAAE,MAAM,IAAA,wBAAY,EAAC,OAAO,EAAE,sBAAsB,EAAE,UAAU,CAAC;QACxE,OAAO,EAAE,MAAM,IAAA,wBAAY,EAAC,OAAO,EAAE,sBAAsB,EAAE,OAAO,CAAC;KACtE,CAAA;AACH,CAAC;AAED,KAAK,UAAU,UAAU,CAAC,OAAY,EAAE,EAAU;IAChD,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,O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;QACjF,KAAK,CAAC,UAAU,CAAC,OAAO;YACtB,MAAM,IAAI,GAAG,MAAM,IAAA,2BAAa,EAAC,OAAO,CAAC,CAAA;YACzC,OAAO,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;QAC3C,CAAC;QACD,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE,KAAK;YAC3B,OAAO,IAAA,kDAAmB,EAAC,IAAI,EAAE,MAAM,UAAU,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAA;QACpE,CAAC;QACD,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG;YACxB,OAAO,IAAA,iDAAkB,EAAC,MAAM,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAA;QACjE,CAAC;KACF,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import { declarePrivileges, requestHolds } from '@things-factory/auth-base'\nimport { registerIssuedDocumentKind } from '@things-factory/pdf'\nimport { calendarDay, getRepository, Refusal } from '@things-factory/shell'\n\nimport { Employee } from '../employee/employee'\nimport { myEmployeeIds } from '../employee/my-employee'\nimport { certificateFacts, mayIssueCertificate, mayReadCertificate } from './employment-certificate-rules'\nimport { CAREER_TEMPLATE, EMPLOYMENT_TEMPLATE } from './employment-certificate-templates'\n\n/*\n * 재직증명서 · 경력증명서 - issued documents of the employment, which organization owns (ADR-0176 decision 5). An employee\n * issues their own 재직증명서 (`employee-self`); everyone else's, and every 경력증명서, under `employee-certificate`\n * (`organization.certificates-issuing`). No birth date or address is printed (Q2).\n */\nexport const EMPLOYMENT_CERTIFICATE_KIND = 'organization.employment-certificate'\nexport const CAREER_CERTIFICATE_KIND = 'organization.career-certificate'\n\n/* Asked here only - no field gates on it - so declared here, or no role could be granted it. */\ndeclarePrivileges('organization employment certificates', [\n ['employee-certificate', 'query'],\n ['employee-certificate', 'mutation']\n])\n\n/** Who is asking about whom: theirs, and what they hold. */\nasync function standingOf(context: any, employeeId: string | null | undefined) {\n return {\n own: !!employeeId && (await myEmployeeIds(context)).includes(employeeId),\n self: await requestHolds(context, 'employee-self', 'mutation'),\n issuing: await requestHolds(context, 'employee-certificate', 'mutation'),\n reading: await requestHolds(context, 'employee-certificate', 'query')\n }\n}\n\nasync function employeeOf(context: any, id: string): Promise<Employee> {\n const { domain, tx } = context.state\n const employee = await getRepository(Employee, tx).findOne({ where: { id, domain: { id: domain.id } }, relations: ['department'] })\n if (!employee) throw new Refusal('employee-not-found', {}, 'the employee was not found')\n return employee\n}\n\nfor (const kind of [EMPLOYMENT_CERTIFICATE_KIND, CAREER_CERTIFICATE_KIND] as const) {\n const career = kind === CAREER_CERTIFICATE_KIND\n registerIssuedDocumentKind({\n kind,\n prefix: career ? '경력' : '재직',\n refType: 'Employee',\n template: { content_template: career ? CAREER_TEMPLATE : EMPLOYMENT_TEMPLATE, page_size: 'A4' },\n async dataOf(context, refId, input) {\n const employee = await employeeOf(context, refId)\n const facts = certificateFacts(kind, employee, calendarDay(context.state.domain.timezone))\n return { subjectName: employee.name ?? '', data: { employee: facts } }\n },\n /* One's own employee record - issued from 내 정보 › 내 증명서 (the issuance ledger). */\n async ownSubject(context) {\n const mine = await myEmployeeIds(context)\n return mine.length === 1 ? mine[0] : null\n },\n async mayIssue(context, refId) {\n return mayIssueCertificate(kind, await standingOf(context, refId))\n },\n async mayRead(context, row) {\n return mayReadCertificate(await standingOf(context, row.refId))\n }\n })\n}\n"]}
|