@things-factory/compliance 0.0.0-stage → 10.1.254
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/bootstrap.d.ts +2 -0
- package/dist-client/bootstrap.js +28 -0
- package/dist-client/bootstrap.js.map +1 -0
- package/dist-client/components/compliance-case-form.d.ts +42 -0
- package/dist-client/components/compliance-case-form.js +313 -0
- package/dist-client/components/compliance-case-form.js.map +1 -0
- package/dist-client/components/compliance-case-sheet.d.ts +35 -0
- package/dist-client/components/compliance-case-sheet.js +335 -0
- package/dist-client/components/compliance-case-sheet.js.map +1 -0
- package/dist-client/components/compliance-my-inventions.d.ts +17 -0
- package/dist-client/components/compliance-my-inventions.js +133 -0
- package/dist-client/components/compliance-my-inventions.js.map +1 -0
- package/dist-client/components/compliance-my-privacy-requests.d.ts +34 -0
- package/dist-client/components/compliance-my-privacy-requests.js +232 -0
- package/dist-client/components/compliance-my-privacy-requests.js.map +1 -0
- package/dist-client/components/compliance-my-reports.d.ts +19 -0
- package/dist-client/components/compliance-my-reports.js +137 -0
- package/dist-client/components/compliance-my-reports.js.map +1 -0
- package/dist-client/components/guide-link.d.ts +13 -0
- package/dist-client/components/guide-link.js +55 -0
- package/dist-client/components/guide-link.js.map +1 -0
- package/dist-client/components/invention-report-form.d.ts +30 -0
- package/dist-client/components/invention-report-form.js +188 -0
- package/dist-client/components/invention-report-form.js.map +1 -0
- package/dist-client/components/legal-todo.d.ts +10 -0
- package/dist-client/components/legal-todo.js +43 -0
- package/dist-client/components/legal-todo.js.map +1 -0
- package/dist-client/components/my-trainings.d.ts +18 -0
- package/dist-client/components/my-trainings.js +149 -0
- package/dist-client/components/my-trainings.js.map +1 -0
- package/dist-client/components/regulation-form.d.ts +26 -0
- package/dist-client/components/regulation-form.js +161 -0
- package/dist-client/components/regulation-form.js.map +1 -0
- package/dist-client/components/seal-use-form.d.ts +47 -0
- package/dist-client/components/seal-use-form.js +300 -0
- package/dist-client/components/seal-use-form.js.map +1 -0
- package/dist-client/components/training-attendance-form.d.ts +37 -0
- package/dist-client/components/training-attendance-form.js +186 -0
- package/dist-client/components/training-attendance-form.js.map +1 -0
- package/dist-client/components/training-certificate-form.d.ts +41 -0
- package/dist-client/components/training-certificate-form.js +198 -0
- package/dist-client/components/training-certificate-form.js.map +1 -0
- package/dist-client/components/training-session-form.d.ts +39 -0
- package/dist-client/components/training-session-form.js +270 -0
- package/dist-client/components/training-session-form.js.map +1 -0
- package/dist-client/components/training-setting-form.d.ts +45 -0
- package/dist-client/components/training-setting-form.js +175 -0
- package/dist-client/components/training-setting-form.js.map +1 -0
- package/dist-client/index.d.ts +4 -0
- package/dist-client/index.js +8 -0
- package/dist-client/index.js.map +1 -0
- package/dist-client/legal-record/dispute-calendar-source.d.ts +1 -0
- package/dist-client/legal-record/dispute-calendar-source.js +51 -0
- package/dist-client/legal-record/dispute-calendar-source.js.map +1 -0
- package/dist-client/legal-record/legal-child-grid.d.ts +31 -0
- package/dist-client/legal-record/legal-child-grid.js +76 -0
- package/dist-client/legal-record/legal-child-grid.js.map +1 -0
- package/dist-client/legal-record/legal-codes.d.ts +3 -0
- package/dist-client/legal-record/legal-codes.js +5 -0
- package/dist-client/legal-record/legal-codes.js.map +1 -0
- package/dist-client/legal-record/legal-grid.d.ts +59 -0
- package/dist-client/legal-record/legal-grid.js +68 -0
- package/dist-client/legal-record/legal-grid.js.map +1 -0
- package/dist-client/legal-record/legal-record-files.d.ts +26 -0
- package/dist-client/legal-record/legal-record-files.js +162 -0
- package/dist-client/legal-record/legal-record-files.js.map +1 -0
- package/dist-client/pages/compliance-case-list.d.ts +35 -0
- package/dist-client/pages/compliance-case-list.js +112 -0
- package/dist-client/pages/compliance-case-list.js.map +1 -0
- package/dist-client/pages/dispute-list.d.ts +57 -0
- package/dist-client/pages/dispute-list.js +156 -0
- package/dist-client/pages/dispute-list.js.map +1 -0
- package/dist-client/pages/invention-list.d.ts +57 -0
- package/dist-client/pages/invention-list.js +166 -0
- package/dist-client/pages/invention-list.js.map +1 -0
- package/dist-client/pages/legal-registration-list.d.ts +63 -0
- package/dist-client/pages/legal-registration-list.js +206 -0
- package/dist-client/pages/legal-registration-list.js.map +1 -0
- package/dist-client/pages/privacy-record-list.d.ts +52 -0
- package/dist-client/pages/privacy-record-list.js +225 -0
- package/dist-client/pages/privacy-record-list.js.map +1 -0
- package/dist-client/pages/regulation-detail.d.ts +43 -0
- package/dist-client/pages/regulation-detail.js +370 -0
- package/dist-client/pages/regulation-detail.js.map +1 -0
- package/dist-client/pages/regulation-list.d.ts +52 -0
- package/dist-client/pages/regulation-list.js +144 -0
- package/dist-client/pages/regulation-list.js.map +1 -0
- package/dist-client/pages/regulations.d.ts +49 -0
- package/dist-client/pages/regulations.js +412 -0
- package/dist-client/pages/regulations.js.map +1 -0
- package/dist-client/pages/seal-use-list.d.ts +57 -0
- package/dist-client/pages/seal-use-list.js +168 -0
- package/dist-client/pages/seal-use-list.js.map +1 -0
- package/dist-client/pages/training-list.d.ts +51 -0
- package/dist-client/pages/training-list.js +333 -0
- package/dist-client/pages/training-list.js.map +1 -0
- package/dist-client/regulation/regulation-fragments.d.ts +1 -0
- package/dist-client/regulation/regulation-fragments.js +37 -0
- package/dist-client/regulation/regulation-fragments.js.map +1 -0
- package/dist-client/regulation/regulation-guide.d.ts +19 -0
- package/dist-client/regulation/regulation-guide.js +48 -0
- package/dist-client/regulation/regulation-guide.js.map +1 -0
- package/dist-client/route.d.ts +1 -0
- package/dist-client/route.js +36 -0
- package/dist-client/route.js.map +1 -0
- package/dist-client/training-words.d.ts +11 -0
- package/dist-client/training-words.js +11 -0
- package/dist-client/training-words.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -0
- package/dist-client/words.d.ts +15 -0
- package/dist-client/words.js +20 -0
- package/dist-client/words.js.map +1 -0
- package/dist-server/activities/index.d.ts +6 -0
- package/dist-server/activities/index.js +35 -0
- package/dist-server/activities/index.js.map +1 -0
- package/dist-server/activities/legal-todo-activity-names.d.ts +1 -0
- package/dist-server/activities/legal-todo-activity-names.js +5 -0
- package/dist-server/activities/legal-todo-activity-names.js.map +1 -0
- package/dist-server/activities/legal-todo-activity.d.ts +37 -0
- package/dist-server/activities/legal-todo-activity.js +41 -0
- package/dist-server/activities/legal-todo-activity.js.map +1 -0
- package/dist-server/activities/regulation-activity-names.d.ts +1 -0
- package/dist-server/activities/regulation-activity-names.js +5 -0
- package/dist-server/activities/regulation-activity-names.js.map +1 -0
- package/dist-server/activities/regulation-activity.d.ts +48 -0
- package/dist-server/activities/regulation-activity.js +47 -0
- package/dist-server/activities/regulation-activity.js.map +1 -0
- package/dist-server/activities/seal-use-activity-names.d.ts +2 -0
- package/dist-server/activities/seal-use-activity-names.js +6 -0
- package/dist-server/activities/seal-use-activity-names.js.map +1 -0
- package/dist-server/activities/seal-use-activity.d.ts +48 -0
- package/dist-server/activities/seal-use-activity.js +47 -0
- package/dist-server/activities/seal-use-activity.js.map +1 -0
- package/dist-server/index.d.ts +2 -0
- package/dist-server/index.js +21 -0
- package/dist-server/index.js.map +1 -0
- package/dist-server/role-tasks.d.ts +2 -0
- package/dist-server/role-tasks.js +28 -0
- package/dist-server/role-tasks.js.map +1 -0
- package/dist-server/service/common/correction.d.ts +32 -0
- package/dist-server/service/common/correction.js +98 -0
- package/dist-server/service/common/correction.js.map +1 -0
- package/dist-server/service/common/employee-reader.d.ts +11 -0
- package/dist-server/service/common/employee-reader.js +46 -0
- package/dist-server/service/common/employee-reader.js.map +1 -0
- package/dist-server/service/common/legal-todo.d.ts +19 -0
- package/dist-server/service/common/legal-todo.js +37 -0
- package/dist-server/service/common/legal-todo.js.map +1 -0
- package/dist-server/service/compliance-case/compliance-case-mutation.d.ts +9 -0
- package/dist-server/service/compliance-case/compliance-case-mutation.js +73 -0
- package/dist-server/service/compliance-case/compliance-case-mutation.js.map +1 -0
- package/dist-server/service/compliance-case/compliance-case-query.d.ts +28 -0
- package/dist-server/service/compliance-case/compliance-case-query.js +212 -0
- package/dist-server/service/compliance-case/compliance-case-query.js.map +1 -0
- package/dist-server/service/compliance-case/compliance-case-rules.d.ts +71 -0
- package/dist-server/service/compliance-case/compliance-case-rules.js +111 -0
- package/dist-server/service/compliance-case/compliance-case-rules.js.map +1 -0
- package/dist-server/service/compliance-case/compliance-case-service.d.ts +76 -0
- package/dist-server/service/compliance-case/compliance-case-service.js +425 -0
- package/dist-server/service/compliance-case/compliance-case-service.js.map +1 -0
- package/dist-server/service/compliance-case/compliance-case-type.d.ts +56 -0
- package/dist-server/service/compliance-case/compliance-case-type.js +200 -0
- package/dist-server/service/compliance-case/compliance-case-type.js.map +1 -0
- package/dist-server/service/compliance-case/compliance-case.d.ts +76 -0
- package/dist-server/service/compliance-case/compliance-case.js +260 -0
- package/dist-server/service/compliance-case/compliance-case.js.map +1 -0
- package/dist-server/service/compliance-case/index.d.ts +7 -0
- package/dist-server/service/compliance-case/index.js +17 -0
- package/dist-server/service/compliance-case/index.js.map +1 -0
- package/dist-server/service/dispute/dispute-mutation.d.ts +9 -0
- package/dist-server/service/dispute/dispute-mutation.js +64 -0
- package/dist-server/service/dispute/dispute-mutation.js.map +1 -0
- package/dist-server/service/dispute/dispute-query.d.ts +16 -0
- package/dist-server/service/dispute/dispute-query.js +124 -0
- package/dist-server/service/dispute/dispute-query.js.map +1 -0
- package/dist-server/service/dispute/dispute-rules.d.ts +20 -0
- package/dist-server/service/dispute/dispute-rules.js +42 -0
- package/dist-server/service/dispute/dispute-rules.js.map +1 -0
- package/dist-server/service/dispute/dispute-service.d.ts +17 -0
- package/dist-server/service/dispute/dispute-service.js +96 -0
- package/dist-server/service/dispute/dispute-service.js.map +1 -0
- package/dist-server/service/dispute/dispute-type.d.ts +39 -0
- package/dist-server/service/dispute/dispute-type.js +149 -0
- package/dist-server/service/dispute/dispute-type.js.map +1 -0
- package/dist-server/service/dispute/dispute.d.ts +48 -0
- package/dist-server/service/dispute/dispute.js +198 -0
- package/dist-server/service/dispute/dispute.js.map +1 -0
- package/dist-server/service/dispute/index.d.ts +5 -0
- package/dist-server/service/dispute/index.js +9 -0
- package/dist-server/service/dispute/index.js.map +1 -0
- package/dist-server/service/index.d.ts +46 -0
- package/dist-server/service/index.js +112 -0
- package/dist-server/service/index.js.map +1 -0
- package/dist-server/service/invention/index.d.ts +5 -0
- package/dist-server/service/invention/index.js +9 -0
- package/dist-server/service/invention/index.js.map +1 -0
- package/dist-server/service/invention/invention-mutation.d.ts +10 -0
- package/dist-server/service/invention/invention-mutation.js +79 -0
- package/dist-server/service/invention/invention-mutation.js.map +1 -0
- package/dist-server/service/invention/invention-query.d.ts +18 -0
- package/dist-server/service/invention/invention-query.js +141 -0
- package/dist-server/service/invention/invention-query.js.map +1 -0
- package/dist-server/service/invention/invention-rules.d.ts +28 -0
- package/dist-server/service/invention/invention-rules.js +54 -0
- package/dist-server/service/invention/invention-rules.js.map +1 -0
- package/dist-server/service/invention/invention-service.d.ts +25 -0
- package/dist-server/service/invention/invention-service.js +176 -0
- package/dist-server/service/invention/invention-service.js.map +1 -0
- package/dist-server/service/invention/invention-type.d.ts +34 -0
- package/dist-server/service/invention/invention-type.js +129 -0
- package/dist-server/service/invention/invention-type.js.map +1 -0
- package/dist-server/service/invention/invention.d.ts +55 -0
- package/dist-server/service/invention/invention.js +214 -0
- package/dist-server/service/invention/invention.js.map +1 -0
- package/dist-server/service/legal-record/attachment-readers.d.ts +1 -0
- package/dist-server/service/legal-record/attachment-readers.js +27 -0
- package/dist-server/service/legal-record/attachment-readers.js.map +1 -0
- package/dist-server/service/legal-record/days.d.ts +7 -0
- package/dist-server/service/legal-record/days.js +26 -0
- package/dist-server/service/legal-record/days.js.map +1 -0
- package/dist-server/service/legal-record/legal-record-support.d.ts +24 -0
- package/dist-server/service/legal-record/legal-record-support.js +51 -0
- package/dist-server/service/legal-record/legal-record-support.js.map +1 -0
- package/dist-server/service/legal-registration/centre-change-subscriber.d.ts +9 -0
- package/dist-server/service/legal-registration/centre-change-subscriber.js +50 -0
- package/dist-server/service/legal-registration/centre-change-subscriber.js.map +1 -0
- package/dist-server/service/legal-registration/index.d.ts +7 -0
- package/dist-server/service/legal-registration/index.js +11 -0
- package/dist-server/service/legal-registration/index.js.map +1 -0
- package/dist-server/service/legal-registration/legal-registration-mutation.d.ts +10 -0
- package/dist-server/service/legal-registration/legal-registration-mutation.js +77 -0
- package/dist-server/service/legal-registration/legal-registration-mutation.js.map +1 -0
- package/dist-server/service/legal-registration/legal-registration-query.d.ts +26 -0
- package/dist-server/service/legal-registration/legal-registration-query.js +199 -0
- package/dist-server/service/legal-registration/legal-registration-query.js.map +1 -0
- package/dist-server/service/legal-registration/legal-registration-rules.d.ts +80 -0
- package/dist-server/service/legal-registration/legal-registration-rules.js +106 -0
- package/dist-server/service/legal-registration/legal-registration-rules.js.map +1 -0
- package/dist-server/service/legal-registration/legal-registration-service.d.ts +37 -0
- package/dist-server/service/legal-registration/legal-registration-service.js +248 -0
- package/dist-server/service/legal-registration/legal-registration-service.js.map +1 -0
- package/dist-server/service/legal-registration/legal-registration-type.d.ts +55 -0
- package/dist-server/service/legal-registration/legal-registration-type.js +207 -0
- package/dist-server/service/legal-registration/legal-registration-type.js.map +1 -0
- package/dist-server/service/legal-registration/legal-registration.d.ts +76 -0
- package/dist-server/service/legal-registration/legal-registration.js +311 -0
- package/dist-server/service/legal-registration/legal-registration.js.map +1 -0
- package/dist-server/service/privacy-record/index.d.ts +5 -0
- package/dist-server/service/privacy-record/index.js +9 -0
- package/dist-server/service/privacy-record/index.js.map +1 -0
- package/dist-server/service/privacy-record/privacy-record-mutation.d.ts +7 -0
- package/dist-server/service/privacy-record/privacy-record-mutation.js +56 -0
- package/dist-server/service/privacy-record/privacy-record-mutation.js.map +1 -0
- package/dist-server/service/privacy-record/privacy-record-query.d.ts +18 -0
- package/dist-server/service/privacy-record/privacy-record-query.js +131 -0
- package/dist-server/service/privacy-record/privacy-record-query.js.map +1 -0
- package/dist-server/service/privacy-record/privacy-record-rules.d.ts +52 -0
- package/dist-server/service/privacy-record/privacy-record-rules.js +91 -0
- package/dist-server/service/privacy-record/privacy-record-rules.js.map +1 -0
- package/dist-server/service/privacy-record/privacy-record-service.d.ts +33 -0
- package/dist-server/service/privacy-record/privacy-record-service.js +133 -0
- package/dist-server/service/privacy-record/privacy-record-service.js.map +1 -0
- package/dist-server/service/privacy-record/privacy-record-type.d.ts +40 -0
- package/dist-server/service/privacy-record/privacy-record-type.js +153 -0
- package/dist-server/service/privacy-record/privacy-record-type.js.map +1 -0
- package/dist-server/service/privacy-record/privacy-record.d.ts +69 -0
- package/dist-server/service/privacy-record/privacy-record.js +245 -0
- package/dist-server/service/privacy-record/privacy-record.js.map +1 -0
- package/dist-server/service/regulation/index.d.ts +5 -0
- package/dist-server/service/regulation/index.js +9 -0
- package/dist-server/service/regulation/index.js.map +1 -0
- package/dist-server/service/regulation/regulation-mutation.d.ts +15 -0
- package/dist-server/service/regulation/regulation-mutation.js +152 -0
- package/dist-server/service/regulation/regulation-mutation.js.map +1 -0
- package/dist-server/service/regulation/regulation-query.d.ts +10 -0
- package/dist-server/service/regulation/regulation-query.js +109 -0
- package/dist-server/service/regulation/regulation-query.js.map +1 -0
- package/dist-server/service/regulation/regulation-read.d.ts +21 -0
- package/dist-server/service/regulation/regulation-read.js +111 -0
- package/dist-server/service/regulation/regulation-read.js.map +1 -0
- package/dist-server/service/regulation/regulation-rules.d.ts +83 -0
- package/dist-server/service/regulation/regulation-rules.js +170 -0
- package/dist-server/service/regulation/regulation-rules.js.map +1 -0
- package/dist-server/service/regulation/regulation-service.d.ts +63 -0
- package/dist-server/service/regulation/regulation-service.js +365 -0
- package/dist-server/service/regulation/regulation-service.js.map +1 -0
- package/dist-server/service/regulation/regulation-type.d.ts +61 -0
- package/dist-server/service/regulation/regulation-type.js +226 -0
- package/dist-server/service/regulation/regulation-type.js.map +1 -0
- package/dist-server/service/regulation/regulation.d.ts +113 -0
- package/dist-server/service/regulation/regulation.js +382 -0
- package/dist-server/service/regulation/regulation.js.map +1 -0
- package/dist-server/service/seal-use/index.d.ts +5 -0
- package/dist-server/service/seal-use/index.js +9 -0
- package/dist-server/service/seal-use/index.js.map +1 -0
- package/dist-server/service/seal-use/seal-use-mutation.d.ts +8 -0
- package/dist-server/service/seal-use/seal-use-mutation.js +69 -0
- package/dist-server/service/seal-use/seal-use-mutation.js.map +1 -0
- package/dist-server/service/seal-use/seal-use-query.d.ts +14 -0
- package/dist-server/service/seal-use/seal-use-query.js +100 -0
- package/dist-server/service/seal-use/seal-use-query.js.map +1 -0
- package/dist-server/service/seal-use/seal-use-rules.d.ts +35 -0
- package/dist-server/service/seal-use/seal-use-rules.js +64 -0
- package/dist-server/service/seal-use/seal-use-rules.js.map +1 -0
- package/dist-server/service/seal-use/seal-use-service.d.ts +20 -0
- package/dist-server/service/seal-use/seal-use-service.js +168 -0
- package/dist-server/service/seal-use/seal-use-service.js.map +1 -0
- package/dist-server/service/seal-use/seal-use-type.d.ts +24 -0
- package/dist-server/service/seal-use/seal-use-type.js +93 -0
- package/dist-server/service/seal-use/seal-use-type.js.map +1 -0
- package/dist-server/service/seal-use/seal-use.d.ts +57 -0
- package/dist-server/service/seal-use/seal-use.js +181 -0
- package/dist-server/service/seal-use/seal-use.js.map +1 -0
- package/dist-server/service/training/index.d.ts +5 -0
- package/dist-server/service/training/index.js +9 -0
- package/dist-server/service/training/index.js.map +1 -0
- package/dist-server/service/training/training-checks.d.ts +20 -0
- package/dist-server/service/training/training-checks.js +56 -0
- package/dist-server/service/training/training-checks.js.map +1 -0
- package/dist-server/service/training/training-kinds.d.ts +24 -0
- package/dist-server/service/training/training-kinds.js +42 -0
- package/dist-server/service/training/training-kinds.js.map +1 -0
- package/dist-server/service/training/training-mutation.d.ts +14 -0
- package/dist-server/service/training/training-mutation.js +140 -0
- package/dist-server/service/training/training-mutation.js.map +1 -0
- package/dist-server/service/training/training-query.d.ts +21 -0
- package/dist-server/service/training/training-query.js +196 -0
- package/dist-server/service/training/training-query.js.map +1 -0
- package/dist-server/service/training/training-read.d.ts +5 -0
- package/dist-server/service/training/training-read.js +35 -0
- package/dist-server/service/training/training-read.js.map +1 -0
- package/dist-server/service/training/training-register.d.ts +1 -0
- package/dist-server/service/training/training-register.js +27 -0
- package/dist-server/service/training/training-register.js.map +1 -0
- package/dist-server/service/training/training-rules.d.ts +72 -0
- package/dist-server/service/training/training-rules.js +143 -0
- package/dist-server/service/training/training-rules.js.map +1 -0
- package/dist-server/service/training/training-service.d.ts +98 -0
- package/dist-server/service/training/training-service.js +455 -0
- package/dist-server/service/training/training-service.js.map +1 -0
- package/dist-server/service/training/training-type.d.ts +94 -0
- package/dist-server/service/training/training-type.js +352 -0
- package/dist-server/service/training/training-type.js.map +1 -0
- package/dist-server/service/training/training.d.ts +127 -0
- package/dist-server/service/training/training.js +448 -0
- package/dist-server/service/training/training.js.map +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -0
- package/package.json +61 -4
- package/things-factory.config.js +19 -0
- package/translations/en.json +610 -0
- package/translations/es.json +610 -0
- package/translations/ja.json +610 -0
- package/translations/ko.json +610 -0
- package/translations/ms.json +610 -0
- package/translations/zh.json +610 -0
- package/README.md +0 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"training-mutation.js","sourceRoot":"","sources":["../../../server/service/training/training-mutation.ts"],"names":[],"mappings":";;;;AACA,+FAA2D;AAC3D,+CAA0F;AAE1F,iDAAqD;AAErD,yCAAiF;AACjF,yDAU2B;AAC3B,mDAA8I;AAE9I,MAAM,QAAQ,GAAG,mFAAmF,CAAA;AAI7F,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAIrB,AAAN,KAAK,CAAC,oBAAoB,CAAiD,OAA+B,EAAS,OAAwB;QACzI,OAAO,MAAM,IAAA,uCAAoB,EAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IACrD,CAAC;IAKK,AAAN,KAAK,CAAC,mBAAmB,CACqB,OAA2B,EACX,MAAoB,EACzE,OAAwB;QAE/B,OAAO,MAAM,I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AC,QAAQ,CAAC;IACnB,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,6BAAkB,EAAE,EAAE,WAAW,EAAE,0CAA0C,EAAE,CAAC;IACrE,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,EAAC,QAAQ,CAAC,CAAA;IAAkB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;gEAE1F;AAKK;IAHL,IAAA,wBAAS,EAAC,QAAQ,CAAC;IACnB,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,kCAAkB,EAAE,EAAE,WAAW,EAAE,0HAA0H,EAAE,CAAC;IAC7J,mBAAA,IAAA,kBAAG,EAAC,MAAM,CAAC,CAAA;IAAgB,mBAAA,IAAA,kBAAG,EAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC,CAAA;IAAgB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;wDAE/F;AAIK;IAFL,IAAA,wBAAS,EAAC,QAAQ,CAAC;IACnB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,qGAAqG,EAAE,CAAC;IACxH,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;;;;6DAExD;2BA1EU,gBAAgB;IAF5B,IAAA,uBAAQ,EAAC,0BAAe,CAAC;IACzB,IAAA,4BAAa,EAAC,qBAAa,CAAC;GAChB,gBAAgB,CA2E5B","sourcesContent":["import type { FileUpload } from 'graphql-upload/GraphQLUpload.js'\nimport GraphQLUpload from 'graphql-upload/GraphQLUpload.js'\nimport { Arg, Ctx, Directive, Int, Mutation, Resolver, UseMiddleware } from 'type-graphql'\n\nimport { SpeakRefusals } from '@things-factory/shell'\n\nimport { TrainingCompletion, TrainingSession, TrainingSetting } from './training'\nimport {\n confirmTrainingCompletions,\n deleteTrainingRecords,\n openTrainingSession,\n openTrainingYear,\n recordTrainingAttendance,\n returnTrainingCompletion,\n saveTrainingSettings,\n submitTrainingCertificate,\n updateTrainingSessions\n} from './training-service'\nimport { NewTrainingSession, TrainingCertificateInput, TrainingSessionPatch, TrainingSettingPatch, TrainingYearOpened } from './training-type'\n\nconst MANAGING = '@privilege(category: \"training\", privilege: \"mutation\", domainOwnerGranted: true)'\n\n@Resolver(TrainingSession)\n@UseMiddleware(SpeakRefusals)\nexport class TrainingMutation {\n @Directive(MANAGING)\n @Directive('@transaction')\n @Mutation(returns => [TrainingSetting], { description: \"To set a kind of training on or off, its due day, audience and memo (ADR-0187 decision 15)\" })\n async saveTrainingSettings(@Arg('patches', type => [TrainingSettingPatch]) patches: TrainingSettingPatch[], @Ctx() context: ResolverContext): Promise<TrainingSetting[]> {\n return await saveTrainingSettings(patches, context)\n }\n\n @Directive(MANAGING)\n @Directive('@transaction')\n @Mutation(returns => TrainingSession, { description: 'To open a session with its material - its audience is told (ADR-0187 decision 16)' })\n async openTrainingSession(\n @Arg('session', type => NewTrainingSession) session: NewTrainingSession,\n @Arg('attach', type => [GraphQLUpload], { nullable: true }) attach: FileUpload[],\n @Ctx() context: ResolverContext\n ): Promise<TrainingSession> {\n return await openTrainingSession(session, attach, context)\n }\n\n @Directive(MANAGING)\n @Directive('@transaction')\n @Mutation(returns => [TrainingSession], { description: 'To correct what sessions say - their kind and year stay' })\n async updateMultipleTrainingSession(@Arg('patches', type => [TrainingSessionPatch]) patches: TrainingSessionPatch[], @Ctx() context: ResolverContext): Promise<TrainingSession[]> {\n return await updateTrainingSessions(patches, context)\n }\n\n @Directive(MANAGING)\n @Directive('@transaction')\n @Mutation(returns => [TrainingCompletion], { description: \"To record a session's attendance - confirmed at once, closing each one's to-do (ADR-0187 decision 17)\" })\n async recordTrainingAttendance(\n @Arg('sessionId') sessionId: string,\n @Arg('employeeIds', type => [String]) employeeIds: string[],\n @Arg('completedOn', { nullable: true, description: \"YYYY-MM-DD - the session's last day when empty\" }) completedOn: string,\n @Ctx() context: ResolverContext\n ): Promise<TrainingCompletion[]> {\n return await recordTrainingAttendance(sessionId, employeeIds, completedOn, context)\n }\n\n /* The person's own door - an employee of this domain, no task needed; the service refuses anyone else. */\n @Directive('@transaction')\n @Mutation(returns => TrainingCompletion, { description: 'To send the certificate of a training one took - it counts once the manager confirms it (ADR-0187 decision 17)' })\n async submitTrainingCertificate(\n @Arg('certificate', type => TrainingCertificateInput) certificate: TrainingCertificateInput,\n @Arg('attach', type => [GraphQLUpload], { nullable: true }) attach: FileUpload[],\n @Ctx() context: ResolverContext\n ): Promise<TrainingCompletion> {\n return await submitTrainingCertificate(certificate, attach, context)\n }\n\n @Directive(MANAGING)\n @Directive('@transaction')\n @Mutation(returns => [TrainingCompletion], { description: \"To confirm certificates sent - each closes the one's to-do\" })\n async confirmTrainingCompletions(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<TrainingCompletion[]> {\n return await confirmTrainingCompletions(ids, context)\n }\n\n @Directive(MANAGING)\n @Directive('@transaction')\n @Mutation(returns => TrainingCompletion, { description: 'To return a certificate sent, saying why' })\n async returnTrainingCompletion(@Arg('id') id: string, @Arg('reason') reason: string, @Ctx() context: ResolverContext): Promise<TrainingCompletion> {\n return await returnTrainingCompletion(id, reason, context)\n }\n\n @Directive(MANAGING)\n @Directive('@transaction')\n @Mutation(returns => TrainingYearOpened, { description: \"To open a kind's year - a to-do with its due day for everyone of its audience not done, once each (ADR-0187 decision 18)\" })\n async openTrainingYear(@Arg('kind') kind: string, @Arg('year', type => Int) year: number, @Ctx() context: ResolverContext): Promise<TrainingYearOpened> {\n return await openTrainingYear(kind, year, context)\n }\n\n @Directive(MANAGING)\n @Mutation(returns => Boolean, { description: 'Refused - training records are kept; a certificate is returned or a new completion recorded instead' })\n async deleteTrainingRecords(@Arg('ids', type => [String]) ids: string[]): Promise<boolean> {\n return await deleteTrainingRecords()\n }\n}\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Attachment } from '@things-factory/attachment-base';
|
|
2
|
+
import { User } from '@things-factory/auth-base';
|
|
3
|
+
import { Employee } from '@things-factory/organization';
|
|
4
|
+
import { ListParam } from '@things-factory/shell';
|
|
5
|
+
import { TrainingCompletion, TrainingSession } from './training';
|
|
6
|
+
import { MyTraining, TrainingCompletionList, TrainingKindInDomain, TrainingSessionList, TrainingStandingList } from './training-type';
|
|
7
|
+
export declare class TrainingQuery {
|
|
8
|
+
trainingKinds(context: ResolverContext): Promise<TrainingKindInDomain[]>;
|
|
9
|
+
trainingSessions(params: ListParam, context: ResolverContext): Promise<TrainingSessionList>;
|
|
10
|
+
trainingCompletions(params: ListParam, context: ResolverContext): Promise<TrainingCompletionList>;
|
|
11
|
+
trainingStandings(params: ListParam, context: ResolverContext): Promise<TrainingStandingList>;
|
|
12
|
+
myTrainings(year: number, context: ResolverContext): Promise<MyTraining[]>;
|
|
13
|
+
attachments(row: TrainingSession, context: ResolverContext): Promise<Attachment[]>;
|
|
14
|
+
creator(row: TrainingSession): Promise<User | null>;
|
|
15
|
+
}
|
|
16
|
+
export declare class TrainingCompletionQuery {
|
|
17
|
+
employee(row: TrainingCompletion): Promise<Employee | null>;
|
|
18
|
+
session(row: TrainingCompletion): Promise<TrainingSession | null>;
|
|
19
|
+
decidedBy(row: TrainingCompletion): Promise<User | null>;
|
|
20
|
+
attachments(row: TrainingCompletion, context: ResolverContext): Promise<Attachment[]>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TrainingCompletionQuery = exports.TrainingQuery = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const type_graphql_1 = require("type-graphql");
|
|
6
|
+
const attachment_base_1 = require("@things-factory/attachment-base");
|
|
7
|
+
const auth_base_1 = require("@things-factory/auth-base");
|
|
8
|
+
const organization_1 = require("@things-factory/organization");
|
|
9
|
+
const shell_1 = require("@things-factory/shell");
|
|
10
|
+
const employee_reader_1 = require("../common/employee-reader");
|
|
11
|
+
const training_1 = require("./training");
|
|
12
|
+
const training_service_1 = require("./training-service");
|
|
13
|
+
const training_type_1 = require("./training-type");
|
|
14
|
+
const thisYear = (context) => Number((0, employee_reader_1.todayIn)(context.state.domain).slice(0, 4));
|
|
15
|
+
/** A filter's values as a list - `eq` one, `in` many. */
|
|
16
|
+
const valuesOf = (params, name) => {
|
|
17
|
+
const filter = params.filters?.find(one => one.name === name);
|
|
18
|
+
if (!filter || filter.value === undefined || filter.value === null || filter.value === '')
|
|
19
|
+
return null;
|
|
20
|
+
return { values: [filter.value].flat().map(String), not: filter.operator === 'notin' || filter.operator === 'noteq' };
|
|
21
|
+
};
|
|
22
|
+
let TrainingQuery = class TrainingQuery {
|
|
23
|
+
async trainingKinds(context) {
|
|
24
|
+
return (await (0, training_service_1.trainingKindsOf)((0, training_service_1.trainingManagerOf)(context), context.state.domain));
|
|
25
|
+
}
|
|
26
|
+
async trainingSessions(params, context) {
|
|
27
|
+
const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
|
|
28
|
+
domain: context.state.domain,
|
|
29
|
+
params,
|
|
30
|
+
repository: (0, shell_1.getRepository)(training_1.TrainingSession),
|
|
31
|
+
searchables: ['name', 'instructor', 'organisation', 'notes'],
|
|
32
|
+
alias: 'session',
|
|
33
|
+
defaultSortings: [{ name: 'startsOn', desc: true }]
|
|
34
|
+
});
|
|
35
|
+
const [items, total] = await queryBuilder.getManyAndCount();
|
|
36
|
+
return { items, total };
|
|
37
|
+
}
|
|
38
|
+
async trainingCompletions(params, context) {
|
|
39
|
+
const reader = await (0, training_service_1.trainingReaderOf)(context);
|
|
40
|
+
if (!reader.all && !reader.employee)
|
|
41
|
+
throw new shell_1.Refusal('compliance-employees-only', {}, 'only an employee of this company can do this');
|
|
42
|
+
const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
|
|
43
|
+
domain: context.state.domain,
|
|
44
|
+
params,
|
|
45
|
+
repository: (0, shell_1.getRepository)(training_1.TrainingCompletion),
|
|
46
|
+
searchables: ['organisation', 'returnReason'],
|
|
47
|
+
alias: 'completion',
|
|
48
|
+
defaultSortings: [{ name: 'createdAt', desc: true }]
|
|
49
|
+
});
|
|
50
|
+
if (!reader.all)
|
|
51
|
+
queryBuilder.andWhere('completion.employee = :mine', { mine: reader.employee.id });
|
|
52
|
+
const [items, total] = await queryBuilder.getManyAndCount();
|
|
53
|
+
return { items, total };
|
|
54
|
+
}
|
|
55
|
+
async trainingStandings(params, context) {
|
|
56
|
+
const year = Number(valuesOf(params, 'year')?.values[0] ?? thisYear(context));
|
|
57
|
+
let rows = await (0, training_service_1.readableStandings)(year, context);
|
|
58
|
+
for (const name of ['kind', 'state']) {
|
|
59
|
+
const asked = valuesOf(params, name);
|
|
60
|
+
if (asked)
|
|
61
|
+
rows = rows.filter(row => asked.values.includes(row[name]) !== asked.not);
|
|
62
|
+
}
|
|
63
|
+
const search = params.search ?? params.filters?.find(one => one.operator === 'search')?.value;
|
|
64
|
+
if (search)
|
|
65
|
+
rows = rows.filter(row => `${row.employee.name ?? ''} ${row.departmentName ?? ''}`.includes(String(search).replace(/%/g, '').trim()));
|
|
66
|
+
const { page = 1, limit = 0 } = params.pagination ?? {};
|
|
67
|
+
return { items: (limit > 0 ? rows.slice((page - 1) * limit, page * limit) : rows), total: rows.length };
|
|
68
|
+
}
|
|
69
|
+
async myTrainings(year, context) {
|
|
70
|
+
return (await (0, training_service_1.myTrainings)(year ?? thisYear(context), context));
|
|
71
|
+
}
|
|
72
|
+
async attachments(row, context) {
|
|
73
|
+
return await filesOf(training_service_1.TRAINING_SESSION_REF_TYPE, row.id, context);
|
|
74
|
+
}
|
|
75
|
+
async creator(row) {
|
|
76
|
+
return row.creatorId ? await (0, shell_1.getRepository)(auth_base_1.User).findOne({ where: { id: row.creatorId } }) : null;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
exports.TrainingQuery = TrainingQuery;
|
|
80
|
+
tslib_1.__decorate([
|
|
81
|
+
(0, type_graphql_1.Directive)('@privilege(category: "training", privilege: "query", domainOwnerGranted: true)'),
|
|
82
|
+
(0, type_graphql_1.Query)(returns => [training_type_1.TrainingKindInDomain], { description: '법정 의무 교육 종류 - each kind as the domain has it: on or off, due day, audience (ADR-0187 decision 15)' }),
|
|
83
|
+
tslib_1.__param(0, (0, type_graphql_1.Ctx)()),
|
|
84
|
+
tslib_1.__metadata("design:type", Function),
|
|
85
|
+
tslib_1.__metadata("design:paramtypes", [Object]),
|
|
86
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
87
|
+
], TrainingQuery.prototype, "trainingKinds", null);
|
|
88
|
+
tslib_1.__decorate([
|
|
89
|
+
(0, type_graphql_1.Directive)('@privilege(category: "training", privilege: "query", domainOwnerGranted: true)'),
|
|
90
|
+
(0, type_graphql_1.Query)(returns => training_type_1.TrainingSessionList, { description: '교육 회차 - the trainings given, newest first (ADR-0187 decision 16)' }),
|
|
91
|
+
tslib_1.__param(0, (0, type_graphql_1.Args)(type => shell_1.ListParam)),
|
|
92
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
93
|
+
tslib_1.__metadata("design:type", Function),
|
|
94
|
+
tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
|
|
95
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
96
|
+
], TrainingQuery.prototype, "trainingSessions", null);
|
|
97
|
+
tslib_1.__decorate([
|
|
98
|
+
(0, type_graphql_1.Query)(returns => training_type_1.TrainingCompletionList, {
|
|
99
|
+
description: '이수 기록 - the completions with their certificates: every one to a holder of the trainings, their own to an employee (ADR-0187 decision 17)'
|
|
100
|
+
}),
|
|
101
|
+
tslib_1.__param(0, (0, type_graphql_1.Args)(type => shell_1.ListParam)),
|
|
102
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
103
|
+
tslib_1.__metadata("design:type", Function),
|
|
104
|
+
tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
|
|
105
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
106
|
+
], TrainingQuery.prototype, "trainingCompletions", null);
|
|
107
|
+
tslib_1.__decorate([
|
|
108
|
+
(0, type_graphql_1.Query)(returns => training_type_1.TrainingStandingList, {
|
|
109
|
+
description: '이수 현황 - where each person stands on each kind on in a year (DONE, WAITING, NOT_DONE): all to a holder, their own to an employee, whether done to a department head for their people (ADR-0187 decisions 17, 19)'
|
|
110
|
+
}),
|
|
111
|
+
tslib_1.__param(0, (0, type_graphql_1.Args)(type => shell_1.ListParam)),
|
|
112
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
113
|
+
tslib_1.__metadata("design:type", Function),
|
|
114
|
+
tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
|
|
115
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
116
|
+
], TrainingQuery.prototype, "trainingStandings", null);
|
|
117
|
+
tslib_1.__decorate([
|
|
118
|
+
(0, type_graphql_1.Query)(returns => [training_type_1.MyTraining], { description: "내 의무 교육 - the request's employee's trainings of a year, this year when none is given (ADR-0187 decision 10)" }),
|
|
119
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('year', type => type_graphql_1.Int, { nullable: true })),
|
|
120
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
121
|
+
tslib_1.__metadata("design:type", Function),
|
|
122
|
+
tslib_1.__metadata("design:paramtypes", [Number, Object]),
|
|
123
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
124
|
+
], TrainingQuery.prototype, "myTrainings", null);
|
|
125
|
+
tslib_1.__decorate([
|
|
126
|
+
(0, type_graphql_1.FieldResolver)(type => [attachment_base_1.Attachment], { description: 'Its material - to a holder of the trainings and to the people it is for' }),
|
|
127
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
128
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
129
|
+
tslib_1.__metadata("design:type", Function),
|
|
130
|
+
tslib_1.__metadata("design:paramtypes", [training_1.TrainingSession, Object]),
|
|
131
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
132
|
+
], TrainingQuery.prototype, "attachments", null);
|
|
133
|
+
tslib_1.__decorate([
|
|
134
|
+
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User, { nullable: true }),
|
|
135
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
136
|
+
tslib_1.__metadata("design:type", Function),
|
|
137
|
+
tslib_1.__metadata("design:paramtypes", [training_1.TrainingSession]),
|
|
138
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
139
|
+
], TrainingQuery.prototype, "creator", null);
|
|
140
|
+
exports.TrainingQuery = TrainingQuery = tslib_1.__decorate([
|
|
141
|
+
(0, type_graphql_1.Resolver)(training_1.TrainingSession),
|
|
142
|
+
(0, type_graphql_1.UseMiddleware)(shell_1.SpeakRefusals)
|
|
143
|
+
], TrainingQuery);
|
|
144
|
+
let TrainingCompletionQuery = class TrainingCompletionQuery {
|
|
145
|
+
async employee(row) {
|
|
146
|
+
return row.employeeId ? await (0, shell_1.getRepository)(organization_1.Employee).findOne({ where: { id: row.employeeId } }) : null;
|
|
147
|
+
}
|
|
148
|
+
async session(row) {
|
|
149
|
+
return row.sessionId ? await (0, shell_1.getRepository)(training_1.TrainingSession).findOne({ where: { id: row.sessionId } }) : null;
|
|
150
|
+
}
|
|
151
|
+
async decidedBy(row) {
|
|
152
|
+
return row.decidedById ? await (0, shell_1.getRepository)(auth_base_1.User).findOne({ where: { id: row.decidedById } }) : null;
|
|
153
|
+
}
|
|
154
|
+
async attachments(row, context) {
|
|
155
|
+
return await filesOf(training_service_1.TRAINING_COMPLETION_REF_TYPE, row.id, context);
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
exports.TrainingCompletionQuery = TrainingCompletionQuery;
|
|
159
|
+
tslib_1.__decorate([
|
|
160
|
+
(0, type_graphql_1.FieldResolver)(type => organization_1.Employee, { nullable: true }),
|
|
161
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
162
|
+
tslib_1.__metadata("design:type", Function),
|
|
163
|
+
tslib_1.__metadata("design:paramtypes", [training_1.TrainingCompletion]),
|
|
164
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
165
|
+
], TrainingCompletionQuery.prototype, "employee", null);
|
|
166
|
+
tslib_1.__decorate([
|
|
167
|
+
(0, type_graphql_1.FieldResolver)(type => training_1.TrainingSession, { nullable: true }),
|
|
168
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
169
|
+
tslib_1.__metadata("design:type", Function),
|
|
170
|
+
tslib_1.__metadata("design:paramtypes", [training_1.TrainingCompletion]),
|
|
171
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
172
|
+
], TrainingCompletionQuery.prototype, "session", null);
|
|
173
|
+
tslib_1.__decorate([
|
|
174
|
+
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User, { nullable: true }),
|
|
175
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
176
|
+
tslib_1.__metadata("design:type", Function),
|
|
177
|
+
tslib_1.__metadata("design:paramtypes", [training_1.TrainingCompletion]),
|
|
178
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
179
|
+
], TrainingCompletionQuery.prototype, "decidedBy", null);
|
|
180
|
+
tslib_1.__decorate([
|
|
181
|
+
(0, type_graphql_1.FieldResolver)(type => [attachment_base_1.Attachment], { description: 'Its certificates - to a holder of the trainings and to the one it is of' }),
|
|
182
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
183
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
184
|
+
tslib_1.__metadata("design:type", Function),
|
|
185
|
+
tslib_1.__metadata("design:paramtypes", [training_1.TrainingCompletion, Object]),
|
|
186
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
187
|
+
], TrainingCompletionQuery.prototype, "attachments", null);
|
|
188
|
+
exports.TrainingCompletionQuery = TrainingCompletionQuery = tslib_1.__decorate([
|
|
189
|
+
(0, type_graphql_1.Resolver)(training_1.TrainingCompletion)
|
|
190
|
+
], TrainingCompletionQuery);
|
|
191
|
+
/** A record's files the request may open - the module's attachment reader decides each. */
|
|
192
|
+
async function filesOf(refType, refBy, context) {
|
|
193
|
+
const rows = await (0, shell_1.getRepository)(attachment_base_1.Attachment).find({ where: { domain: { id: context.state.domain.id }, refType, refBy }, order: { createdAt: 'ASC' } });
|
|
194
|
+
return await (0, attachment_base_1.readableRows)(rows, context);
|
|
195
|
+
}
|
|
196
|
+
//# sourceMappingURL=training-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"training-query.js","sourceRoot":"","sources":["../../../server/service/training/training-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAkH;AAElH,qEAA0E;AAC1E,yDAAgD;AAChD,+DAAuD;AACvD,iDAAuH;AAEvH,+DAAmD;AACnD,yCAAgE;AAChE,yDAAkL;AAClL,mDAAqI;AAErI,MAAM,QAAQ,GAAG,CAAC,OAAwB,EAAE,EAAE,CAAC,MAAM,CAAC,IAAA,yBAAO,EAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AAEhG,yDAAyD;AACzD,MAAM,QAAQ,GAAG,CAAC,MAAiB,EAAE,IAAY,EAAE,EAAE;IACnD,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,IAAI,CAAC,CAAA;IAC7D,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,KAAK,KAAK,IAAI,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DAE9C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,4BAAU,CAAC,EAAE,EAAE,WAAW,EAAE,yEAAyE,EAAE,CAAC;IAC7G,mBAAA,IAAA,mBAAI,GAAE,CAAA;IAA2B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAA1B,6BAAkB;;0DAEhD;kCAnBU,uBAAuB;IADnC,IAAA,uBAAQ,EAAC,6BAAkB,CAAC;GAChB,uBAAuB,CAoBnC;AAED,2FAA2F;AAC3F,KAAK,UAAU,OAAO,CAAC,OAAe,EAAE,KAAa,EAAE,OAAwB;IAC7E,MAAM,IAAI,GAAG,MAAM,IAAA,qBAAa,EAAC,4BAAU,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAS,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,EAAS,EAAE,CAAC,CAAA;IACpK,OAAO,MAAM,IAAA,8BAAY,EAAC,IAAI,EAAE,OAAO,CAAC,CAAA;AAC1C,CAAC","sourcesContent":["import { Arg, Args, Ctx, Directive, FieldResolver, Int, Query, Resolver, Root, UseMiddleware } from 'type-graphql'\n\nimport { Attachment, readableRows } from '@things-factory/attachment-base'\nimport { User } from '@things-factory/auth-base'\nimport { Employee } from '@things-factory/organization'\nimport { getQueryBuilderFromListParams, getRepository, ListParam, Refusal, SpeakRefusals } from '@things-factory/shell'\n\nimport { todayIn } from '../common/employee-reader'\nimport { TrainingCompletion, TrainingSession } from './training'\nimport { trainingManagerOf, myTrainings, readableStandings, TRAINING_COMPLETION_REF_TYPE, TRAINING_SESSION_REF_TYPE, trainingKindsOf, trainingReaderOf } from './training-service'\nimport { MyTraining, TrainingCompletionList, TrainingKindInDomain, TrainingSessionList, TrainingStandingList } from './training-type'\n\nconst thisYear = (context: ResolverContext) => Number(todayIn(context.state.domain).slice(0, 4))\n\n/** A filter's values as a list - `eq` one, `in` many. */\nconst valuesOf = (params: ListParam, name: string) => {\n const filter = params.filters?.find(one => one.name === name)\n if (!filter || filter.value === undefined || filter.value === null || filter.value === '') return null\n return { values: [filter.value].flat().map(String), not: filter.operator === 'notin' || filter.operator === 'noteq' }\n}\n\n@Resolver(TrainingSession)\n@UseMiddleware(SpeakRefusals)\nexport class TrainingQuery {\n @Directive('@privilege(category: \"training\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => [TrainingKindInDomain], { description: '법정 의무 교육 종류 - each kind as the domain has it: on or off, due day, audience (ADR-0187 decision 15)' })\n async trainingKinds(@Ctx() context: ResolverContext): Promise<TrainingKindInDomain[]> {\n return (await trainingKindsOf(trainingManagerOf(context), context.state.domain)) as any\n }\n\n @Directive('@privilege(category: \"training\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => TrainingSessionList, { description: '교육 회차 - the trainings given, newest first (ADR-0187 decision 16)' })\n async trainingSessions(@Args(type => ListParam) params: ListParam, @Ctx() context: ResolverContext): Promise<TrainingSessionList> {\n const queryBuilder = getQueryBuilderFromListParams({\n domain: context.state.domain,\n params,\n repository: getRepository(TrainingSession),\n searchables: ['name', 'instructor', 'organisation', 'notes'],\n alias: 'session',\n defaultSortings: [{ name: 'startsOn', desc: true }]\n })\n const [items, total] = await queryBuilder.getManyAndCount()\n return { items, total }\n }\n\n @Query(returns => TrainingCompletionList, {\n description: '이수 기록 - the completions with their certificates: every one to a holder of the trainings, their own to an employee (ADR-0187 decision 17)'\n })\n async trainingCompletions(@Args(type => ListParam) params: ListParam, @Ctx() context: ResolverContext): Promise<TrainingCompletionList> {\n const reader = await trainingReaderOf(context)\n if (!reader.all && !reader.employee) throw new Refusal('compliance-employees-only', {}, 'only an employee of this company can do this')\n const queryBuilder = getQueryBuilderFromListParams({\n domain: context.state.domain,\n params,\n repository: getRepository(TrainingCompletion),\n searchables: ['organisation', 'returnReason'],\n alias: 'completion',\n defaultSortings: [{ name: 'createdAt', desc: true }]\n })\n if (!reader.all) queryBuilder.andWhere('completion.employee = :mine', { mine: reader.employee!.id })\n const [items, total] = await queryBuilder.getManyAndCount()\n return { items, total }\n }\n\n @Query(returns => TrainingStandingList, {\n description:\n '이수 현황 - where each person stands on each kind on in a year (DONE, WAITING, NOT_DONE): all to a holder, their own to an employee, whether done to a department head for their people (ADR-0187 decisions 17, 19)'\n })\n async trainingStandings(@Args(type => ListParam) params: ListParam, @Ctx() context: ResolverContext): Promise<TrainingStandingList> {\n const year = Number(valuesOf(params, 'year')?.values[0] ?? thisYear(context))\n let rows = await readableStandings(year, context)\n for (const name of ['kind', 'state']) {\n const asked = valuesOf(params, name)\n if (asked) rows = rows.filter(row => asked.values.includes((row as any)[name]) !== asked.not)\n }\n const search = params.search ?? params.filters?.find(one => one.operator === 'search')?.value\n if (search) rows = rows.filter(row => `${row.employee.name ?? ''} ${row.departmentName ?? ''}`.includes(String(search).replace(/%/g, '').trim()))\n const { page = 1, limit = 0 } = params.pagination ?? ({} as any)\n return { items: (limit > 0 ? rows.slice((page - 1) * limit, page * limit) : rows) as any, total: rows.length }\n }\n\n @Query(returns => [MyTraining], { description: \"내 의무 교육 - the request's employee's trainings of a year, this year when none is given (ADR-0187 decision 10)\" })\n async myTrainings(@Arg('year', type => Int, { nullable: true }) year: number, @Ctx() context: ResolverContext): Promise<MyTraining[]> {\n return (await myTrainings(year ?? thisYear(context), context)) as any\n }\n\n @FieldResolver(type => [Attachment], { description: 'Its material - to a holder of the trainings and to the people it is for' })\n async attachments(@Root() row: TrainingSession, @Ctx() context: ResolverContext): Promise<Attachment[]> {\n return await filesOf(TRAINING_SESSION_REF_TYPE, row.id, context)\n }\n\n @FieldResolver(type => User, { nullable: true })\n async creator(@Root() row: TrainingSession): Promise<User | null> {\n return row.creatorId ? await getRepository(User).findOne({ where: { id: row.creatorId } }) : null\n }\n}\n\n@Resolver(TrainingCompletion)\nexport class TrainingCompletionQuery {\n @FieldResolver(type => Employee, { nullable: true })\n async employee(@Root() row: TrainingCompletion): Promise<Employee | null> {\n return row.employeeId ? await getRepository(Employee).findOne({ where: { id: row.employeeId } }) : null\n }\n\n @FieldResolver(type => TrainingSession, { nullable: true })\n async session(@Root() row: TrainingCompletion): Promise<TrainingSession | null> {\n return row.sessionId ? await getRepository(TrainingSession).findOne({ where: { id: row.sessionId } }) : null\n }\n\n @FieldResolver(type => User, { nullable: true })\n async decidedBy(@Root() row: TrainingCompletion): Promise<User | null> {\n return row.decidedById ? await getRepository(User).findOne({ where: { id: row.decidedById } }) : null\n }\n\n @FieldResolver(type => [Attachment], { description: 'Its certificates - to a holder of the trainings and to the one it is of' })\n async attachments(@Root() row: TrainingCompletion, @Ctx() context: ResolverContext): Promise<Attachment[]> {\n return await filesOf(TRAINING_COMPLETION_REF_TYPE, row.id, context)\n }\n}\n\n/** A record's files the request may open - the module's attachment reader decides each. */\nasync function filesOf(refType: string, refBy: string, context: ResolverContext): Promise<Attachment[]> {\n const rows = await getRepository(Attachment).find({ where: { domain: { id: context.state.domain.id }, refType, refBy } as any, order: { createdAt: 'ASC' } as any })\n return await readableRows(rows, context)\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type ListRead } from '@things-factory/ai-assistant';
|
|
2
|
+
export declare const TRAINING_STANDINGS_READ: ListRead;
|
|
3
|
+
/** The keys an application's assistant mode names in its `readTargets` to read the trainings. */
|
|
4
|
+
export declare const TRAINING_READ_TARGETS: string[];
|
|
5
|
+
export declare function registerTrainingReads(): void;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TRAINING_READ_TARGETS = exports.TRAINING_STANDINGS_READ = void 0;
|
|
4
|
+
exports.registerTrainingReads = registerTrainingReads;
|
|
5
|
+
const ai_assistant_1 = require("@things-factory/ai-assistant");
|
|
6
|
+
/*
|
|
7
|
+
* 법정 의무 교육 as the assistant reads it (ADR-0187 decision 19) - the standings query, as the person: a holder of the
|
|
8
|
+
* trainings reads everyone (「올해 성희롱 예방교육 안 받은 사람」), an employee their own (「내가 받아야 할 교육」), a
|
|
9
|
+
* department head whether their people are done. Certificates and session material are never read.
|
|
10
|
+
*/
|
|
11
|
+
exports.TRAINING_STANDINGS_READ = {
|
|
12
|
+
key: 'compliance.trainings',
|
|
13
|
+
title: 'title.training-list',
|
|
14
|
+
name: 'Mandatory trainings (법정 의무 교육) - where each person stands on each kind the company has on in a year: DONE (confirmed), WAITING (a certificate waits for the manager), NOT_DONE, with the due day',
|
|
15
|
+
listQuery: 'trainingStandings',
|
|
16
|
+
selection: 'id kind year dueOn state completedOn departmentName employee { id name }',
|
|
17
|
+
columns: [
|
|
18
|
+
{ name: 'employee', path: 'employee.name', type: 'string', labelKey: 'field.training-employee' },
|
|
19
|
+
{ name: 'departmentName', type: 'string', labelKey: 'field.training-department' },
|
|
20
|
+
{ name: 'kind', type: 'string', labelKey: 'field.training-kind', words: 'text.training-kind.' },
|
|
21
|
+
{ name: 'year', type: 'number', labelKey: 'field.training-year' },
|
|
22
|
+
{ name: 'dueOn', type: 'date', labelKey: 'field.training-due-on' },
|
|
23
|
+
{ name: 'state', type: 'string', labelKey: 'field.training-state', words: 'text.training-state.' },
|
|
24
|
+
{ name: 'completedOn', type: 'date', labelKey: 'field.training-completed-on' }
|
|
25
|
+
],
|
|
26
|
+
narrowing: { year: 'year' },
|
|
27
|
+
status: { field: 'state', values: ['DONE', 'WAITING', 'NOT_DONE'] },
|
|
28
|
+
search: "person's name or department"
|
|
29
|
+
};
|
|
30
|
+
/** The keys an application's assistant mode names in its `readTargets` to read the trainings. */
|
|
31
|
+
exports.TRAINING_READ_TARGETS = [exports.TRAINING_STANDINGS_READ.key];
|
|
32
|
+
function registerTrainingReads() {
|
|
33
|
+
(0, ai_assistant_1.registerReadTarget)((0, ai_assistant_1.listReadTarget)(exports.TRAINING_STANDINGS_READ));
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=training-read.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"training-read.js","sourceRoot":"","sources":["../../../server/service/training/training-read.ts"],"names":[],"mappings":";;;AA8BA,sDAEC;AAhCD,+DAAgG;AAEhG;;;;GAIG;AACU,QAAA,uBAAuB,GAAa;IAC/C,GAAG,EAAE,sBAAsB;IAC3B,KAAK,EAAE,qBAAqB;IAC5B,IAAI,EAAE,kMAAkM;IACxM,SAAS,EAAE,mBAAmB;IAC9B,SAAS,EAAE,0EAA0E;IACrF,OAAO,EAAE;QACP,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,yBAAyB,EAAE;QAChG,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,2BAA2B,EAAE;QACjF,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,qBAAqB,EAAE,KAAK,EAAE,qBAAqB,EAAE;QAC/F,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,qBAAqB,EAAE;QACjE,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,uBAAuB,EAAE;QAClE,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,sBAAsB,EAAE,KAAK,EAAE,sBAAsB,EAAE;QAClG,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,6BAA6B,EAAE;KAC/E;IACD,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;IAC3B,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE;IACnE,MAAM,EAAE,6BAA6B;CACtC,CAAA;AAED,iGAAiG;AACpF,QAAA,qBAAqB,GAAG,CAAC,+BAAuB,CAAC,GAAG,CAAC,CAAA;AAElE,SAAgB,qBAAqB;IACnC,IAAA,iCAAkB,EAAC,IAAA,6BAAc,EAAC,+BAAuB,CAAC,CAAC,CAAA;AAC7D,CAAC","sourcesContent":["import { listReadTarget, registerReadTarget, type ListRead } from '@things-factory/ai-assistant'\n\n/*\n * 법정 의무 교육 as the assistant reads it (ADR-0187 decision 19) - the standings query, as the person: a holder of the\n * trainings reads everyone (「올해 성희롱 예방교육 안 받은 사람」), an employee their own (「내가 받아야 할 교육」), a\n * department head whether their people are done. Certificates and session material are never read.\n */\nexport const TRAINING_STANDINGS_READ: ListRead = {\n key: 'compliance.trainings',\n title: 'title.training-list',\n name: 'Mandatory trainings (법정 의무 교육) - where each person stands on each kind the company has on in a year: DONE (confirmed), WAITING (a certificate waits for the manager), NOT_DONE, with the due day',\n listQuery: 'trainingStandings',\n selection: 'id kind year dueOn state completedOn departmentName employee { id name }',\n columns: [\n { name: 'employee', path: 'employee.name', type: 'string', labelKey: 'field.training-employee' },\n { name: 'departmentName', type: 'string', labelKey: 'field.training-department' },\n { name: 'kind', type: 'string', labelKey: 'field.training-kind', words: 'text.training-kind.' },\n { name: 'year', type: 'number', labelKey: 'field.training-year' },\n { name: 'dueOn', type: 'date', labelKey: 'field.training-due-on' },\n { name: 'state', type: 'string', labelKey: 'field.training-state', words: 'text.training-state.' },\n { name: 'completedOn', type: 'date', labelKey: 'field.training-completed-on' }\n ],\n narrowing: { year: 'year' },\n status: { field: 'state', values: ['DONE', 'WAITING', 'NOT_DONE'] },\n search: \"person's name or department\"\n}\n\n/** The keys an application's assistant mode names in its `readTargets` to read the trainings. */\nexport const TRAINING_READ_TARGETS = [TRAINING_STANDINGS_READ.key]\n\nexport function registerTrainingReads(): void {\n registerReadTarget(listReadTarget(TRAINING_STANDINGS_READ))\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function registerTrainings(): void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerTrainings = registerTrainings;
|
|
4
|
+
const announcement_1 = require("@things-factory/announcement");
|
|
5
|
+
const attachment_base_1 = require("@things-factory/attachment-base");
|
|
6
|
+
const shell_1 = require("@things-factory/shell");
|
|
7
|
+
const training_1 = require("./training");
|
|
8
|
+
const training_read_1 = require("./training-read");
|
|
9
|
+
const training_service_1 = require("./training-service");
|
|
10
|
+
/*
|
|
11
|
+
* What the trainings declare at load (ADR-0187 decisions 16, 17, 19): the announcement trigger of a session opened, who
|
|
12
|
+
* opens their files - a certificate to a holder and the one it is of (a department head does not), a session's material
|
|
13
|
+
* to a holder and the people it is for - and the assistant's read.
|
|
14
|
+
*/
|
|
15
|
+
function registerTrainings() {
|
|
16
|
+
(0, announcement_1.registerAnnouncementTrigger)({ name: training_service_1.TRAINING_SCHEDULED_TRIGGER, description: 'A mandatory training session opened - tells the people it is for when, how and by whom (ADR-0187 decision 16)' });
|
|
17
|
+
(0, attachment_base_1.registerAttachmentReader)(training_service_1.TRAINING_COMPLETION_REF_TYPE, async (attachment, context) => {
|
|
18
|
+
const row = attachment.refBy ? await (0, shell_1.getRepository)(training_1.TrainingCompletion).findOne({ where: { id: attachment.refBy, domain: { id: context.state.domain.id } } }) : null;
|
|
19
|
+
return await (0, training_service_1.mayReadCompletion)(row, context);
|
|
20
|
+
});
|
|
21
|
+
(0, attachment_base_1.registerAttachmentReader)(training_service_1.TRAINING_SESSION_REF_TYPE, async (attachment, context) => {
|
|
22
|
+
const row = attachment.refBy ? await (0, shell_1.getRepository)(training_1.TrainingSession).findOne({ where: { id: attachment.refBy, domain: { id: context.state.domain.id } } }) : null;
|
|
23
|
+
return await (0, training_service_1.mayReadSession)(row, context);
|
|
24
|
+
});
|
|
25
|
+
(0, training_read_1.registerTrainingReads)();
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=training-register.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"training-register.js","sourceRoot":"","sources":["../../../server/service/training/training-register.ts"],"names":[],"mappings":";;AAaA,8CAWC;AAxBD,+DAA0E;AAC1E,qEAA0E;AAC1E,iDAAqD;AAErD,yCAAgE;AAChE,mDAAuD;AACvD,yDAA2J;AAE3J;;;;GAIG;AACH,SAAgB,iBAAiB;IAC/B,IAAA,0CAA2B,EAAC,EAAE,IAAI,EAAE,6CAA0B,EAAE,WAAW,EAAE,+GAA+G,EAAE,CAAC,CAAA;IAC/L,IAAA,0CAAwB,EAAC,+CAA4B,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE;QACnF,MAAM,GAAG,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,IAAA,qBAAa,EAAC,6BAAkB,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,EAAS,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;QAC1K,OAAO,MAAM,IAAA,oCAAiB,EAAC,GAAG,EAAE,OAAO,CAAC,CAAA;IAC9C,CAAC,CAAC,CAAA;IACF,IAAA,0CAAwB,EAAC,4CAAyB,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE;QAChF,MAAM,GAAG,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,IAAA,qBAAa,EAAC,0BAAe,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,EAAS,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;QACvK,OAAO,MAAM,IAAA,iCAAc,EAAC,GAAG,EAAE,OAAO,CAAC,CAAA;IAC3C,CAAC,CAAC,CAAA;IACF,IAAA,qCAAqB,GAAE,CAAA;AACzB,CAAC","sourcesContent":["import { registerAnnouncementTrigger } from '@things-factory/announcement'\nimport { registerAttachmentReader } from '@things-factory/attachment-base'\nimport { getRepository } from '@things-factory/shell'\n\nimport { TrainingCompletion, TrainingSession } from './training'\nimport { registerTrainingReads } from './training-read'\nimport { mayReadCompletion, mayReadSession, TRAINING_COMPLETION_REF_TYPE, TRAINING_SCHEDULED_TRIGGER, TRAINING_SESSION_REF_TYPE } from './training-service'\n\n/*\n * What the trainings declare at load (ADR-0187 decisions 16, 17, 19): the announcement trigger of a session opened, who\n * opens their files - a certificate to a holder and the one it is of (a department head does not), a session's material\n * to a holder and the people it is for - and the assistant's read.\n */\nexport function registerTrainings(): void {\n registerAnnouncementTrigger({ name: TRAINING_SCHEDULED_TRIGGER, description: 'A mandatory training session opened - tells the people it is for when, how and by whom (ADR-0187 decision 16)' })\n registerAttachmentReader(TRAINING_COMPLETION_REF_TYPE, async (attachment, context) => {\n const row = attachment.refBy ? await getRepository(TrainingCompletion).findOne({ where: { id: attachment.refBy, domain: { id: context.state.domain.id } } as any }) : null\n return await mayReadCompletion(row, context)\n })\n registerAttachmentReader(TRAINING_SESSION_REF_TYPE, async (attachment, context) => {\n const row = attachment.refBy ? await getRepository(TrainingSession).findOne({ where: { id: attachment.refBy, domain: { id: context.state.domain.id } } as any }) : null\n return await mayReadSession(row, context)\n })\n registerTrainingReads()\n}\n"]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Refusal } from '@things-factory/shell';
|
|
2
|
+
import { TrainingKind } from './training-kinds';
|
|
3
|
+
export interface TrainingTarget {
|
|
4
|
+
scope: string;
|
|
5
|
+
targetId: string;
|
|
6
|
+
targetName?: string | null;
|
|
7
|
+
}
|
|
8
|
+
export interface TrainingSettingRow {
|
|
9
|
+
kind: string;
|
|
10
|
+
enabled?: boolean | null;
|
|
11
|
+
dueDay?: string | null;
|
|
12
|
+
audiences?: TrainingTarget[] | null;
|
|
13
|
+
memo?: string | null;
|
|
14
|
+
}
|
|
15
|
+
/** A kind as a domain has it: the declaration with the domain's own word over it. */
|
|
16
|
+
export interface TrainingKindSet extends TrainingKind {
|
|
17
|
+
enabled: boolean;
|
|
18
|
+
dueDay: string;
|
|
19
|
+
audiences: TrainingTarget[];
|
|
20
|
+
memo?: string | null;
|
|
21
|
+
/** Whether the domain has said anything - a kind with no row reads as declared. */
|
|
22
|
+
set: boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare function trainingKindsInDomain(rows: readonly TrainingSettingRow[]): TrainingKindSet[];
|
|
25
|
+
/** The day a kind is due in a year - Feb 29 falls to Feb 28 in a year that has none. */
|
|
26
|
+
export declare function trainingDueOnOf(year: number, dueDay: string): string;
|
|
27
|
+
/** Days from `today` to `day`, both YYYY-MM-DD - negative when it is past. */
|
|
28
|
+
export declare function trainingDaysLeft(today: string, day: string): number;
|
|
29
|
+
/** The instant a calendar day ends in a time zone - a to-do due on a day is due until its last second there. */
|
|
30
|
+
export declare function trainingDueAt(day: string, timezone?: string | null): Date;
|
|
31
|
+
export interface TrainingSettingInput {
|
|
32
|
+
kind?: string | null;
|
|
33
|
+
enabled?: boolean | null;
|
|
34
|
+
dueDay?: string | null;
|
|
35
|
+
audiences?: TrainingTarget[] | null;
|
|
36
|
+
}
|
|
37
|
+
/** What a kind's setting asks for before it is written, or nothing. */
|
|
38
|
+
export declare function trainingSettingRefusal(input: TrainingSettingInput): Refusal | null;
|
|
39
|
+
export interface TrainingSessionFields {
|
|
40
|
+
kind?: string | null;
|
|
41
|
+
year?: number | null;
|
|
42
|
+
name?: string | null;
|
|
43
|
+
method?: string | null;
|
|
44
|
+
startsOn?: string | null;
|
|
45
|
+
endsOn?: string | null;
|
|
46
|
+
}
|
|
47
|
+
/** What a session asks for before it is opened, or nothing - the kind must be on in the domain. */
|
|
48
|
+
export declare function trainingSessionRefusal(input: TrainingSessionFields, kind: TrainingKindSet | undefined): Refusal | null;
|
|
49
|
+
export interface TrainingCertificateFields {
|
|
50
|
+
kind?: string | null;
|
|
51
|
+
year?: number | null;
|
|
52
|
+
completedOn?: string | null;
|
|
53
|
+
method?: string | null;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* What a certificate a person sends asks for, or nothing: a kind on in the domain, the day completed within the year it
|
|
57
|
+
* counts for and not after today, a file, and no completion of it already done or waiting.
|
|
58
|
+
*/
|
|
59
|
+
export declare function trainingCertificateRefusal(input: TrainingCertificateFields, kind: TrainingKindSet | undefined, today: string, files: number, mine: readonly {
|
|
60
|
+
status: string;
|
|
61
|
+
}[]): Refusal | null;
|
|
62
|
+
/** Only a certificate sent and not decided is confirmed or returned. */
|
|
63
|
+
export declare function trainingDecisionRefusal(status: string, decision: 'CONFIRMED' | 'RETURNED', reason?: string | null): Refusal | null;
|
|
64
|
+
/** Completions, sessions and their files are kept (decision 17) - the refusal says what to do instead. */
|
|
65
|
+
export declare function trainingDeletionRefusal(): Refusal;
|
|
66
|
+
/** Where a person stands on a kind in a year. Only a confirmed completion is done; a certificate sent waits. */
|
|
67
|
+
export type TrainingState = 'DONE' | 'WAITING' | 'NOT_DONE';
|
|
68
|
+
export declare function trainingStateOf(completions: readonly {
|
|
69
|
+
status: string;
|
|
70
|
+
}[]): TrainingState;
|
|
71
|
+
/** The share of the people who are done, 0-1; null when nobody must take it. */
|
|
72
|
+
export declare function trainingCompletionRate(states: readonly TrainingState[]): number | null;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.trainingKindsInDomain = trainingKindsInDomain;
|
|
4
|
+
exports.trainingDueOnOf = trainingDueOnOf;
|
|
5
|
+
exports.trainingDaysLeft = trainingDaysLeft;
|
|
6
|
+
exports.trainingDueAt = trainingDueAt;
|
|
7
|
+
exports.trainingSettingRefusal = trainingSettingRefusal;
|
|
8
|
+
exports.trainingSessionRefusal = trainingSessionRefusal;
|
|
9
|
+
exports.trainingCertificateRefusal = trainingCertificateRefusal;
|
|
10
|
+
exports.trainingDecisionRefusal = trainingDecisionRefusal;
|
|
11
|
+
exports.trainingDeletionRefusal = trainingDeletionRefusal;
|
|
12
|
+
exports.trainingStateOf = trainingStateOf;
|
|
13
|
+
exports.trainingCompletionRate = trainingCompletionRate;
|
|
14
|
+
const shell_1 = require("@things-factory/shell");
|
|
15
|
+
const training_kinds_1 = require("./training-kinds");
|
|
16
|
+
/*
|
|
17
|
+
* What the mandatory trainings hold to (ADR-0187 decisions 15-19). Pure - the service reads the rows and the people,
|
|
18
|
+
* these say yes or no, and work out where each person stands.
|
|
19
|
+
*/
|
|
20
|
+
const DAY = /^\d{4}-\d{2}-\d{2}$/;
|
|
21
|
+
const DUE_DAY = /^(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;
|
|
22
|
+
const METHODS = ['COLLECTIVE', 'ONLINE', 'OUTSOURCED', 'POSTED'];
|
|
23
|
+
const SCOPES = ['DOMAIN', 'DEPARTMENT', 'ROLE', 'USER'];
|
|
24
|
+
function trainingKindsInDomain(rows) {
|
|
25
|
+
return (0, training_kinds_1.trainingKinds)().map(kind => {
|
|
26
|
+
const row = rows.find(one => one.kind === kind.code);
|
|
27
|
+
return {
|
|
28
|
+
...kind,
|
|
29
|
+
enabled: row ? !!row.enabled : kind.defaultOn,
|
|
30
|
+
dueDay: row?.dueDay || training_kinds_1.DEFAULT_DUE_DAY,
|
|
31
|
+
audiences: row?.audiences ?? [],
|
|
32
|
+
memo: row?.memo ?? null,
|
|
33
|
+
set: !!row
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/** The day a kind is due in a year - Feb 29 falls to Feb 28 in a year that has none. */
|
|
38
|
+
function trainingDueOnOf(year, dueDay) {
|
|
39
|
+
const [month, day] = (dueDay || training_kinds_1.DEFAULT_DUE_DAY).split('-').map(Number);
|
|
40
|
+
const last = new Date(Date.UTC(year, month, 0)).getUTCDate();
|
|
41
|
+
return `${year}-${String(month).padStart(2, '0')}-${String(Math.min(day, last)).padStart(2, '0')}`;
|
|
42
|
+
}
|
|
43
|
+
/** Days from `today` to `day`, both YYYY-MM-DD - negative when it is past. */
|
|
44
|
+
function trainingDaysLeft(today, day) {
|
|
45
|
+
return Math.round((Date.parse(`${day}T00:00:00Z`) - Date.parse(`${today}T00:00:00Z`)) / 86400000);
|
|
46
|
+
}
|
|
47
|
+
/** The instant a calendar day ends in a time zone - a to-do due on a day is due until its last second there. */
|
|
48
|
+
function trainingDueAt(day, timezone) {
|
|
49
|
+
const utc = Date.parse(`${day}T23:59:59Z`);
|
|
50
|
+
if (!timezone)
|
|
51
|
+
return new Date(utc);
|
|
52
|
+
try {
|
|
53
|
+
const parts = Object.fromEntries(new Intl.DateTimeFormat('en-US', { timeZone: timezone, hourCycle: 'h23', year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', second: '2-digit' })
|
|
54
|
+
.formatToParts(new Date(utc))
|
|
55
|
+
.map(part => [part.type, part.value]));
|
|
56
|
+
const shown = Date.parse(`${parts.year}-${parts.month}-${parts.day}T${parts.hour}:${parts.minute}:${parts.second}Z`);
|
|
57
|
+
return new Date(utc - (shown - utc));
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return new Date(utc);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/** What a kind's setting asks for before it is written, or nothing. */
|
|
64
|
+
function trainingSettingRefusal(input) {
|
|
65
|
+
if (!(0, training_kinds_1.trainingKindOf)(input.kind))
|
|
66
|
+
return new shell_1.Refusal('training-kind-unknown', { kind: input.kind ?? '' }, `there is no kind of training '${input.kind ?? ''}'`);
|
|
67
|
+
if (input.dueDay && !DUE_DAY.test(input.dueDay))
|
|
68
|
+
return new shell_1.Refusal('training-due-day-invalid', {}, 'give the due day of the year as MM-DD, 12-31');
|
|
69
|
+
if ((input.audiences ?? []).some(one => !SCOPES.includes(one?.scope) || !one.targetId))
|
|
70
|
+
return new shell_1.Refusal('training-audience-invalid', {}, 'a target is the domain, a department, a role or a person');
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
/** What a session asks for before it is opened, or nothing - the kind must be on in the domain. */
|
|
74
|
+
function trainingSessionRefusal(input, kind) {
|
|
75
|
+
if (!kind)
|
|
76
|
+
return new shell_1.Refusal('training-kind-unknown', { kind: input.kind ?? '' }, `there is no kind of training '${input.kind ?? ''}'`);
|
|
77
|
+
if (!kind.enabled)
|
|
78
|
+
return new shell_1.Refusal('training-kind-off', { kind: kind.code }, `the training ${kind.code} is off in this domain - turn it on first`);
|
|
79
|
+
if (!Number.isInteger(input.year) || input.year < 2000 || input.year > 2999)
|
|
80
|
+
return new shell_1.Refusal('training-year-invalid', {}, 'give the year it counts for, 2000-2999');
|
|
81
|
+
if (!input.name?.trim())
|
|
82
|
+
return new shell_1.Refusal('training-session-name-required', {}, 'give the session a name');
|
|
83
|
+
if (!METHODS.includes(input.method ?? ''))
|
|
84
|
+
return new shell_1.Refusal('training-method-required', {}, 'pick how it is given');
|
|
85
|
+
if (!input.startsOn || !DAY.test(input.startsOn))
|
|
86
|
+
return new shell_1.Refusal('training-starts-on-required', {}, 'give the day it is given, YYYY-MM-DD');
|
|
87
|
+
if (input.endsOn && (!DAY.test(input.endsOn) || input.endsOn < input.startsOn))
|
|
88
|
+
return new shell_1.Refusal('training-ends-before-start', {}, 'the last day is on or after the first, YYYY-MM-DD');
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* What a certificate a person sends asks for, or nothing: a kind on in the domain, the day completed within the year it
|
|
93
|
+
* counts for and not after today, a file, and no completion of it already done or waiting.
|
|
94
|
+
*/
|
|
95
|
+
function trainingCertificateRefusal(input, kind, today, files, mine) {
|
|
96
|
+
if (!kind)
|
|
97
|
+
return new shell_1.Refusal('training-kind-unknown', { kind: input.kind ?? '' }, `there is no kind of training '${input.kind ?? ''}'`);
|
|
98
|
+
if (!kind.enabled)
|
|
99
|
+
return new shell_1.Refusal('training-kind-off', { kind: kind.code }, `the training ${kind.code} is off in this domain`);
|
|
100
|
+
if (!Number.isInteger(input.year))
|
|
101
|
+
return new shell_1.Refusal('training-year-invalid', {}, 'give the year it counts for, 2000-2999');
|
|
102
|
+
if (!input.completedOn || !DAY.test(input.completedOn))
|
|
103
|
+
return new shell_1.Refusal('training-completed-on-required', {}, 'give the day it was completed, YYYY-MM-DD');
|
|
104
|
+
if (input.completedOn > today)
|
|
105
|
+
return new shell_1.Refusal('training-completed-on-future', { today }, `the day completed is on or before today, ${today}`);
|
|
106
|
+
if (Number(input.completedOn.slice(0, 4)) !== input.year)
|
|
107
|
+
return new shell_1.Refusal('training-completed-outside-year', { year: input.year }, `the day completed falls in ${input.year}, the year it counts for`);
|
|
108
|
+
if (!METHODS.includes(input.method ?? ''))
|
|
109
|
+
return new shell_1.Refusal('training-method-required', {}, 'pick how it is given');
|
|
110
|
+
if (files < 1)
|
|
111
|
+
return new shell_1.Refusal('training-certificate-required', {}, 'attach the certificate, one file at least');
|
|
112
|
+
if (mine.some(one => one.status === 'CONFIRMED'))
|
|
113
|
+
return new shell_1.Refusal('training-already-done', {}, 'this training is completed for the year already');
|
|
114
|
+
if (mine.some(one => one.status === 'SUBMITTED'))
|
|
115
|
+
return new shell_1.Refusal('training-already-submitted', {}, 'a certificate of it is waiting for the manager already');
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
/** Only a certificate sent and not decided is confirmed or returned. */
|
|
119
|
+
function trainingDecisionRefusal(status, decision, reason) {
|
|
120
|
+
if (status !== 'SUBMITTED')
|
|
121
|
+
return new shell_1.Refusal('training-not-submitted', {}, 'only a certificate waiting for the manager is confirmed or returned');
|
|
122
|
+
if (decision === 'RETURNED' && !reason?.trim())
|
|
123
|
+
return new shell_1.Refusal('training-return-reason-required', {}, 'say why it is returned');
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
/** Completions, sessions and their files are kept (decision 17) - the refusal says what to do instead. */
|
|
127
|
+
function trainingDeletionRefusal() {
|
|
128
|
+
return new shell_1.Refusal('training-record-kept', {}, 'training records are kept - return a certificate, or record a new completion, to correct one');
|
|
129
|
+
}
|
|
130
|
+
function trainingStateOf(completions) {
|
|
131
|
+
if (completions.some(one => one.status === 'CONFIRMED'))
|
|
132
|
+
return 'DONE';
|
|
133
|
+
if (completions.some(one => one.status === 'SUBMITTED'))
|
|
134
|
+
return 'WAITING';
|
|
135
|
+
return 'NOT_DONE';
|
|
136
|
+
}
|
|
137
|
+
/** The share of the people who are done, 0-1; null when nobody must take it. */
|
|
138
|
+
function trainingCompletionRate(states) {
|
|
139
|
+
if (!states.length)
|
|
140
|
+
return null;
|
|
141
|
+
return states.filter(one => one === 'DONE').length / states.length;
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=training-rules.js.map
|