@things-factory/kpi 9.0.31 → 9.0.33
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/README.md +1 -2
- package/client/charts/kpi-boxplot-chart.ts +182 -42
- package/client/charts/kpi-radar-chart.ts +9 -9
- package/client/pages/kpi/kpi-list-page.ts +196 -32
- package/client/pages/kpi/kpi-overview.ts +9 -11
- package/client/pages/kpi/kpi-tree-page.ts +409 -0
- package/client/pages/kpi/kpi-view.ts +187 -0
- package/client/pages/kpi-dashboard/cards/kpi-level1-card.ts +1 -1
- package/client/pages/kpi-dashboard/cards/kpi-level2-comparison.ts +1 -1
- package/client/pages/kpi-dashboard/cards/kpi-level3-comparison.ts +1 -1
- package/client/pages/kpi-dashboard/components/kpi-left-panel.ts +198 -160
- package/client/pages/kpi-dashboard/components/kpi-map-panel.ts +133 -0
- package/client/pages/kpi-dashboard/components/kpi-region-popup.ts +3 -2
- package/client/pages/kpi-dashboard/kpi-dashboard-map.ts +291 -48
- package/client/pages/kpi-dashboard/kpi-dashboard.ts +28 -30
- package/client/pages/kpi-history/kpi-history-list-page.ts +11 -11
- package/client/pages/kpi-metric/kpi-metric-list-page.ts +10 -2
- package/client/pages/kpi-metric-value/kpi-metric-value-editor-page.ts +7 -7
- package/client/pages/kpi-metric-value/kpi-metric-value-importer.ts +2 -2
- package/client/pages/kpi-metric-value/kpi-metric-value-list-page.ts +16 -8
- package/client/pages/kpi-metric-value/kpi-metric-value-manual-entry-form.ts +5 -5
- package/client/pages/kpi-statistic/kpi-statistic-editor-page.ts +1 -2
- package/client/pages/kpi-statistic/kpi-statistic-list-page.ts +10 -2
- package/client/pages/kpi-value/kpi-value-editor-page.ts +11 -7
- package/client/pages/kpi-value/kpi-value-list-page.ts +31 -7
- package/client/route.ts +2 -9
- package/design-entities.md +8 -12
- package/dist-client/charts/kpi-boxplot-chart.d.ts +2 -0
- package/dist-client/charts/kpi-boxplot-chart.js +168 -42
- package/dist-client/charts/kpi-boxplot-chart.js.map +1 -1
- package/dist-client/charts/kpi-radar-chart.js +9 -9
- package/dist-client/charts/kpi-radar-chart.js.map +1 -1
- package/dist-client/pages/kpi/kpi-list-page.d.ts +19 -3
- package/dist-client/pages/kpi/kpi-list-page.js +188 -32
- package/dist-client/pages/kpi/kpi-list-page.js.map +1 -1
- package/dist-client/pages/kpi/kpi-overview.js +9 -11
- package/dist-client/pages/kpi/kpi-overview.js.map +1 -1
- package/dist-client/pages/kpi/kpi-tree-page.d.ts +59 -0
- package/dist-client/pages/kpi/kpi-tree-page.js +403 -0
- package/dist-client/pages/kpi/kpi-tree-page.js.map +1 -0
- package/dist-client/pages/kpi/kpi-view.d.ts +12 -0
- package/dist-client/pages/kpi/kpi-view.js +191 -0
- package/dist-client/pages/kpi/kpi-view.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/cards/kpi-level1-card.js +1 -1
- package/dist-client/pages/kpi-dashboard/cards/kpi-level1-card.js.map +1 -1
- package/dist-client/pages/kpi-dashboard/cards/kpi-level2-comparison.js +1 -1
- package/dist-client/pages/kpi-dashboard/cards/kpi-level2-comparison.js.map +1 -1
- package/dist-client/pages/kpi-dashboard/cards/kpi-level3-comparison.js +1 -1
- package/dist-client/pages/kpi-dashboard/cards/kpi-level3-comparison.js.map +1 -1
- package/dist-client/pages/kpi-dashboard/components/kpi-left-panel.d.ts +3 -1
- package/dist-client/pages/kpi-dashboard/components/kpi-left-panel.js +197 -161
- package/dist-client/pages/kpi-dashboard/components/kpi-left-panel.js.map +1 -1
- package/dist-client/pages/kpi-dashboard/components/kpi-map-panel.d.ts +5 -0
- package/dist-client/pages/kpi-dashboard/components/kpi-map-panel.js +146 -0
- package/dist-client/pages/kpi-dashboard/components/kpi-map-panel.js.map +1 -1
- package/dist-client/pages/kpi-dashboard/components/kpi-region-popup.js +3 -2
- package/dist-client/pages/kpi-dashboard/components/kpi-region-popup.js.map +1 -1
- package/dist-client/pages/kpi-dashboard/kpi-dashboard-map.d.ts +3 -1
- package/dist-client/pages/kpi-dashboard/kpi-dashboard-map.js +268 -46
- package/dist-client/pages/kpi-dashboard/kpi-dashboard-map.js.map +1 -1
- package/dist-client/pages/kpi-dashboard/kpi-dashboard.js +28 -30
- package/dist-client/pages/kpi-dashboard/kpi-dashboard.js.map +1 -1
- package/dist-client/pages/kpi-history/kpi-history-list-page.d.ts +6 -1
- package/dist-client/pages/kpi-history/kpi-history-list-page.js +11 -11
- package/dist-client/pages/kpi-history/kpi-history-list-page.js.map +1 -1
- package/dist-client/pages/kpi-metric/kpi-metric-list-page.d.ts +5 -0
- package/dist-client/pages/kpi-metric/kpi-metric-list-page.js +10 -2
- package/dist-client/pages/kpi-metric/kpi-metric-list-page.js.map +1 -1
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-editor-page.d.ts +1 -1
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-editor-page.js +8 -8
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-editor-page.js.map +1 -1
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-importer.js +2 -2
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-importer.js.map +1 -1
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-list-page.d.ts +5 -0
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-list-page.js +16 -8
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-list-page.js.map +1 -1
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-form.d.ts +1 -1
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-form.js +6 -6
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-form.js.map +1 -1
- package/dist-client/pages/kpi-statistic/kpi-statistic-editor-page.js +1 -2
- package/dist-client/pages/kpi-statistic/kpi-statistic-editor-page.js.map +1 -1
- package/dist-client/pages/kpi-statistic/kpi-statistic-list-page.d.ts +5 -0
- package/dist-client/pages/kpi-statistic/kpi-statistic-list-page.js +10 -2
- package/dist-client/pages/kpi-statistic/kpi-statistic-list-page.js.map +1 -1
- package/dist-client/pages/kpi-value/kpi-value-editor-page.d.ts +2 -1
- package/dist-client/pages/kpi-value/kpi-value-editor-page.js +16 -8
- package/dist-client/pages/kpi-value/kpi-value-editor-page.js.map +1 -1
- package/dist-client/pages/kpi-value/kpi-value-list-page.d.ts +5 -0
- package/dist-client/pages/kpi-value/kpi-value-list-page.js +31 -7
- package/dist-client/pages/kpi-value/kpi-value-list-page.js.map +1 -1
- package/dist-client/route.d.ts +1 -1
- package/dist-client/route.js +2 -8
- package/dist-client/route.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/controllers/kpi-metric-value-provider.d.ts +1 -1
- package/dist-server/controllers/kpi-metric-value-provider.js +4 -4
- package/dist-server/controllers/kpi-metric-value-provider.js.map +1 -1
- package/dist-server/controllers/kpi-value-provider.d.ts +1 -1
- package/dist-server/controllers/kpi-value-provider.js +3 -3
- package/dist-server/controllers/kpi-value-provider.js.map +1 -1
- package/dist-server/migrations/1752190849680-seed-kpi-metrics.d.ts +6 -0
- package/dist-server/migrations/1752190849680-seed-kpi-metrics.js +101 -0
- package/dist-server/migrations/1752190849680-seed-kpi-metrics.js.map +1 -0
- package/dist-server/migrations/1752190849681-seed-kpi.d.ts +5 -0
- package/dist-server/migrations/1752190849681-seed-kpi.js +315 -0
- package/dist-server/migrations/1752190849681-seed-kpi.js.map +1 -0
- package/dist-server/migrations/1752192090123-add-grades-to-kpi.d.ts +7 -0
- package/dist-server/migrations/1752192090123-add-grades-to-kpi.js +51 -0
- package/dist-server/migrations/1752192090123-add-grades-to-kpi.js.map +1 -0
- package/dist-server/migrations/1752192090124-add-kpi-statistics.d.ts +5 -0
- package/dist-server/migrations/1752192090124-add-kpi-statistics.js +710 -0
- package/dist-server/migrations/1752192090124-add-kpi-statistics.js.map +1 -0
- package/dist-server/migrations/1752192090128-seed-kpi-org-scope.d.ts +6 -0
- package/dist-server/migrations/1752192090128-seed-kpi-org-scope.js +111 -0
- package/dist-server/migrations/1752192090128-seed-kpi-org-scope.js.map +1 -0
- package/dist-server/migrations/1752192090129-seed-kpi-values.d.ts +6 -0
- package/dist-server/migrations/1752192090129-seed-kpi-values.js +187 -0
- package/dist-server/migrations/1752192090129-seed-kpi-values.js.map +1 -0
- package/dist-server/migrations/grade-data/x11-performance-table.json +962 -0
- package/dist-server/migrations/grade-data/x12-performance-table.json +611 -0
- package/dist-server/migrations/grade-data/x14-performance-table.json +42 -0
- package/dist-server/migrations/grade-data/x21-performance-table.json +889 -0
- package/dist-server/migrations/grade-data/x22-performance-table.json +1064 -0
- package/dist-server/migrations/grade-data/x23-performance-table.json +42 -0
- package/dist-server/migrations/grade-data/x31-performance-table.json +644 -0
- package/dist-server/migrations/grade-data/x32-performance-table.json +993 -0
- package/dist-server/migrations/grade-data/x33-performance-table.json +195 -0
- package/dist-server/migrations/grade-data/x34-performance-table.json +12 -0
- package/dist-server/migrations/grade-data/x35-performance-table.json +42 -0
- package/dist-server/migrations/grade-data/x41-performance-table.json +825 -0
- package/dist-server/migrations/grade-data/x42-performance-table.json +786 -0
- package/dist-server/migrations/grade-data/x43-performance-table.json +12 -0
- package/dist-server/migrations/grade-data/x44-performance-table.json +42 -0
- package/dist-server/migrations/grade-data/x51-performance-table.json +924 -0
- package/dist-server/migrations/grade-data/x52-performance-table.json +42 -0
- package/dist-server/migrations/grade-data/x61-performance-table.json +261 -0
- package/dist-server/migrations/grade-data/x62-performance-table.json +42 -0
- package/dist-server/migrations/seed-data/kpi-metrics-seed.json +454 -0
- package/dist-server/migrations/seed-data/kpi-org-scope-seed.json +1676 -0
- package/dist-server/migrations/seed-data/kpi-scopes-seed.json +121 -0
- package/dist-server/migrations/seed-data/kpi-values-seed.json +402 -0
- package/dist-server/migrations/seed-data/kpis-seed.json +488 -0
- package/dist-server/migrations/seed-data/scope-definitions-seed.json +90 -0
- package/dist-server/service/index.d.ts +4 -7
- package/dist-server/service/index.js +10 -13
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/kpi/aggregate-kpi.js +30 -13
- package/dist-server/service/kpi/aggregate-kpi.js.map +1 -1
- package/dist-server/service/kpi/kpi-formula.service.d.ts +15 -0
- package/dist-server/service/kpi/kpi-formula.service.js +90 -0
- package/dist-server/service/kpi/kpi-formula.service.js.map +1 -1
- package/dist-server/service/kpi/kpi-history.d.ts +0 -3
- package/dist-server/service/kpi/kpi-history.js +0 -10
- package/dist-server/service/kpi/kpi-history.js.map +1 -1
- package/dist-server/service/kpi/kpi-mutation.d.ts +1 -1
- package/dist-server/service/kpi/kpi-mutation.js +57 -20
- package/dist-server/service/kpi/kpi-mutation.js.map +1 -1
- package/dist-server/service/kpi/kpi-query.d.ts +7 -3
- package/dist-server/service/kpi/kpi-query.js +126 -10
- package/dist-server/service/kpi/kpi-query.js.map +1 -1
- package/dist-server/service/kpi/kpi-type.d.ts +4 -2
- package/dist-server/service/kpi/kpi-type.js +12 -4
- package/dist-server/service/kpi/kpi-type.js.map +1 -1
- package/dist-server/service/kpi/kpi.d.ts +4 -3
- package/dist-server/service/kpi/kpi.js +20 -8
- package/dist-server/service/kpi/kpi.js.map +1 -1
- package/dist-server/service/kpi-metric/aggregate-kpi-metric.js +46 -11
- package/dist-server/service/kpi-metric/aggregate-kpi-metric.js.map +1 -1
- package/dist-server/service/kpi-metric-value/kpi-metric-value-mutation.d.ts +1 -1
- package/dist-server/service/kpi-metric-value/kpi-metric-value-mutation.js +6 -6
- package/dist-server/service/kpi-metric-value/kpi-metric-value-mutation.js.map +1 -1
- package/dist-server/service/kpi-metric-value/kpi-metric-value-type.d.ts +2 -2
- package/dist-server/service/kpi-metric-value/kpi-metric-value-type.js +4 -4
- package/dist-server/service/kpi-metric-value/kpi-metric-value-type.js.map +1 -1
- package/dist-server/service/kpi-metric-value/kpi-metric-value.d.ts +1 -1
- package/dist-server/service/kpi-metric-value/kpi-metric-value.js +3 -3
- package/dist-server/service/kpi-metric-value/kpi-metric-value.js.map +1 -1
- package/dist-server/service/kpi-org-scope/index.d.ts +5 -0
- package/dist-server/service/kpi-org-scope/index.js +9 -0
- package/dist-server/service/kpi-org-scope/index.js.map +1 -0
- package/dist-server/service/kpi-org-scope/kpi-org-scope-mutation.d.ts +8 -0
- package/dist-server/service/kpi-org-scope/kpi-org-scope-mutation.js +170 -0
- package/dist-server/service/kpi-org-scope/kpi-org-scope-mutation.js.map +1 -0
- package/dist-server/service/kpi-org-scope/kpi-org-scope-query.d.ts +14 -0
- package/dist-server/service/kpi-org-scope/kpi-org-scope-query.js +152 -0
- package/dist-server/service/kpi-org-scope/kpi-org-scope-query.js.map +1 -0
- package/dist-server/service/kpi-org-scope/kpi-org-scope-type.d.ts +26 -0
- package/dist-server/service/kpi-org-scope/kpi-org-scope-type.js +101 -0
- package/dist-server/service/kpi-org-scope/kpi-org-scope-type.js.map +1 -0
- package/dist-server/service/kpi-org-scope/kpi-org-scope.d.ts +26 -0
- package/dist-server/service/kpi-org-scope/kpi-org-scope.js +135 -0
- package/dist-server/service/kpi-org-scope/kpi-org-scope.js.map +1 -0
- package/dist-server/service/kpi-scope/index.d.ts +9 -0
- package/dist-server/service/kpi-scope/index.js +14 -0
- package/dist-server/service/kpi-scope/index.js.map +1 -0
- package/dist-server/service/kpi-scope/kpi-scope-mutation.d.ts +9 -0
- package/dist-server/service/kpi-scope/kpi-scope-mutation.js +135 -0
- package/dist-server/service/kpi-scope/kpi-scope-mutation.js.map +1 -0
- package/dist-server/service/kpi-scope/kpi-scope-query.d.ts +11 -0
- package/dist-server/service/kpi-scope/kpi-scope-query.js +89 -0
- package/dist-server/service/kpi-scope/kpi-scope-query.js.map +1 -0
- package/dist-server/service/kpi-scope/kpi-scope-type.d.ts +35 -0
- package/dist-server/service/kpi-scope/kpi-scope-type.js +138 -0
- package/dist-server/service/kpi-scope/kpi-scope-type.js.map +1 -0
- package/dist-server/service/kpi-scope/kpi-scope.d.ts +38 -0
- package/dist-server/service/kpi-scope/kpi-scope.js +144 -0
- package/dist-server/service/kpi-scope/kpi-scope.js.map +1 -0
- package/dist-server/service/kpi-statistic/kpi-statistic-batch.service.d.ts +43 -0
- package/dist-server/service/kpi-statistic/kpi-statistic-batch.service.js +181 -0
- package/dist-server/service/kpi-statistic/kpi-statistic-batch.service.js.map +1 -0
- package/dist-server/service/kpi-statistic/kpi-statistic-calculation.service.d.ts +50 -0
- package/dist-server/service/kpi-statistic/kpi-statistic-calculation.service.js +324 -0
- package/dist-server/service/kpi-statistic/kpi-statistic-calculation.service.js.map +1 -0
- package/dist-server/service/kpi-statistic/kpi-statistic-mutation.d.ts +4 -0
- package/dist-server/service/kpi-statistic/kpi-statistic-mutation.js +76 -0
- package/dist-server/service/kpi-statistic/kpi-statistic-mutation.js.map +1 -1
- package/dist-server/service/kpi-statistic/kpi-statistic-query.d.ts +5 -1
- package/dist-server/service/kpi-statistic/kpi-statistic-query.js +92 -1
- package/dist-server/service/kpi-statistic/kpi-statistic-query.js.map +1 -1
- package/dist-server/service/kpi-statistic/kpi-statistic.d.ts +4 -0
- package/dist-server/service/kpi-statistic/kpi-statistic.js +33 -0
- package/dist-server/service/kpi-statistic/kpi-statistic.js.map +1 -1
- package/dist-server/service/kpi-value/kpi-value-mutation.js +71 -7
- package/dist-server/service/kpi-value/kpi-value-mutation.js.map +1 -1
- package/dist-server/service/kpi-value/kpi-value-type.d.ts +4 -2
- package/dist-server/service/kpi-value/kpi-value-type.js +12 -4
- package/dist-server/service/kpi-value/kpi-value-type.js.map +1 -1
- package/dist-server/service/kpi-value/kpi-value.d.ts +3 -1
- package/dist-server/service/kpi-value/kpi-value.js +11 -5
- package/dist-server/service/kpi-value/kpi-value.js.map +1 -1
- package/dist-server/service/utils/value-date-util.d.ts +1 -0
- package/dist-server/service/utils/value-date-util.js +41 -0
- package/dist-server/service/utils/value-date-util.js.map +1 -1
- package/dist-server/tsconfig.json +10 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -6
- package/server/@types/index.d.ts +11 -0
- package/server/controllers/kpi-metric-value-provider.ts +5 -5
- package/server/controllers/kpi-value-provider.ts +4 -4
- package/server/migrations/1752190849680-seed-kpi-metrics.ts +124 -0
- package/server/migrations/1752190849681-seed-kpi.ts +356 -0
- package/server/migrations/1752192090123-add-grades-to-kpi.ts +67 -0
- package/server/migrations/1752192090124-add-kpi-statistics.ts +719 -0
- package/server/migrations/1752192090128-seed-kpi-org-scope.ts +132 -0
- package/server/migrations/1752192090129-seed-kpi-values.ts +207 -0
- package/server/migrations/grade-data/x11-performance-table.json +962 -0
- package/server/migrations/grade-data/x12-performance-table.json +611 -0
- package/server/migrations/grade-data/x14-performance-table.json +42 -0
- package/server/migrations/grade-data/x21-performance-table.json +889 -0
- package/server/migrations/grade-data/x22-performance-table.json +1064 -0
- package/server/migrations/grade-data/x23-performance-table.json +42 -0
- package/server/migrations/grade-data/x31-performance-table.json +644 -0
- package/server/migrations/grade-data/x32-performance-table.json +993 -0
- package/server/migrations/grade-data/x33-performance-table.json +195 -0
- package/server/migrations/grade-data/x34-performance-table.json +12 -0
- package/server/migrations/grade-data/x35-performance-table.json +42 -0
- package/server/migrations/grade-data/x41-performance-table.json +825 -0
- package/server/migrations/grade-data/x42-performance-table.json +786 -0
- package/server/migrations/grade-data/x43-performance-table.json +12 -0
- package/server/migrations/grade-data/x44-performance-table.json +42 -0
- package/server/migrations/grade-data/x51-performance-table.json +924 -0
- package/server/migrations/grade-data/x52-performance-table.json +42 -0
- package/server/migrations/grade-data/x61-performance-table.json +261 -0
- package/server/migrations/grade-data/x62-performance-table.json +42 -0
- package/server/migrations/seed-data/kpi-metrics-seed.json +454 -0
- package/server/migrations/seed-data/kpi-org-scope-seed.json +1676 -0
- package/server/migrations/seed-data/kpi-scopes-seed.json +121 -0
- package/server/migrations/seed-data/kpi-values-seed.json +402 -0
- package/server/migrations/seed-data/kpis-seed.json +488 -0
- package/server/migrations/seed-data/scope-definitions-seed.json +90 -0
- package/server/service/index.ts +10 -13
- package/server/service/kpi/aggregate-kpi.ts +31 -13
- package/server/service/kpi/kpi-formula.service.ts +101 -0
- package/server/service/kpi/kpi-history.ts +0 -8
- package/server/service/kpi/kpi-mutation.ts +59 -19
- package/server/service/kpi/kpi-query.ts +119 -8
- package/server/service/kpi/kpi-type.ts +10 -4
- package/server/service/kpi/kpi.ts +17 -7
- package/server/service/kpi-metric/aggregate-kpi-metric.ts +55 -11
- package/server/service/kpi-metric-value/kpi-metric-value-mutation.ts +6 -6
- package/server/service/kpi-metric-value/kpi-metric-value-type.ts +4 -4
- package/server/service/kpi-metric-value/kpi-metric-value.ts +3 -3
- package/server/service/kpi-org-scope/index.ts +6 -0
- package/server/service/kpi-org-scope/kpi-org-scope-mutation.ts +173 -0
- package/server/service/kpi-org-scope/kpi-org-scope-query.ts +127 -0
- package/server/service/kpi-org-scope/kpi-org-scope-type.ts +68 -0
- package/server/service/kpi-org-scope/kpi-org-scope.ts +123 -0
- package/server/service/kpi-scope/index.ts +11 -0
- package/server/service/kpi-scope/kpi-scope-mutation.ts +129 -0
- package/server/service/kpi-scope/kpi-scope-query.ts +63 -0
- package/server/service/kpi-scope/kpi-scope-type.ts +96 -0
- package/server/service/kpi-scope/kpi-scope.ts +143 -0
- package/server/service/kpi-statistic/kpi-statistic-batch.service.ts +231 -0
- package/server/service/kpi-statistic/kpi-statistic-calculation.service.ts +410 -0
- package/server/service/kpi-statistic/kpi-statistic-mutation.ts +97 -0
- package/server/service/kpi-statistic/kpi-statistic-query.ts +89 -2
- package/server/service/kpi-statistic/kpi-statistic.ts +32 -0
- package/server/service/kpi-value/kpi-value-mutation.ts +73 -7
- package/server/service/kpi-value/kpi-value-type.ts +10 -4
- package/server/service/kpi-value/kpi-value.ts +10 -5
- package/server/service/utils/value-date-util.ts +47 -0
- package/server/types/global.d.ts +8 -0
- package/things-factory.config.js +1 -0
- package/translations/en.json +15 -3
- package/translations/ja.json +13 -3
- package/translations/ko.json +15 -3
- package/translations/ms.json +13 -3
- package/translations/zh.json +13 -3
- package/client/pages/kpi-category/kpi-category-importer.ts +0 -90
- package/client/pages/kpi-category/kpi-category-list-page.ts +0 -537
- package/client/pages/kpi-category/kpi-category-value-calculator.ts +0 -233
- package/client/pages/kpi-category-value/kpi-category-value-list-page.ts +0 -404
- package/dist-client/pages/kpi-category/kpi-category-importer.d.ts +0 -23
- package/dist-client/pages/kpi-category/kpi-category-importer.js +0 -92
- package/dist-client/pages/kpi-category/kpi-category-importer.js.map +0 -1
- package/dist-client/pages/kpi-category/kpi-category-list-page.d.ts +0 -74
- package/dist-client/pages/kpi-category/kpi-category-list-page.js +0 -517
- package/dist-client/pages/kpi-category/kpi-category-list-page.js.map +0 -1
- package/dist-client/pages/kpi-category/kpi-category-value-calculator.d.ts +0 -13
- package/dist-client/pages/kpi-category/kpi-category-value-calculator.js +0 -256
- package/dist-client/pages/kpi-category/kpi-category-value-calculator.js.map +0 -1
- package/dist-client/pages/kpi-category-value/kpi-category-value-list-page.d.ts +0 -63
- package/dist-client/pages/kpi-category-value/kpi-category-value-list-page.js +0 -393
- package/dist-client/pages/kpi-category-value/kpi-category-value-list-page.js.map +0 -1
- package/dist-server/service/kpi-category/index.d.ts +0 -6
- package/dist-server/service/kpi-category/index.js +0 -10
- package/dist-server/service/kpi-category/index.js.map +0 -1
- package/dist-server/service/kpi-category/kpi-category-mutation.d.ts +0 -9
- package/dist-server/service/kpi-category/kpi-category-mutation.js +0 -221
- package/dist-server/service/kpi-category/kpi-category-mutation.js.map +0 -1
- package/dist-server/service/kpi-category/kpi-category-query.d.ts +0 -18
- package/dist-server/service/kpi-category/kpi-category-query.js +0 -115
- package/dist-server/service/kpi-category/kpi-category-query.js.map +0 -1
- package/dist-server/service/kpi-category/kpi-category-type.d.ts +0 -24
- package/dist-server/service/kpi-category/kpi-category-type.js +0 -100
- package/dist-server/service/kpi-category/kpi-category-type.js.map +0 -1
- package/dist-server/service/kpi-category/kpi-category.d.ts +0 -22
- package/dist-server/service/kpi-category/kpi-category.js +0 -106
- package/dist-server/service/kpi-category/kpi-category.js.map +0 -1
- package/dist-server/service/kpi-category-value/index.d.ts +0 -6
- package/dist-server/service/kpi-category-value/index.js +0 -10
- package/dist-server/service/kpi-category-value/index.js.map +0 -1
- package/dist-server/service/kpi-category-value/kpi-category-value-mutation.d.ts +0 -8
- package/dist-server/service/kpi-category-value/kpi-category-value-mutation.js +0 -102
- package/dist-server/service/kpi-category-value/kpi-category-value-mutation.js.map +0 -1
- package/dist-server/service/kpi-category-value/kpi-category-value-query.d.ts +0 -13
- package/dist-server/service/kpi-category-value/kpi-category-value-query.js +0 -91
- package/dist-server/service/kpi-category-value/kpi-category-value-query.js.map +0 -1
- package/dist-server/service/kpi-category-value/kpi-category-value-type.d.ts +0 -19
- package/dist-server/service/kpi-category-value/kpi-category-value-type.js +0 -73
- package/dist-server/service/kpi-category-value/kpi-category-value-type.js.map +0 -1
- package/dist-server/service/kpi-category-value/kpi-category-value.d.ts +0 -19
- package/dist-server/service/kpi-category-value/kpi-category-value.js +0 -91
- package/dist-server/service/kpi-category-value/kpi-category-value.js.map +0 -1
- package/helps/kpi/kpi-category.md +0 -160
- package/server/service/kpi-category/index.ts +0 -7
- package/server/service/kpi-category/kpi-category-mutation.ts +0 -217
- package/server/service/kpi-category/kpi-category-query.ts +0 -87
- package/server/service/kpi-category/kpi-category-type.ts +0 -73
- package/server/service/kpi-category/kpi-category.ts +0 -95
- package/server/service/kpi-category-value/index.ts +0 -7
- package/server/service/kpi-category-value/kpi-category-value-mutation.ts +0 -88
- package/server/service/kpi-category-value/kpi-category-value-query.ts +0 -62
- package/server/service/kpi-category-value/kpi-category-value-type.ts +0 -48
- package/server/service/kpi-category-value/kpi-category-value.ts +0 -79
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.KpiOrgScope = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const typeorm_1 = require("typeorm");
|
|
6
|
+
const type_graphql_1 = require("type-graphql");
|
|
7
|
+
const shell_1 = require("@things-factory/shell");
|
|
8
|
+
const auth_base_1 = require("@things-factory/auth-base");
|
|
9
|
+
let KpiOrgScope = class KpiOrgScope {
|
|
10
|
+
// Helper methods for Generic Reference Pattern
|
|
11
|
+
async getReferencedEntity(entityManager) {
|
|
12
|
+
try {
|
|
13
|
+
const repository = entityManager.getRepository(this.entityType);
|
|
14
|
+
return await repository.findOne({ where: { id: this.entityId } });
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
console.warn(`Failed to get referenced entity ${this.entityType}:${this.entityId}`, error);
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
async validateEntityReference(entityManager) {
|
|
22
|
+
try {
|
|
23
|
+
const entity = await this.getReferencedEntity(entityManager);
|
|
24
|
+
return !!entity;
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
// Convenience getter for display purposes
|
|
31
|
+
get displayName() {
|
|
32
|
+
return this.entityName || `${this.entityType}:${this.entityId}` || this.org || 'Unknown';
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
exports.KpiOrgScope = KpiOrgScope;
|
|
36
|
+
tslib_1.__decorate([
|
|
37
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
38
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { description: 'Unique identifier for this org-scope mapping.' }),
|
|
39
|
+
tslib_1.__metadata("design:type", String)
|
|
40
|
+
], KpiOrgScope.prototype, "id", void 0);
|
|
41
|
+
tslib_1.__decorate([
|
|
42
|
+
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
|
43
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Domain (tenant) to which this org-scope mapping belongs.' }),
|
|
44
|
+
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
45
|
+
], KpiOrgScope.prototype, "domain", void 0);
|
|
46
|
+
tslib_1.__decorate([
|
|
47
|
+
(0, typeorm_1.RelationId)((orgScope) => orgScope.domain),
|
|
48
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'ID of the domain (tenant) for this org-scope mapping.' }),
|
|
49
|
+
tslib_1.__metadata("design:type", String)
|
|
50
|
+
], KpiOrgScope.prototype, "domainId", void 0);
|
|
51
|
+
tslib_1.__decorate([
|
|
52
|
+
(0, typeorm_1.Column)(),
|
|
53
|
+
(0, type_graphql_1.Field)({ description: 'Type of the referenced business entity (e.g., Project, Department, Company, Employee)' }),
|
|
54
|
+
tslib_1.__metadata("design:type", String)
|
|
55
|
+
], KpiOrgScope.prototype, "entityType", void 0);
|
|
56
|
+
tslib_1.__decorate([
|
|
57
|
+
(0, typeorm_1.Column)(),
|
|
58
|
+
(0, type_graphql_1.Field)({ description: 'ID of the referenced business entity' }),
|
|
59
|
+
tslib_1.__metadata("design:type", String)
|
|
60
|
+
], KpiOrgScope.prototype, "entityId", void 0);
|
|
61
|
+
tslib_1.__decorate([
|
|
62
|
+
(0, typeorm_1.Column)(),
|
|
63
|
+
(0, type_graphql_1.Field)({ description: 'Name of the referenced business entity (denormalized for performance and convenience)' }),
|
|
64
|
+
tslib_1.__metadata("design:type", String)
|
|
65
|
+
], KpiOrgScope.prototype, "entityName", void 0);
|
|
66
|
+
tslib_1.__decorate([
|
|
67
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
68
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Legacy org field for backward compatibility' }),
|
|
69
|
+
tslib_1.__metadata("design:type", String)
|
|
70
|
+
], KpiOrgScope.prototype, "org", void 0);
|
|
71
|
+
tslib_1.__decorate([
|
|
72
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
73
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'First scope dimension (e.g., geographical region, business unit)' }),
|
|
74
|
+
tslib_1.__metadata("design:type", String)
|
|
75
|
+
], KpiOrgScope.prototype, "scope01", void 0);
|
|
76
|
+
tslib_1.__decorate([
|
|
77
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
78
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Second scope dimension (e.g., product line, customer segment)' }),
|
|
79
|
+
tslib_1.__metadata("design:type", String)
|
|
80
|
+
], KpiOrgScope.prototype, "scope02", void 0);
|
|
81
|
+
tslib_1.__decorate([
|
|
82
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
83
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Third scope dimension (e.g., process type, technology stack)' }),
|
|
84
|
+
tslib_1.__metadata("design:type", String)
|
|
85
|
+
], KpiOrgScope.prototype, "scope03", void 0);
|
|
86
|
+
tslib_1.__decorate([
|
|
87
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
88
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Fourth scope dimension (e.g., cost center, profit center)' }),
|
|
89
|
+
tslib_1.__metadata("design:type", String)
|
|
90
|
+
], KpiOrgScope.prototype, "scope04", void 0);
|
|
91
|
+
tslib_1.__decorate([
|
|
92
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
93
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Fifth scope dimension (e.g., risk level, priority tier)' }),
|
|
94
|
+
tslib_1.__metadata("design:type", String)
|
|
95
|
+
], KpiOrgScope.prototype, "scope05", void 0);
|
|
96
|
+
tslib_1.__decorate([
|
|
97
|
+
(0, typeorm_1.CreateDateColumn)(),
|
|
98
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Timestamp when this org-scope mapping was created.' }),
|
|
99
|
+
tslib_1.__metadata("design:type", Date)
|
|
100
|
+
], KpiOrgScope.prototype, "createdAt", void 0);
|
|
101
|
+
tslib_1.__decorate([
|
|
102
|
+
(0, typeorm_1.UpdateDateColumn)(),
|
|
103
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Timestamp when this org-scope mapping was last updated.' }),
|
|
104
|
+
tslib_1.__metadata("design:type", Date)
|
|
105
|
+
], KpiOrgScope.prototype, "updatedAt", void 0);
|
|
106
|
+
tslib_1.__decorate([
|
|
107
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
108
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'User who created this org-scope mapping.' }),
|
|
109
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
110
|
+
], KpiOrgScope.prototype, "creator", void 0);
|
|
111
|
+
tslib_1.__decorate([
|
|
112
|
+
(0, typeorm_1.RelationId)((orgScope) => orgScope.creator),
|
|
113
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'ID of the user who created this org-scope mapping.' }),
|
|
114
|
+
tslib_1.__metadata("design:type", String)
|
|
115
|
+
], KpiOrgScope.prototype, "creatorId", void 0);
|
|
116
|
+
tslib_1.__decorate([
|
|
117
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
118
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'User who last updated this org-scope mapping.' }),
|
|
119
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
120
|
+
], KpiOrgScope.prototype, "updater", void 0);
|
|
121
|
+
tslib_1.__decorate([
|
|
122
|
+
(0, typeorm_1.RelationId)((orgScope) => orgScope.updater),
|
|
123
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'ID of the user who last updated this org-scope mapping.' }),
|
|
124
|
+
tslib_1.__metadata("design:type", String)
|
|
125
|
+
], KpiOrgScope.prototype, "updaterId", void 0);
|
|
126
|
+
exports.KpiOrgScope = KpiOrgScope = tslib_1.__decorate([
|
|
127
|
+
(0, typeorm_1.Entity)(),
|
|
128
|
+
(0, typeorm_1.Index)('ix_kpi_org_scope_0', (orgScope) => [orgScope.domain, orgScope.entityType, orgScope.entityId], {
|
|
129
|
+
unique: true
|
|
130
|
+
}),
|
|
131
|
+
(0, type_graphql_1.ObjectType)({
|
|
132
|
+
description: 'KPI organization scope mapping entity. Maps business entities to various scope dimensions for KPI analysis using generic reference pattern.'
|
|
133
|
+
})
|
|
134
|
+
], KpiOrgScope);
|
|
135
|
+
//# sourceMappingURL=kpi-org-scope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kpi-org-scope.js","sourceRoot":"","sources":["../../../server/service/kpi-org-scope/kpi-org-scope.ts"],"names":[],"mappings":";;;;AAAA,qCAWgB;AAChB,+CAAoD;AAEpD,iDAA8C;AAC9C,yDAAgD;AAUzC,IAAM,WAAW,GAAjB,MAAM,WAAW;IAyEtB,+CAA+C;IAC/C,KAAK,CAAC,mBAAmB,CAAC,aAA4B;QACpD,IAAI,CAAC;YACH,MAAM,UAAU,GAAG,aAAa,CAAC,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;YAC/D,OAAO,MAAM,UAAU,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;QACnE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,IAAI,CAAC,mCAAmC,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,EAAE,EAAE,KAAK,CAAC,CAAA;YAC1F,OAAO,IAAI,CAAA;QACb,CAAC;IACH,CAAC;IAED,KAAK,CAAC,uBAAuB,CAAC,aAA4B;QACxD,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,aAAa,CAAC,CAAA;YAC5D,OAAO,CAAC,CAAC,MAAM,CAAA;QACjB,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAA;QACd,CAAC;IACH,CAAC;IAED,0CAA0C;IAC1C,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,UAAU,IAAI,GAAG,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,EAAE,IAAI,IAAI,CAAC,GAAG,IAAI,SAAS,CAAA;IAC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qB,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC;IACvD,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,oDAAoD,EAAE,CAAC;;8CAC3E;AAIlB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3C,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,+CAA+C,EAAE,CAAC;sCAC5F,gBAAI;4CAAA;AAId;IAFC,IAAA,oBAAU,EAAC,CAAC,QAAqB,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC;IACvD,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,yDAAyD,EAAE,CAAC;;8CAChF;sBAvEP,WAAW;IARvB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,oBAAoB,EAAE,CAAC,QAAqB,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,QAAQ,CAAC,EAAE;QACjH,MAAM,EAAE,IAAI;KACb,CAAC;IACD,IAAA,yBAAU,EAAC;QACV,WAAW,EACT,6IAA6I;KAChJ,CAAC;GACW,WAAW,CAiGvB","sourcesContent":["import {\n CreateDateColumn,\n UpdateDateColumn,\n DeleteDateColumn,\n Entity,\n Index,\n Column,\n RelationId,\n ManyToOne,\n PrimaryGeneratedColumn,\n EntityManager\n} from 'typeorm'\nimport { ObjectType, Field, ID } from 'type-graphql'\n\nimport { Domain } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\n\n@Entity()\n@Index('ix_kpi_org_scope_0', (orgScope: KpiOrgScope) => [orgScope.domain, orgScope.entityType, orgScope.entityId], {\n unique: true\n})\n@ObjectType({\n description:\n 'KPI organization scope mapping entity. Maps business entities to various scope dimensions for KPI analysis using generic reference pattern.'\n})\nexport class KpiOrgScope {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID, { description: 'Unique identifier for this org-scope mapping.' })\n readonly id: string\n\n @ManyToOne(type => Domain)\n @Field({ nullable: true, description: 'Domain (tenant) to which this org-scope mapping belongs.' })\n domain?: Domain\n\n @RelationId((orgScope: KpiOrgScope) => orgScope.domain)\n @Field({ nullable: true, description: 'ID of the domain (tenant) for this org-scope mapping.' })\n domainId?: string\n\n @Column()\n @Field({ description: 'Type of the referenced business entity (e.g., Project, Department, Company, Employee)' })\n entityType: string\n\n @Column()\n @Field({ description: 'ID of the referenced business entity' })\n entityId: string\n\n @Column()\n @Field({ description: 'Name of the referenced business entity (denormalized for performance and convenience)' })\n entityName: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Legacy org field for backward compatibility' })\n org?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'First scope dimension (e.g., geographical region, business unit)' })\n scope01?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Second scope dimension (e.g., product line, customer segment)' })\n scope02?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Third scope dimension (e.g., process type, technology stack)' })\n scope03?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Fourth scope dimension (e.g., cost center, profit center)' })\n scope04?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Fifth scope dimension (e.g., risk level, priority tier)' })\n scope05?: string\n\n @CreateDateColumn()\n @Field({ nullable: true, description: 'Timestamp when this org-scope mapping was created.' })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true, description: 'Timestamp when this org-scope mapping was last updated.' })\n updatedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'User who created this org-scope mapping.' })\n creator?: User\n\n @RelationId((orgScope: KpiOrgScope) => orgScope.creator)\n @Field({ nullable: true, description: 'ID of the user who created this org-scope mapping.' })\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'User who last updated this org-scope mapping.' })\n updater?: User\n\n @RelationId((orgScope: KpiOrgScope) => orgScope.updater)\n @Field({ nullable: true, description: 'ID of the user who last updated this org-scope mapping.' })\n updaterId?: string\n\n // Helper methods for Generic Reference Pattern\n async getReferencedEntity(entityManager: EntityManager): Promise<any> {\n try {\n const repository = entityManager.getRepository(this.entityType)\n return await repository.findOne({ where: { id: this.entityId } })\n } catch (error) {\n console.warn(`Failed to get referenced entity ${this.entityType}:${this.entityId}`, error)\n return null\n }\n }\n\n async validateEntityReference(entityManager: EntityManager): Promise<boolean> {\n try {\n const entity = await this.getReferencedEntity(entityManager)\n return !!entity\n } catch {\n return false\n }\n }\n\n // Convenience getter for display purposes\n get displayName(): string {\n return this.entityName || `${this.entityType}:${this.entityId}` || this.org || 'Unknown'\n }\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { KpiScope } from './kpi-scope';
|
|
2
|
+
import { KpiScopeQuery } from './kpi-scope-query';
|
|
3
|
+
import { KpiScopeMutation } from './kpi-scope-mutation';
|
|
4
|
+
export declare const entities: (typeof KpiScope)[];
|
|
5
|
+
export declare const resolvers: (typeof KpiScopeQuery | typeof KpiScopeMutation)[];
|
|
6
|
+
export * from './kpi-scope';
|
|
7
|
+
export * from './kpi-scope-query';
|
|
8
|
+
export * from './kpi-scope-mutation';
|
|
9
|
+
export * from './kpi-scope-type';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolvers = exports.entities = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const kpi_scope_1 = require("./kpi-scope");
|
|
6
|
+
const kpi_scope_query_1 = require("./kpi-scope-query");
|
|
7
|
+
const kpi_scope_mutation_1 = require("./kpi-scope-mutation");
|
|
8
|
+
exports.entities = [kpi_scope_1.KpiScope];
|
|
9
|
+
exports.resolvers = [kpi_scope_query_1.KpiScopeQuery, kpi_scope_mutation_1.KpiScopeMutation];
|
|
10
|
+
tslib_1.__exportStar(require("./kpi-scope"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./kpi-scope-query"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./kpi-scope-mutation"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./kpi-scope-type"), exports);
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/kpi-scope/index.ts"],"names":[],"mappings":";;;;AAAA,2CAAsC;AACtC,uDAAiD;AACjD,6DAAuD;AAE1C,QAAA,QAAQ,GAAG,CAAC,oBAAQ,CAAC,CAAA;AACrB,QAAA,SAAS,GAAG,CAAC,+BAAa,EAAE,qCAAgB,CAAC,CAAA;AAE1D,sDAA2B;AAC3B,4DAAiC;AACjC,+DAAoC;AACpC,2DAAgC","sourcesContent":["import { KpiScope } from './kpi-scope'\nimport { KpiScopeQuery } from './kpi-scope-query'\nimport { KpiScopeMutation } from './kpi-scope-mutation'\n\nexport const entities = [KpiScope]\nexport const resolvers = [KpiScopeQuery, KpiScopeMutation]\n\nexport * from './kpi-scope'\nexport * from './kpi-scope-query'\nexport * from './kpi-scope-mutation'\nexport * from './kpi-scope-type'\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { KpiScope } from './kpi-scope';
|
|
2
|
+
import { NewKpiScope, KpiScopePatch } from './kpi-scope-type';
|
|
3
|
+
export declare class KpiScopeMutation {
|
|
4
|
+
createKpiScope(kpiScope: NewKpiScope, context: ResolverContext): Promise<KpiScope>;
|
|
5
|
+
updateKpiScope(id: string, patch: KpiScopePatch, context: ResolverContext): Promise<KpiScope>;
|
|
6
|
+
updateMultipleKpiScope(patches: KpiScopePatch[], context: ResolverContext): Promise<KpiScope[]>;
|
|
7
|
+
deleteKpiScope(id: string, context: ResolverContext): Promise<boolean>;
|
|
8
|
+
deleteKpiScopes(ids: string[], context: ResolverContext): Promise<boolean>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.KpiScopeMutation = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const type_graphql_1 = require("type-graphql");
|
|
6
|
+
const typeorm_1 = require("typeorm");
|
|
7
|
+
const shell_1 = require("@things-factory/shell");
|
|
8
|
+
const kpi_scope_1 = require("./kpi-scope");
|
|
9
|
+
const kpi_scope_type_1 = require("./kpi-scope-type");
|
|
10
|
+
let KpiScopeMutation = class KpiScopeMutation {
|
|
11
|
+
async createKpiScope(kpiScope, context) {
|
|
12
|
+
const { domain, user, tx } = context.state;
|
|
13
|
+
const result = await (0, shell_1.getRepository)(kpi_scope_1.KpiScope, tx).save({
|
|
14
|
+
...kpiScope,
|
|
15
|
+
domain,
|
|
16
|
+
creator: user,
|
|
17
|
+
updater: user
|
|
18
|
+
});
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
async updateKpiScope(id, patch, context) {
|
|
22
|
+
const { domain, user, tx } = context.state;
|
|
23
|
+
const repository = (0, shell_1.getRepository)(kpi_scope_1.KpiScope, tx);
|
|
24
|
+
const kpiScope = await repository.findOne({
|
|
25
|
+
where: { domain: { id: domain.id }, id }
|
|
26
|
+
});
|
|
27
|
+
const result = await repository.save({
|
|
28
|
+
...kpiScope,
|
|
29
|
+
...patch,
|
|
30
|
+
updater: user
|
|
31
|
+
});
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
async updateMultipleKpiScope(patches, context) {
|
|
35
|
+
const { domain, user, tx } = context.state;
|
|
36
|
+
let results = [];
|
|
37
|
+
const _createRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === '+');
|
|
38
|
+
const _updateRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === 'M');
|
|
39
|
+
const kpiScopeRepo = (0, shell_1.getRepository)(kpi_scope_1.KpiScope, tx);
|
|
40
|
+
if (_createRecords.length > 0) {
|
|
41
|
+
for (let i = 0; i < _createRecords.length; i++) {
|
|
42
|
+
const newRecord = _createRecords[i];
|
|
43
|
+
const result = await kpiScopeRepo.save({
|
|
44
|
+
...newRecord,
|
|
45
|
+
domain,
|
|
46
|
+
creator: user,
|
|
47
|
+
updater: user
|
|
48
|
+
});
|
|
49
|
+
results.push({ ...result, cuFlag: '+' });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (_updateRecords.length > 0) {
|
|
53
|
+
for (let i = 0; i < _updateRecords.length; i++) {
|
|
54
|
+
const updateRecord = _updateRecords[i];
|
|
55
|
+
const kpiScope = await kpiScopeRepo.findOneBy({ id: updateRecord.id });
|
|
56
|
+
const result = await kpiScopeRepo.save({
|
|
57
|
+
...kpiScope,
|
|
58
|
+
...updateRecord,
|
|
59
|
+
updater: user
|
|
60
|
+
});
|
|
61
|
+
results.push({ ...result, cuFlag: 'M' });
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return results;
|
|
65
|
+
}
|
|
66
|
+
async deleteKpiScope(id, context) {
|
|
67
|
+
const { domain, tx } = context.state;
|
|
68
|
+
await (0, shell_1.getRepository)(kpi_scope_1.KpiScope, tx).delete({ domain: { id: domain.id }, id });
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
async deleteKpiScopes(ids, context) {
|
|
72
|
+
const { domain, tx } = context.state;
|
|
73
|
+
await (0, shell_1.getRepository)(kpi_scope_1.KpiScope, tx).delete({
|
|
74
|
+
domain: { id: domain.id },
|
|
75
|
+
id: (0, typeorm_1.In)(ids)
|
|
76
|
+
});
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
exports.KpiScopeMutation = KpiScopeMutation;
|
|
81
|
+
tslib_1.__decorate([
|
|
82
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
|
83
|
+
(0, type_graphql_1.Directive)('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)'),
|
|
84
|
+
(0, type_graphql_1.Mutation)(returns => kpi_scope_1.KpiScope, { description: 'Create a new scope dimension definition' }),
|
|
85
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('kpiScope')),
|
|
86
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
87
|
+
tslib_1.__metadata("design:type", Function),
|
|
88
|
+
tslib_1.__metadata("design:paramtypes", [kpi_scope_type_1.NewKpiScope, Object]),
|
|
89
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
90
|
+
], KpiScopeMutation.prototype, "createKpiScope", null);
|
|
91
|
+
tslib_1.__decorate([
|
|
92
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
|
93
|
+
(0, type_graphql_1.Directive)('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)'),
|
|
94
|
+
(0, type_graphql_1.Mutation)(returns => kpi_scope_1.KpiScope, { description: 'Update a scope dimension definition' }),
|
|
95
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
96
|
+
tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
|
|
97
|
+
tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
|
|
98
|
+
tslib_1.__metadata("design:type", Function),
|
|
99
|
+
tslib_1.__metadata("design:paramtypes", [String, kpi_scope_type_1.KpiScopePatch, Object]),
|
|
100
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
101
|
+
], KpiScopeMutation.prototype, "updateKpiScope", null);
|
|
102
|
+
tslib_1.__decorate([
|
|
103
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
|
104
|
+
(0, type_graphql_1.Directive)('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)'),
|
|
105
|
+
(0, type_graphql_1.Mutation)(returns => [kpi_scope_1.KpiScope], { description: "Update multiple scope dimension definitions" }),
|
|
106
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [kpi_scope_type_1.KpiScopePatch])),
|
|
107
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
108
|
+
tslib_1.__metadata("design:type", Function),
|
|
109
|
+
tslib_1.__metadata("design:paramtypes", [Array, Object]),
|
|
110
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
111
|
+
], KpiScopeMutation.prototype, "updateMultipleKpiScope", null);
|
|
112
|
+
tslib_1.__decorate([
|
|
113
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
|
114
|
+
(0, type_graphql_1.Directive)('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)'),
|
|
115
|
+
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'Delete a scope dimension definition' }),
|
|
116
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
117
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
118
|
+
tslib_1.__metadata("design:type", Function),
|
|
119
|
+
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
|
120
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
121
|
+
], KpiScopeMutation.prototype, "deleteKpiScope", null);
|
|
122
|
+
tslib_1.__decorate([
|
|
123
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
|
124
|
+
(0, type_graphql_1.Directive)('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)'),
|
|
125
|
+
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'Delete multiple scope dimension definitions' }),
|
|
126
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
|
|
127
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
128
|
+
tslib_1.__metadata("design:type", Function),
|
|
129
|
+
tslib_1.__metadata("design:paramtypes", [Array, Object]),
|
|
130
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
131
|
+
], KpiScopeMutation.prototype, "deleteKpiScopes", null);
|
|
132
|
+
exports.KpiScopeMutation = KpiScopeMutation = tslib_1.__decorate([
|
|
133
|
+
(0, type_graphql_1.Resolver)(kpi_scope_1.KpiScope)
|
|
134
|
+
], KpiScopeMutation);
|
|
135
|
+
//# sourceMappingURL=kpi-scope-mutation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kpi-scope-mutation.js","sourceRoot":"","sources":["../../../server/service/kpi-scope/kpi-scope-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAC5B,iDAAqD;AAGrD,2CAAsC;AACtC,qDAA6D;AAGtD,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAIrB,AAAN,KAAK,CAAC,cAAc,CACD,QAAqB,EAC/B,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAa,EAAC,oBAAQ,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC;YACpD,GAAG,QAAQ;YACX,MAAM;YACN,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,IAAI;SACd,CAAC,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC;IAKK,AAAN,KAAK,CAAC,cAAc,CACP,EAAU,EACP,KAAoB,EAC3B,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,UAAU,GAAG,IAAA,qBAAa,EAAC,oBAAQ,EAAE,EAAE,CAAC,CAAA;QAC9C,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC;YACxC,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CA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EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,qCAAqC,EAAE,CAAC;IAC/D,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;sDAMjD;AAKK;IAHL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,sGAAsG,CAAC;IACjH,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,6CAA6C,EAAE,CAAC;IAE1F,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;uDAUP;2BArHU,gBAAgB;IAD5B,IAAA,uBAAQ,EAAC,oBAAQ,CAAC;GACN,gBAAgB,CAuH5B","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\nimport { getRepository } from '@things-factory/shell'\nimport type ResolverContext from '@things-factory/auth-base'\n\nimport { KpiScope } from './kpi-scope'\nimport { NewKpiScope, KpiScopePatch } from './kpi-scope-type'\n\n@Resolver(KpiScope)\nexport class KpiScopeMutation {\n @Directive('@transaction')\n @Directive('@privilege(category: \"kpi\", privilege: \"mutation\", domainOwnerGranted: true, superUserGranted: true)')\n @Mutation(returns => KpiScope, { description: 'Create a new scope dimension definition' })\n async createKpiScope(\n @Arg('kpiScope') kpiScope: NewKpiScope,\n @Ctx() context: ResolverContext\n ): Promise<KpiScope> {\n const { domain, user, tx } = context.state\n\n const result = await getRepository(KpiScope, tx).save({\n ...kpiScope,\n domain,\n creator: user,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"kpi\", privilege: \"mutation\", domainOwnerGranted: true, superUserGranted: true)')\n @Mutation(returns => KpiScope, { description: 'Update a scope dimension definition' })\n async updateKpiScope(\n @Arg('id') id: string,\n @Arg('patch') patch: KpiScopePatch,\n @Ctx() context: ResolverContext\n ): Promise<KpiScope> {\n const { domain, user, tx } = context.state\n\n const repository = getRepository(KpiScope, tx)\n const kpiScope = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...kpiScope,\n ...patch,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"kpi\", privilege: \"mutation\", domainOwnerGranted: true, superUserGranted: true)')\n @Mutation(returns => [KpiScope], { description: \"Update multiple scope dimension definitions\" })\n async updateMultipleKpiScope(\n @Arg('patches', type => [KpiScopePatch]) patches: KpiScopePatch[],\n @Ctx() context: ResolverContext\n ): Promise<KpiScope[]> {\n const { domain, user, tx } = context.state\n\n let results = []\n const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')\n const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')\n const kpiScopeRepo = getRepository(KpiScope, tx)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n const newRecord = _createRecords[i]\n\n const result = await kpiScopeRepo.save({\n ...newRecord,\n domain,\n creator: user,\n updater: user\n })\n\n results.push({ ...result, cuFlag: '+' })\n }\n }\n\n if (_updateRecords.length > 0) {\n for (let i = 0; i < _updateRecords.length; i++) {\n const updateRecord = _updateRecords[i]\n const kpiScope = await kpiScopeRepo.findOneBy({ id: updateRecord.id })\n\n const result = await kpiScopeRepo.save({\n ...kpiScope,\n ...updateRecord,\n updater: user\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"kpi\", privilege: \"mutation\", domainOwnerGranted: true, superUserGranted: true)')\n @Mutation(returns => Boolean, { description: 'Delete a scope dimension definition' })\n async deleteKpiScope(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(KpiScope, tx).delete({ domain: { id: domain.id }, id })\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"kpi\", privilege: \"mutation\", domainOwnerGranted: true, superUserGranted: true)')\n @Mutation(returns => Boolean, { description: 'Delete multiple scope dimension definitions' })\n async deleteKpiScopes(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(KpiScope, tx).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n return true\n }\n\n}"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Domain, ListParam } from '@things-factory/shell';
|
|
2
|
+
import { User } from '@things-factory/auth-base';
|
|
3
|
+
import { KpiScope } from './kpi-scope';
|
|
4
|
+
import { KpiScopeList } from './kpi-scope-type';
|
|
5
|
+
export declare class KpiScopeQuery {
|
|
6
|
+
kpiScope(id: string, context: ResolverContext): Promise<KpiScope>;
|
|
7
|
+
kpiScopes(params: ListParam, context: ResolverContext): Promise<KpiScopeList>;
|
|
8
|
+
domain(kpiScope: KpiScope): Promise<Domain>;
|
|
9
|
+
updater(kpiScope: KpiScope): Promise<User>;
|
|
10
|
+
creator(kpiScope: KpiScope): Promise<User>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.KpiScopeQuery = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const type_graphql_1 = require("type-graphql");
|
|
6
|
+
const shell_1 = require("@things-factory/shell");
|
|
7
|
+
const auth_base_1 = require("@things-factory/auth-base");
|
|
8
|
+
const kpi_scope_1 = require("./kpi-scope");
|
|
9
|
+
const kpi_scope_type_1 = require("./kpi-scope-type");
|
|
10
|
+
let KpiScopeQuery = class KpiScopeQuery {
|
|
11
|
+
async kpiScope(id, context) {
|
|
12
|
+
const { domain } = context.state;
|
|
13
|
+
return await (0, shell_1.getRepository)(kpi_scope_1.KpiScope).findOne({
|
|
14
|
+
where: { domain: { id: domain.id }, id }
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
async kpiScopes(params, context) {
|
|
18
|
+
const { domain } = context.state;
|
|
19
|
+
const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
|
|
20
|
+
domain,
|
|
21
|
+
params,
|
|
22
|
+
repository: await (0, shell_1.getRepository)(kpi_scope_1.KpiScope),
|
|
23
|
+
searchables: ['name', 'description'],
|
|
24
|
+
filtersMap: {
|
|
25
|
+
level: { columnName: 'level' },
|
|
26
|
+
scopeType: { columnName: 'scopeType' },
|
|
27
|
+
parentLevel: { columnName: 'parentLevel' },
|
|
28
|
+
active: { columnName: 'active' },
|
|
29
|
+
includeInStatistics: { columnName: 'includeInStatistics' },
|
|
30
|
+
showInDashboard: { columnName: 'showInDashboard' }
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
const [items, total] = await queryBuilder.getManyAndCount();
|
|
34
|
+
return { items, total };
|
|
35
|
+
}
|
|
36
|
+
async domain(kpiScope) {
|
|
37
|
+
return kpiScope.domainId && (await (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: kpiScope.domainId }));
|
|
38
|
+
}
|
|
39
|
+
async updater(kpiScope) {
|
|
40
|
+
return kpiScope.updaterId && (await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: kpiScope.updaterId }));
|
|
41
|
+
}
|
|
42
|
+
async creator(kpiScope) {
|
|
43
|
+
return kpiScope.creatorId && (await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: kpiScope.creatorId }));
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
exports.KpiScopeQuery = KpiScopeQuery;
|
|
47
|
+
tslib_1.__decorate([
|
|
48
|
+
(0, type_graphql_1.Directive)('@privilege(category: "kpi", privilege: "query", domainOwnerGranted: true, superUserGranted: true)'),
|
|
49
|
+
(0, type_graphql_1.Query)(returns => kpi_scope_1.KpiScope, { nullable: true, description: 'Fetch a scope dimension definition by ID' }),
|
|
50
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
51
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
52
|
+
tslib_1.__metadata("design:type", Function),
|
|
53
|
+
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
|
54
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
55
|
+
], KpiScopeQuery.prototype, "kpiScope", null);
|
|
56
|
+
tslib_1.__decorate([
|
|
57
|
+
(0, type_graphql_1.Query)(returns => kpi_scope_type_1.KpiScopeList, { description: 'Fetch multiple scope dimension definitions' }),
|
|
58
|
+
(0, type_graphql_1.Directive)('@privilege(category: "kpi", privilege: "query", domainOwnerGranted: true, superUserGranted: true)'),
|
|
59
|
+
tslib_1.__param(0, (0, type_graphql_1.Args)(type => shell_1.ListParam)),
|
|
60
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
61
|
+
tslib_1.__metadata("design:type", Function),
|
|
62
|
+
tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
|
|
63
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
64
|
+
], KpiScopeQuery.prototype, "kpiScopes", null);
|
|
65
|
+
tslib_1.__decorate([
|
|
66
|
+
(0, type_graphql_1.FieldResolver)(type => shell_1.Domain),
|
|
67
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
68
|
+
tslib_1.__metadata("design:type", Function),
|
|
69
|
+
tslib_1.__metadata("design:paramtypes", [kpi_scope_1.KpiScope]),
|
|
70
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
71
|
+
], KpiScopeQuery.prototype, "domain", null);
|
|
72
|
+
tslib_1.__decorate([
|
|
73
|
+
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
|
|
74
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
75
|
+
tslib_1.__metadata("design:type", Function),
|
|
76
|
+
tslib_1.__metadata("design:paramtypes", [kpi_scope_1.KpiScope]),
|
|
77
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
78
|
+
], KpiScopeQuery.prototype, "updater", null);
|
|
79
|
+
tslib_1.__decorate([
|
|
80
|
+
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
|
|
81
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
82
|
+
tslib_1.__metadata("design:type", Function),
|
|
83
|
+
tslib_1.__metadata("design:paramtypes", [kpi_scope_1.KpiScope]),
|
|
84
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
85
|
+
], KpiScopeQuery.prototype, "creator", null);
|
|
86
|
+
exports.KpiScopeQuery = KpiScopeQuery = tslib_1.__decorate([
|
|
87
|
+
(0, type_graphql_1.Resolver)(kpi_scope_1.KpiScope)
|
|
88
|
+
], KpiScopeQuery);
|
|
89
|
+
//# sourceMappingURL=kpi-scope-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kpi-scope-query.js","sourceRoot":"","sources":["../../../server/service/kpi-scope/kpi-scope-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,iDAAuG;AACvG,yDAAgD;AAEhD,2CAAsC;AACtC,qDAA+C;AAGxC,IAAM,aAAa,GAAnB,MAAM,aAAa;IAGlB,AAAN,KAAK,CAAC,QAAQ,CAAY,EAAU,EAAS,OAAwB;QACnE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,qBAAa,EAAC,oBAAQ,CAAC,CAAC,OAAO,CAAC;YAC3C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;SACzC,CAAC,CAAA;IACJ,CAAC;IAIK,AAAN,KAAK,CAAC,SAAS,CACY,MAAiB,EACnC,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,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-graphql'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport type ResolverContext from '@things-factory/auth-base'\nimport { KpiScope } from './kpi-scope'\nimport { KpiScopeList } from './kpi-scope-type'\n\n@Resolver(KpiScope)\nexport class KpiScopeQuery {\n @Directive('@privilege(category: \"kpi\", privilege: \"query\", domainOwnerGranted: true, superUserGranted: true)')\n @Query(returns => KpiScope!, { nullable: true, description: 'Fetch a scope dimension definition by ID' })\n async kpiScope(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<KpiScope> {\n const { domain } = context.state\n\n return await getRepository(KpiScope).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Query(returns => KpiScopeList, { description: 'Fetch multiple scope dimension definitions' })\n @Directive('@privilege(category: \"kpi\", privilege: \"query\", domainOwnerGranted: true, superUserGranted: true)')\n async kpiScopes(\n @Args(type => ListParam) params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<KpiScopeList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(KpiScope),\n searchables: ['name', 'description'],\n filtersMap: {\n level: { columnName: 'level' },\n scopeType: { columnName: 'scopeType' },\n parentLevel: { columnName: 'parentLevel' },\n active: { columnName: 'active' },\n includeInStatistics: { columnName: 'includeInStatistics' },\n showInDashboard: { columnName: 'showInDashboard' }\n }\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n\n @FieldResolver(type => Domain)\n async domain(@Root() kpiScope: KpiScope): Promise<Domain> {\n return kpiScope.domainId && (await getRepository(Domain).findOneBy({ id: kpiScope.domainId }))\n }\n\n @FieldResolver(type => User)\n async updater(@Root() kpiScope: KpiScope): Promise<User> {\n return kpiScope.updaterId && (await getRepository(User).findOneBy({ id: kpiScope.updaterId }))\n }\n\n @FieldResolver(type => User)\n async creator(@Root() kpiScope: KpiScope): Promise<User> {\n return kpiScope.creatorId && (await getRepository(User).findOneBy({ id: kpiScope.creatorId }))\n }\n}"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { KpiScope, ScopeType } from './kpi-scope';
|
|
2
|
+
export declare class NewKpiScope {
|
|
3
|
+
level: number;
|
|
4
|
+
name: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
scopeType: ScopeType;
|
|
7
|
+
parentLevel?: number;
|
|
8
|
+
displayOrder: number;
|
|
9
|
+
validValues?: string[];
|
|
10
|
+
validationPattern?: string;
|
|
11
|
+
active: boolean;
|
|
12
|
+
includeInStatistics: boolean;
|
|
13
|
+
showInDashboard: boolean;
|
|
14
|
+
metadata?: any;
|
|
15
|
+
}
|
|
16
|
+
export declare class KpiScopePatch {
|
|
17
|
+
id?: string;
|
|
18
|
+
level: number;
|
|
19
|
+
name: string;
|
|
20
|
+
description?: string;
|
|
21
|
+
scopeType: ScopeType;
|
|
22
|
+
parentLevel?: number;
|
|
23
|
+
displayOrder: number;
|
|
24
|
+
validValues?: string[];
|
|
25
|
+
validationPattern?: string;
|
|
26
|
+
active: boolean;
|
|
27
|
+
includeInStatistics: boolean;
|
|
28
|
+
showInDashboard: boolean;
|
|
29
|
+
metadata?: any;
|
|
30
|
+
cuFlag?: string;
|
|
31
|
+
}
|
|
32
|
+
export declare class KpiScopeList {
|
|
33
|
+
items: KpiScope[];
|
|
34
|
+
total: number;
|
|
35
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.KpiScopeList = exports.KpiScopePatch = exports.NewKpiScope = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const shell_1 = require("@things-factory/shell");
|
|
6
|
+
const type_graphql_1 = require("type-graphql");
|
|
7
|
+
const kpi_scope_1 = require("./kpi-scope");
|
|
8
|
+
let NewKpiScope = class NewKpiScope {
|
|
9
|
+
};
|
|
10
|
+
exports.NewKpiScope = NewKpiScope;
|
|
11
|
+
tslib_1.__decorate([
|
|
12
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'Scope level (1-5) corresponding to scope01-scope05 in KpiOrgScope' }),
|
|
13
|
+
tslib_1.__metadata("design:type", Number)
|
|
14
|
+
], NewKpiScope.prototype, "level", void 0);
|
|
15
|
+
tslib_1.__decorate([
|
|
16
|
+
(0, type_graphql_1.Field)({ description: 'Display name for this scope dimension (e.g., "지역", "회사", "프로젝트규모")' }),
|
|
17
|
+
tslib_1.__metadata("design:type", String)
|
|
18
|
+
], NewKpiScope.prototype, "name", void 0);
|
|
19
|
+
tslib_1.__decorate([
|
|
20
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Detailed description of what this scope dimension represents' }),
|
|
21
|
+
tslib_1.__metadata("design:type", String)
|
|
22
|
+
], NewKpiScope.prototype, "description", void 0);
|
|
23
|
+
tslib_1.__decorate([
|
|
24
|
+
(0, type_graphql_1.Field)(type => kpi_scope_1.ScopeType, { description: 'Type category of this scope dimension' }),
|
|
25
|
+
tslib_1.__metadata("design:type", String)
|
|
26
|
+
], NewKpiScope.prototype, "scopeType", void 0);
|
|
27
|
+
tslib_1.__decorate([
|
|
28
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true, description: 'Parent scope level if this forms a hierarchy' }),
|
|
29
|
+
tslib_1.__metadata("design:type", Number)
|
|
30
|
+
], NewKpiScope.prototype, "parentLevel", void 0);
|
|
31
|
+
tslib_1.__decorate([
|
|
32
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'Order/priority for display and processing', defaultValue: 1 }),
|
|
33
|
+
tslib_1.__metadata("design:type", Number)
|
|
34
|
+
], NewKpiScope.prototype, "displayOrder", void 0);
|
|
35
|
+
tslib_1.__decorate([
|
|
36
|
+
(0, type_graphql_1.Field)(type => [String], { nullable: true, description: 'List of valid values for this scope' }),
|
|
37
|
+
tslib_1.__metadata("design:type", Array)
|
|
38
|
+
], NewKpiScope.prototype, "validValues", void 0);
|
|
39
|
+
tslib_1.__decorate([
|
|
40
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Regex pattern for validating values in this scope dimension' }),
|
|
41
|
+
tslib_1.__metadata("design:type", String)
|
|
42
|
+
], NewKpiScope.prototype, "validationPattern", void 0);
|
|
43
|
+
tslib_1.__decorate([
|
|
44
|
+
(0, type_graphql_1.Field)({ description: 'Whether this scope definition is active and should be used', defaultValue: true }),
|
|
45
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
46
|
+
], NewKpiScope.prototype, "active", void 0);
|
|
47
|
+
tslib_1.__decorate([
|
|
48
|
+
(0, type_graphql_1.Field)({ description: 'Whether this scope should be included in statistical calculations', defaultValue: true }),
|
|
49
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
50
|
+
], NewKpiScope.prototype, "includeInStatistics", void 0);
|
|
51
|
+
tslib_1.__decorate([
|
|
52
|
+
(0, type_graphql_1.Field)({ description: 'Whether this scope should be displayed in dashboard visualizations', defaultValue: false }),
|
|
53
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
54
|
+
], NewKpiScope.prototype, "showInDashboard", void 0);
|
|
55
|
+
tslib_1.__decorate([
|
|
56
|
+
(0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true, description: 'Additional metadata for this scope dimension' }),
|
|
57
|
+
tslib_1.__metadata("design:type", Object)
|
|
58
|
+
], NewKpiScope.prototype, "metadata", void 0);
|
|
59
|
+
exports.NewKpiScope = NewKpiScope = tslib_1.__decorate([
|
|
60
|
+
(0, type_graphql_1.InputType)()
|
|
61
|
+
], NewKpiScope);
|
|
62
|
+
let KpiScopePatch = class KpiScopePatch {
|
|
63
|
+
};
|
|
64
|
+
exports.KpiScopePatch = KpiScopePatch;
|
|
65
|
+
tslib_1.__decorate([
|
|
66
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
|
|
67
|
+
tslib_1.__metadata("design:type", String)
|
|
68
|
+
], KpiScopePatch.prototype, "id", void 0);
|
|
69
|
+
tslib_1.__decorate([
|
|
70
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'Scope level (1-5) corresponding to scope01-scope05 in KpiOrgScope' }),
|
|
71
|
+
tslib_1.__metadata("design:type", Number)
|
|
72
|
+
], KpiScopePatch.prototype, "level", void 0);
|
|
73
|
+
tslib_1.__decorate([
|
|
74
|
+
(0, type_graphql_1.Field)({ description: 'Display name for this scope dimension (e.g., "지역", "회사", "프로젝트규모")' }),
|
|
75
|
+
tslib_1.__metadata("design:type", String)
|
|
76
|
+
], KpiScopePatch.prototype, "name", void 0);
|
|
77
|
+
tslib_1.__decorate([
|
|
78
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Detailed description of what this scope dimension represents' }),
|
|
79
|
+
tslib_1.__metadata("design:type", String)
|
|
80
|
+
], KpiScopePatch.prototype, "description", void 0);
|
|
81
|
+
tslib_1.__decorate([
|
|
82
|
+
(0, type_graphql_1.Field)(type => kpi_scope_1.ScopeType, { description: 'Type category of this scope dimension' }),
|
|
83
|
+
tslib_1.__metadata("design:type", String)
|
|
84
|
+
], KpiScopePatch.prototype, "scopeType", void 0);
|
|
85
|
+
tslib_1.__decorate([
|
|
86
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true, description: 'Parent scope level if this forms a hierarchy' }),
|
|
87
|
+
tslib_1.__metadata("design:type", Number)
|
|
88
|
+
], KpiScopePatch.prototype, "parentLevel", void 0);
|
|
89
|
+
tslib_1.__decorate([
|
|
90
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'Order/priority for display and processing', defaultValue: 1 }),
|
|
91
|
+
tslib_1.__metadata("design:type", Number)
|
|
92
|
+
], KpiScopePatch.prototype, "displayOrder", void 0);
|
|
93
|
+
tslib_1.__decorate([
|
|
94
|
+
(0, type_graphql_1.Field)(type => [String], { nullable: true, description: 'List of valid values for this scope' }),
|
|
95
|
+
tslib_1.__metadata("design:type", Array)
|
|
96
|
+
], KpiScopePatch.prototype, "validValues", void 0);
|
|
97
|
+
tslib_1.__decorate([
|
|
98
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Regex pattern for validating values in this scope dimension' }),
|
|
99
|
+
tslib_1.__metadata("design:type", String)
|
|
100
|
+
], KpiScopePatch.prototype, "validationPattern", void 0);
|
|
101
|
+
tslib_1.__decorate([
|
|
102
|
+
(0, type_graphql_1.Field)({ description: 'Whether this scope definition is active and should be used', defaultValue: true }),
|
|
103
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
104
|
+
], KpiScopePatch.prototype, "active", void 0);
|
|
105
|
+
tslib_1.__decorate([
|
|
106
|
+
(0, type_graphql_1.Field)({ description: 'Whether this scope should be included in statistical calculations', defaultValue: true }),
|
|
107
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
108
|
+
], KpiScopePatch.prototype, "includeInStatistics", void 0);
|
|
109
|
+
tslib_1.__decorate([
|
|
110
|
+
(0, type_graphql_1.Field)({ description: 'Whether this scope should be displayed in dashboard visualizations', defaultValue: false }),
|
|
111
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
112
|
+
], KpiScopePatch.prototype, "showInDashboard", void 0);
|
|
113
|
+
tslib_1.__decorate([
|
|
114
|
+
(0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true, description: 'Additional metadata for this scope dimension' }),
|
|
115
|
+
tslib_1.__metadata("design:type", Object)
|
|
116
|
+
], KpiScopePatch.prototype, "metadata", void 0);
|
|
117
|
+
tslib_1.__decorate([
|
|
118
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
119
|
+
tslib_1.__metadata("design:type", String)
|
|
120
|
+
], KpiScopePatch.prototype, "cuFlag", void 0);
|
|
121
|
+
exports.KpiScopePatch = KpiScopePatch = tslib_1.__decorate([
|
|
122
|
+
(0, type_graphql_1.InputType)()
|
|
123
|
+
], KpiScopePatch);
|
|
124
|
+
let KpiScopeList = class KpiScopeList {
|
|
125
|
+
};
|
|
126
|
+
exports.KpiScopeList = KpiScopeList;
|
|
127
|
+
tslib_1.__decorate([
|
|
128
|
+
(0, type_graphql_1.Field)(type => [kpi_scope_1.KpiScope]),
|
|
129
|
+
tslib_1.__metadata("design:type", Array)
|
|
130
|
+
], KpiScopeList.prototype, "items", void 0);
|
|
131
|
+
tslib_1.__decorate([
|
|
132
|
+
(0, type_graphql_1.Field)(),
|
|
133
|
+
tslib_1.__metadata("design:type", Number)
|
|
134
|
+
], KpiScopeList.prototype, "total", void 0);
|
|
135
|
+
exports.KpiScopeList = KpiScopeList = tslib_1.__decorate([
|
|
136
|
+
(0, type_graphql_1.ObjectType)()
|
|
137
|
+
], KpiScopeList);
|
|
138
|
+
//# sourceMappingURL=kpi-scope-type.js.map
|