@things-factory/kpi 1.0.0-alpha.5 → 9.0.9
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 +74 -0
- package/client/pages/kpi/kpi-list-page.ts +97 -47
- package/client/pages/kpi/kpi-overview-sample.ts +260 -0
- package/client/pages/kpi/kpi-overview.ts +271 -0
- package/client/pages/kpi-category/kpi-category-list-page.ts +39 -50
- package/client/pages/kpi-dashboard/kpi-alert-panel.ts +114 -0
- package/client/pages/kpi-dashboard/kpi-dashboard.ts +285 -0
- package/client/pages/kpi-dashboard/kpi-grade-visualization.ts +75 -0
- package/client/pages/kpi-dashboard/kpi-history-viewer.ts +58 -0
- package/client/pages/kpi-dashboard/kpi-list-summary.ts +100 -0
- package/client/pages/kpi-dashboard/kpi-performance-summary.ts +124 -0
- package/client/pages/kpi-dashboard/kpi-value-entry.ts +78 -0
- package/client/pages/kpi-grade/kpi-grade-list-page.ts +58 -68
- package/client/pages/kpi-history/kpi-history-list-page.ts +146 -0
- package/client/pages/kpi-metric/kpi-metric-list-page.ts +67 -63
- package/client/pages/kpi-value/kpi-value-list-page.ts +73 -72
- package/client/pages/kpi-value/kpi-value-manual-entry-form.ts +168 -0
- package/client/pages/kpi-value/kpi-value-manual-entry-page.ts +173 -0
- package/client/route.ts +35 -0
- package/dist-client/pages/kpi/kpi-importer.js +16 -17
- package/dist-client/pages/kpi/kpi-importer.js.map +1 -1
- package/dist-client/pages/kpi/kpi-list-page.js +128 -68
- package/dist-client/pages/kpi/kpi-list-page.js.map +1 -1
- package/dist-client/pages/kpi/kpi-overview-sample.d.ts +36 -0
- package/dist-client/pages/kpi/kpi-overview-sample.js +264 -0
- package/dist-client/pages/kpi/kpi-overview-sample.js.map +1 -0
- package/dist-client/pages/kpi/kpi-overview.d.ts +14 -0
- package/dist-client/pages/kpi/kpi-overview.js +290 -0
- package/dist-client/pages/kpi/kpi-overview.js.map +1 -0
- package/dist-client/pages/kpi-category/kpi-category-importer.js +16 -17
- package/dist-client/pages/kpi-category/kpi-category-importer.js.map +1 -1
- package/dist-client/pages/kpi-category/kpi-category-list-page.js +70 -71
- package/dist-client/pages/kpi-category/kpi-category-list-page.js.map +1 -1
- package/dist-client/pages/kpi-dashboard/kpi-alert-panel.d.ts +18 -0
- package/dist-client/pages/kpi-dashboard/kpi-alert-panel.js +128 -0
- package/dist-client/pages/kpi-dashboard/kpi-alert-panel.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/kpi-dashboard.d.ts +24 -0
- package/dist-client/pages/kpi-dashboard/kpi-dashboard.js +305 -0
- package/dist-client/pages/kpi-dashboard/kpi-dashboard.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/kpi-grade-visualization.d.ts +12 -0
- package/dist-client/pages/kpi-dashboard/kpi-grade-visualization.js +82 -0
- package/dist-client/pages/kpi-dashboard/kpi-grade-visualization.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/kpi-history-viewer.d.ts +11 -0
- package/dist-client/pages/kpi-dashboard/kpi-history-viewer.js +65 -0
- package/dist-client/pages/kpi-dashboard/kpi-history-viewer.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/kpi-list-summary.d.ts +13 -0
- package/dist-client/pages/kpi-dashboard/kpi-list-summary.js +115 -0
- package/dist-client/pages/kpi-dashboard/kpi-list-summary.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/kpi-performance-summary.d.ts +15 -0
- package/dist-client/pages/kpi-dashboard/kpi-performance-summary.js +139 -0
- package/dist-client/pages/kpi-dashboard/kpi-performance-summary.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/kpi-value-entry.d.ts +7 -0
- package/dist-client/pages/kpi-dashboard/kpi-value-entry.js +86 -0
- package/dist-client/pages/kpi-dashboard/kpi-value-entry.js.map +1 -0
- package/dist-client/pages/kpi-grade/kpi-grade-importer.js +16 -17
- package/dist-client/pages/kpi-grade/kpi-grade-importer.js.map +1 -1
- package/dist-client/pages/kpi-grade/kpi-grade-list-page.js +89 -89
- package/dist-client/pages/kpi-grade/kpi-grade-list-page.js.map +1 -1
- package/dist-client/pages/kpi-history/kpi-history-list-page.d.ts +16 -0
- package/dist-client/pages/kpi-history/kpi-history-list-page.js +155 -0
- package/dist-client/pages/kpi-history/kpi-history-list-page.js.map +1 -0
- package/dist-client/pages/kpi-metric/kpi-metric-importer.js +16 -17
- package/dist-client/pages/kpi-metric/kpi-metric-importer.js.map +1 -1
- package/dist-client/pages/kpi-metric/kpi-metric-list-page.js +98 -84
- package/dist-client/pages/kpi-metric/kpi-metric-list-page.js.map +1 -1
- package/dist-client/pages/kpi-value/kpi-value-importer.js +16 -17
- package/dist-client/pages/kpi-value/kpi-value-importer.js.map +1 -1
- package/dist-client/pages/kpi-value/kpi-value-list-page.js +104 -93
- package/dist-client/pages/kpi-value/kpi-value-list-page.js.map +1 -1
- package/dist-client/pages/kpi-value/kpi-value-manual-entry-form.d.ts +14 -0
- package/dist-client/pages/kpi-value/kpi-value-manual-entry-form.js +201 -0
- package/dist-client/pages/kpi-value/kpi-value-manual-entry-form.js.map +1 -0
- package/dist-client/pages/kpi-value/kpi-value-manual-entry-page.d.ts +41 -0
- package/dist-client/pages/kpi-value/kpi-value-manual-entry-page.js +180 -0
- package/dist-client/pages/kpi-value/kpi-value-manual-entry-page.js.map +1 -0
- package/dist-client/route.d.ts +1 -1
- package/dist-client/route.js +27 -0
- package/dist-client/route.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/index.d.ts +2 -1
- package/dist-server/index.js +2 -1
- package/dist-server/index.js.map +1 -1
- package/dist-server/migrations/1752188906708-SeedKpiCategory.d.ts +5 -0
- package/dist-server/migrations/1752188906708-SeedKpiCategory.js +56 -0
- package/dist-server/migrations/1752188906708-SeedKpiCategory.js.map +1 -0
- package/dist-server/migrations/1752190849681-SeedKpi.d.ts +5 -0
- package/dist-server/migrations/1752190849681-SeedKpi.js +107 -0
- package/dist-server/migrations/1752190849681-SeedKpi.js.map +1 -0
- package/dist-server/migrations/1752191090459-SeedKpiGrade.d.ts +5 -0
- package/dist-server/migrations/1752191090459-SeedKpiGrade.js +271 -0
- package/dist-server/migrations/1752191090459-SeedKpiGrade.js.map +1 -0
- package/dist-server/migrations/index.d.ts +1 -0
- package/dist-server/migrations/index.js +12 -0
- package/dist-server/migrations/index.js.map +1 -0
- package/dist-server/routes.d.ts +1 -0
- package/dist-server/routes.js +48 -0
- package/dist-server/routes.js.map +1 -1
- package/dist-server/service/index.d.ts +3 -4
- package/dist-server/service/index.js +4 -6
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/kpi/aggregate-kpi.d.ts +8 -0
- package/dist-server/service/kpi/aggregate-kpi.js +88 -0
- package/dist-server/service/kpi/aggregate-kpi.js.map +1 -0
- package/dist-server/service/kpi/event-subscriber.d.ts +2 -0
- package/dist-server/service/kpi/event-subscriber.js +10 -0
- package/dist-server/service/kpi/event-subscriber.js.map +1 -1
- package/dist-server/service/kpi/index.d.ts +2 -1
- package/dist-server/service/kpi/kpi-formula.service.d.ts +24 -0
- package/dist-server/service/kpi/kpi-formula.service.js +64 -0
- package/dist-server/service/kpi/kpi-formula.service.js.map +1 -0
- package/dist-server/service/kpi/kpi-history.d.ts +6 -2
- package/dist-server/service/kpi/kpi-history.js +29 -11
- package/dist-server/service/kpi/kpi-history.js.map +1 -1
- package/dist-server/service/kpi/kpi-mutation.d.ts +2 -0
- package/dist-server/service/kpi/kpi-mutation.js +215 -10
- package/dist-server/service/kpi/kpi-mutation.js.map +1 -1
- package/dist-server/service/kpi/kpi-query.d.ts +10 -0
- package/dist-server/service/kpi/kpi-query.js +87 -3
- package/dist-server/service/kpi/kpi-query.js.map +1 -1
- package/dist-server/service/kpi/kpi-type.d.ts +14 -3
- package/dist-server/service/kpi/kpi-type.js +81 -18
- package/dist-server/service/kpi/kpi-type.js.map +1 -1
- package/dist-server/service/kpi/kpi.d.ts +14 -3
- package/dist-server/service/kpi/kpi.js +96 -19
- package/dist-server/service/kpi/kpi.js.map +1 -1
- package/dist-server/service/kpi-alert/index.d.ts +2 -0
- package/dist-server/service/kpi-alert/index.js +6 -0
- package/dist-server/service/kpi-alert/index.js.map +1 -0
- package/dist-server/service/kpi-alert/kpi-alert-query.d.ts +4 -0
- package/dist-server/service/kpi-alert/kpi-alert-query.js +71 -0
- package/dist-server/service/kpi-alert/kpi-alert-query.js.map +1 -0
- package/dist-server/service/kpi-alert/kpi-alert-type.d.ts +8 -0
- package/dist-server/service/kpi-alert/kpi-alert-type.js +33 -0
- package/dist-server/service/kpi-alert/kpi-alert-type.js.map +1 -0
- package/dist-server/service/kpi-category/kpi-category-mutation.d.ts +1 -1
- package/dist-server/service/kpi-category/kpi-category-mutation.js +36 -10
- package/dist-server/service/kpi-category/kpi-category-mutation.js.map +1 -1
- package/dist-server/service/kpi-category/kpi-category-query.d.ts +2 -0
- package/dist-server/service/kpi-category/kpi-category-query.js +18 -2
- package/dist-server/service/kpi-category/kpi-category-query.js.map +1 -1
- package/dist-server/service/kpi-category/kpi-category-type.d.ts +3 -5
- package/dist-server/service/kpi-category/kpi-category-type.js +16 -20
- package/dist-server/service/kpi-category/kpi-category-type.js.map +1 -1
- package/dist-server/service/kpi-category/kpi-category.d.ts +7 -9
- package/dist-server/service/kpi-category/kpi-category.js +40 -38
- package/dist-server/service/kpi-category/kpi-category.js.map +1 -1
- package/dist-server/service/kpi-grade/index.d.ts +1 -2
- package/dist-server/service/kpi-grade/index.js +2 -4
- package/dist-server/service/kpi-grade/index.js.map +1 -1
- package/dist-server/service/kpi-grade/kpi-grade-mutation.d.ts +1 -1
- package/dist-server/service/kpi-grade/kpi-grade-mutation.js +33 -10
- package/dist-server/service/kpi-grade/kpi-grade-mutation.js.map +1 -1
- package/dist-server/service/kpi-grade/kpi-grade-query.js +2 -2
- package/dist-server/service/kpi-grade/kpi-grade-query.js.map +1 -1
- package/dist-server/service/kpi-grade/kpi-grade-type.d.ts +13 -4
- package/dist-server/service/kpi-grade/kpi-grade-type.js +54 -18
- package/dist-server/service/kpi-grade/kpi-grade-type.js.map +1 -1
- package/dist-server/service/kpi-grade/kpi-grade.d.ts +8 -8
- package/dist-server/service/kpi-grade/kpi-grade.js +48 -40
- package/dist-server/service/kpi-grade/kpi-grade.js.map +1 -1
- package/dist-server/service/kpi-metric/aggregate-kpi-metric.d.ts +8 -0
- package/dist-server/service/kpi-metric/aggregate-kpi-metric.js +134 -0
- package/dist-server/service/kpi-metric/aggregate-kpi-metric.js.map +1 -0
- package/dist-server/service/kpi-metric/index.d.ts +1 -2
- package/dist-server/service/kpi-metric/index.js +2 -4
- package/dist-server/service/kpi-metric/index.js.map +1 -1
- package/dist-server/service/kpi-metric/kpi-metric-mutation.d.ts +1 -1
- package/dist-server/service/kpi-metric/kpi-metric-mutation.js +139 -13
- package/dist-server/service/kpi-metric/kpi-metric-mutation.js.map +1 -1
- package/dist-server/service/kpi-metric/kpi-metric-query.js +3 -3
- package/dist-server/service/kpi-metric/kpi-metric-query.js.map +1 -1
- package/dist-server/service/kpi-metric/kpi-metric-type.d.ts +17 -4
- package/dist-server/service/kpi-metric/kpi-metric-type.js +69 -11
- package/dist-server/service/kpi-metric/kpi-metric-type.js.map +1 -1
- package/dist-server/service/kpi-metric/kpi-metric.d.ts +11 -8
- package/dist-server/service/kpi-metric/kpi-metric.js +62 -37
- package/dist-server/service/kpi-metric/kpi-metric.js.map +1 -1
- package/dist-server/service/kpi-value/kpi-value-mutation.js +66 -11
- package/dist-server/service/kpi-value/kpi-value-mutation.js.map +1 -1
- package/dist-server/service/kpi-value/kpi-value-query.d.ts +2 -0
- package/dist-server/service/kpi-value/kpi-value-query.js +15 -2
- package/dist-server/service/kpi-value/kpi-value-query.js.map +1 -1
- package/dist-server/service/kpi-value/kpi-value-type.d.ts +19 -10
- package/dist-server/service/kpi-value/kpi-value-type.js +87 -24
- package/dist-server/service/kpi-value/kpi-value-type.js.map +1 -1
- package/dist-server/service/kpi-value/kpi-value.d.ts +15 -9
- package/dist-server/service/kpi-value/kpi-value.js +86 -32
- package/dist-server/service/kpi-value/kpi-value.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/implement-plan/01-entity-type-resolver.md +57 -0
- package/implement-plan/02-dataset-integration.md +35 -0
- package/implement-plan/03-kpivalue-automation.md +34 -0
- package/implement-plan/04-version-history.md +33 -0
- package/implement-plan/05-grade-visualization.md +33 -0
- package/implement-plan/06-graphql-frontend.md +30 -0
- package/implement-plan/07-test-docs.md +35 -0
- package/implement-plan/TODO.md +41 -0
- package/package.json +18 -6
- package/server/index.ts +2 -1
- package/server/migrations/1752188906708-SeedKpiCategory.ts +61 -0
- package/server/migrations/1752190849681-SeedKpi.ts +112 -0
- package/server/migrations/1752191090459-SeedKpiGrade.ts +270 -0
- package/server/migrations/index.ts +9 -0
- package/server/routes.ts +55 -0
- package/server/service/index.ts +4 -6
- package/server/service/kpi/aggregate-kpi.ts +82 -0
- package/server/service/kpi/event-subscriber.ts +12 -0
- package/server/service/kpi/kpi-formula.service.ts +63 -0
- package/server/service/kpi/kpi-history.ts +29 -21
- package/server/service/kpi/kpi-mutation.ts +194 -12
- package/server/service/kpi/kpi-query.ts +57 -2
- package/server/service/kpi/kpi-type.ts +72 -19
- package/server/service/kpi/kpi.ts +96 -20
- package/server/service/kpi-alert/index.ts +3 -0
- package/server/service/kpi-alert/kpi-alert-query.ts +59 -0
- package/server/service/kpi-alert/kpi-alert-type.ts +20 -0
- package/server/service/kpi-category/kpi-category-mutation.ts +17 -4
- package/server/service/kpi-category/kpi-category-query.ts +20 -3
- package/server/service/kpi-category/kpi-category-type.ts +17 -19
- package/server/service/kpi-category/kpi-category.ts +39 -37
- package/server/service/kpi-grade/index.ts +2 -4
- package/server/service/kpi-grade/kpi-grade-mutation.ts +13 -4
- package/server/service/kpi-grade/kpi-grade-query.ts +5 -2
- package/server/service/kpi-grade/kpi-grade-type.ts +46 -19
- package/server/service/kpi-grade/kpi-grade.ts +44 -38
- package/server/service/kpi-metric/aggregate-kpi-metric.ts +128 -0
- package/server/service/kpi-metric/index.ts +2 -4
- package/server/service/kpi-metric/kpi-metric-mutation.ts +123 -7
- package/server/service/kpi-metric/kpi-metric-query.ts +9 -3
- package/server/service/kpi-metric/kpi-metric-type.ts +56 -13
- package/server/service/kpi-metric/kpi-metric.ts +55 -35
- package/server/service/kpi-value/kpi-value-mutation.ts +52 -14
- package/server/service/kpi-value/kpi-value-query.ts +12 -2
- package/server/service/kpi-value/kpi-value-type.ts +80 -25
- package/server/service/kpi-value/kpi-value.ts +81 -29
- package/things-factory.config.js +12 -4
- package/translations/en.json +12 -1
- package/translations/ja.json +12 -1
- package/translations/ko.json +12 -1
- package/translations/ms.json +12 -1
- package/translations/zh.json +12 -1
- package/client/pages/kpe-metric/kpe-metric-importer.ts +0 -90
- package/client/pages/kpe-metric/kpe-metric-list-page.ts +0 -398
- package/client/pages/kpi-formula/kpi-formula-importer.ts +0 -90
- package/client/pages/kpi-formula/kpi-formula-list-page.ts +0 -398
- package/client/pages/metric/metric-importer.ts +0 -90
- package/client/pages/metric/metric-list-page.ts +0 -398
- package/dist-client/pages/kpe-metric/kpe-metric-importer.d.ts +0 -23
- package/dist-client/pages/kpe-metric/kpe-metric-importer.js +0 -93
- package/dist-client/pages/kpe-metric/kpe-metric-importer.js.map +0 -1
- package/dist-client/pages/kpe-metric/kpe-metric-list-page.d.ts +0 -66
- package/dist-client/pages/kpe-metric/kpe-metric-list-page.js +0 -370
- package/dist-client/pages/kpe-metric/kpe-metric-list-page.js.map +0 -1
- package/dist-client/pages/kpi-formula/kpi-formula-importer.d.ts +0 -23
- package/dist-client/pages/kpi-formula/kpi-formula-importer.js +0 -93
- package/dist-client/pages/kpi-formula/kpi-formula-importer.js.map +0 -1
- package/dist-client/pages/kpi-formula/kpi-formula-list-page.d.ts +0 -66
- package/dist-client/pages/kpi-formula/kpi-formula-list-page.js +0 -370
- package/dist-client/pages/kpi-formula/kpi-formula-list-page.js.map +0 -1
- package/dist-client/pages/metric/metric-importer.d.ts +0 -23
- package/dist-client/pages/metric/metric-importer.js +0 -93
- package/dist-client/pages/metric/metric-importer.js.map +0 -1
- package/dist-client/pages/metric/metric-list-page.d.ts +0 -66
- package/dist-client/pages/metric/metric-list-page.js +0 -370
- package/dist-client/pages/metric/metric-list-page.js.map +0 -1
- package/dist-server/service/kpi-formula/event-subscriber.d.ts +0 -7
- package/dist-server/service/kpi-formula/event-subscriber.js +0 -21
- package/dist-server/service/kpi-formula/event-subscriber.js.map +0 -1
- package/dist-server/service/kpi-formula/index.d.ts +0 -7
- package/dist-server/service/kpi-formula/index.js +0 -12
- package/dist-server/service/kpi-formula/index.js.map +0 -1
- package/dist-server/service/kpi-formula/kpi-formula-history.d.ts +0 -25
- package/dist-server/service/kpi-formula/kpi-formula-history.js +0 -128
- package/dist-server/service/kpi-formula/kpi-formula-history.js.map +0 -1
- package/dist-server/service/kpi-formula/kpi-formula-mutation.d.ts +0 -10
- package/dist-server/service/kpi-formula/kpi-formula-mutation.js +0 -128
- package/dist-server/service/kpi-formula/kpi-formula-mutation.js.map +0 -1
- package/dist-server/service/kpi-formula/kpi-formula-query.d.ts +0 -11
- package/dist-server/service/kpi-formula/kpi-formula-query.js +0 -79
- package/dist-server/service/kpi-formula/kpi-formula-query.js.map +0 -1
- package/dist-server/service/kpi-formula/kpi-formula-type.d.ts +0 -20
- package/dist-server/service/kpi-formula/kpi-formula-type.js +0 -77
- package/dist-server/service/kpi-formula/kpi-formula-type.js.map +0 -1
- package/dist-server/service/kpi-formula/kpi-formula.d.ts +0 -24
- package/dist-server/service/kpi-formula/kpi-formula.js +0 -109
- package/dist-server/service/kpi-formula/kpi-formula.js.map +0 -1
- package/dist-server/service/kpi-grade/event-subscriber.d.ts +0 -7
- package/dist-server/service/kpi-grade/event-subscriber.js +0 -21
- package/dist-server/service/kpi-grade/event-subscriber.js.map +0 -1
- package/dist-server/service/kpi-grade/kpi-grade-history.d.ts +0 -25
- package/dist-server/service/kpi-grade/kpi-grade-history.js +0 -128
- package/dist-server/service/kpi-grade/kpi-grade-history.js.map +0 -1
- package/dist-server/service/kpi-metric/event-subscriber.d.ts +0 -7
- package/dist-server/service/kpi-metric/event-subscriber.js +0 -21
- package/dist-server/service/kpi-metric/event-subscriber.js.map +0 -1
- package/dist-server/service/kpi-metric/kpi-metric-history.d.ts +0 -25
- package/dist-server/service/kpi-metric/kpi-metric-history.js +0 -128
- package/dist-server/service/kpi-metric/kpi-metric-history.js.map +0 -1
- package/server/service/kpi-formula/event-subscriber.ts +0 -17
- package/server/service/kpi-formula/index.ts +0 -9
- package/server/service/kpi-formula/kpi-formula-history.ts +0 -116
- package/server/service/kpi-formula/kpi-formula-mutation.ts +0 -137
- package/server/service/kpi-formula/kpi-formula-query.ts +0 -48
- package/server/service/kpi-formula/kpi-formula-type.ts +0 -55
- package/server/service/kpi-formula/kpi-formula.ts +0 -95
- package/server/service/kpi-grade/event-subscriber.ts +0 -17
- package/server/service/kpi-grade/kpi-grade-history.ts +0 -116
- package/server/service/kpi-metric/event-subscriber.ts +0 -17
- package/server/service/kpi-metric/kpi-metric-history.ts +0 -116
|
@@ -4,70 +4,133 @@ exports.KpiList = exports.KpiPatch = exports.NewKpi = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const GraphQLUpload_js_1 = tslib_1.__importDefault(require("graphql-upload/GraphQLUpload.js"));
|
|
6
6
|
const type_graphql_1 = require("type-graphql");
|
|
7
|
+
const shell_1 = require("@things-factory/shell");
|
|
7
8
|
const kpi_1 = require("./kpi");
|
|
8
9
|
let NewKpi = class NewKpi {
|
|
9
10
|
};
|
|
10
11
|
exports.NewKpi = NewKpi;
|
|
11
12
|
tslib_1.__decorate([
|
|
12
|
-
(0, type_graphql_1.Field)(),
|
|
13
|
+
(0, type_graphql_1.Field)({ description: 'Name of the KPI.' }),
|
|
13
14
|
tslib_1.__metadata("design:type", String)
|
|
14
15
|
], NewKpi.prototype, "name", void 0);
|
|
15
16
|
tslib_1.__decorate([
|
|
16
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
17
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Detailed description of the KPI.' }),
|
|
17
18
|
tslib_1.__metadata("design:type", String)
|
|
18
19
|
], NewKpi.prototype, "description", void 0);
|
|
19
20
|
tslib_1.__decorate([
|
|
20
|
-
(0, type_graphql_1.Field)(type =>
|
|
21
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true, description: 'ID of the category to which this KPI belongs.' }),
|
|
21
22
|
tslib_1.__metadata("design:type", String)
|
|
22
|
-
], NewKpi.prototype, "
|
|
23
|
+
], NewKpi.prototype, "categoryId", void 0);
|
|
24
|
+
tslib_1.__decorate([
|
|
25
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Calculation formula for the KPI, using metric codes and operators.' }),
|
|
26
|
+
tslib_1.__metadata("design:type", String)
|
|
27
|
+
], NewKpi.prototype, "formula", void 0);
|
|
23
28
|
tslib_1.__decorate([
|
|
24
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
29
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Indicates whether this KPI is active and usable.' }),
|
|
25
30
|
tslib_1.__metadata("design:type", Boolean)
|
|
26
31
|
], NewKpi.prototype, "active", void 0);
|
|
27
32
|
tslib_1.__decorate([
|
|
28
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
33
|
+
(0, type_graphql_1.Field)(type => kpi_1.KpiStatus, { nullable: true, description: 'Current state of the KPI (DRAFT, RELEASED, ARCHIVED).' }),
|
|
29
34
|
tslib_1.__metadata("design:type", String)
|
|
30
|
-
], NewKpi.prototype, "
|
|
35
|
+
], NewKpi.prototype, "state", void 0);
|
|
31
36
|
tslib_1.__decorate([
|
|
32
|
-
(0, type_graphql_1.Field)(type => GraphQLUpload_js_1.default, { nullable: true }),
|
|
37
|
+
(0, type_graphql_1.Field)(type => GraphQLUpload_js_1.default, { nullable: true, description: 'Thumbnail image or file for this KPI.' }),
|
|
33
38
|
tslib_1.__metadata("design:type", Object)
|
|
34
39
|
], NewKpi.prototype, "thumbnail", void 0);
|
|
40
|
+
tslib_1.__decorate([
|
|
41
|
+
(0, type_graphql_1.Field)({
|
|
42
|
+
nullable: true,
|
|
43
|
+
description: 'Visualization type for this KPI (e.g., bar, line, gauge, progress, card, table, icon, badge, text).'
|
|
44
|
+
}),
|
|
45
|
+
tslib_1.__metadata("design:type", String)
|
|
46
|
+
], NewKpi.prototype, "vizType", void 0);
|
|
47
|
+
tslib_1.__decorate([
|
|
48
|
+
(0, type_graphql_1.Field)(type => shell_1.ScalarObject, {
|
|
49
|
+
nullable: true,
|
|
50
|
+
description: 'Visualization options and metadata for this KPI, such as color, icon, thresholds, unit, decimal places, etc.'
|
|
51
|
+
}),
|
|
52
|
+
tslib_1.__metadata("design:type", Object)
|
|
53
|
+
], NewKpi.prototype, "vizMeta", void 0);
|
|
54
|
+
tslib_1.__decorate([
|
|
55
|
+
(0, type_graphql_1.Field)({
|
|
56
|
+
nullable: true,
|
|
57
|
+
description: 'Cron schedule string for periodic KPI value aggregation (e.g., "0 0 * * *" for daily).'
|
|
58
|
+
}),
|
|
59
|
+
tslib_1.__metadata("design:type", String)
|
|
60
|
+
], NewKpi.prototype, "schedule", void 0);
|
|
61
|
+
tslib_1.__decorate([
|
|
62
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Timezone for the KPI schedule.' }),
|
|
63
|
+
tslib_1.__metadata("design:type", String)
|
|
64
|
+
], NewKpi.prototype, "timezone", void 0);
|
|
35
65
|
exports.NewKpi = NewKpi = tslib_1.__decorate([
|
|
36
|
-
(0, type_graphql_1.InputType)()
|
|
66
|
+
(0, type_graphql_1.InputType)({ description: 'Input type for creating a new KPI. Used in mutations to provide KPI details.' })
|
|
37
67
|
], NewKpi);
|
|
38
68
|
let KpiPatch = class KpiPatch {
|
|
39
69
|
};
|
|
40
70
|
exports.KpiPatch = KpiPatch;
|
|
41
71
|
tslib_1.__decorate([
|
|
42
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
|
|
72
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true, description: 'ID of the KPI to update.' }),
|
|
43
73
|
tslib_1.__metadata("design:type", String)
|
|
44
74
|
], KpiPatch.prototype, "id", void 0);
|
|
45
75
|
tslib_1.__decorate([
|
|
46
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
76
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Name of the KPI.' }),
|
|
47
77
|
tslib_1.__metadata("design:type", String)
|
|
48
78
|
], KpiPatch.prototype, "name", void 0);
|
|
49
79
|
tslib_1.__decorate([
|
|
50
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
80
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Detailed description of the KPI.' }),
|
|
51
81
|
tslib_1.__metadata("design:type", String)
|
|
52
82
|
], KpiPatch.prototype, "description", void 0);
|
|
53
83
|
tslib_1.__decorate([
|
|
54
|
-
(0, type_graphql_1.Field)(type =>
|
|
84
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true, description: 'ID of the category to which this KPI belongs.' }),
|
|
55
85
|
tslib_1.__metadata("design:type", String)
|
|
56
|
-
], KpiPatch.prototype, "
|
|
86
|
+
], KpiPatch.prototype, "categoryId", void 0);
|
|
57
87
|
tslib_1.__decorate([
|
|
58
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
88
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Calculation formula for the KPI, using metric codes and operators.' }),
|
|
89
|
+
tslib_1.__metadata("design:type", String)
|
|
90
|
+
], KpiPatch.prototype, "formula", void 0);
|
|
91
|
+
tslib_1.__decorate([
|
|
92
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Indicates whether this KPI is active and usable.' }),
|
|
59
93
|
tslib_1.__metadata("design:type", Boolean)
|
|
60
94
|
], KpiPatch.prototype, "active", void 0);
|
|
61
95
|
tslib_1.__decorate([
|
|
62
|
-
(0, type_graphql_1.Field)(type =>
|
|
96
|
+
(0, type_graphql_1.Field)(type => kpi_1.KpiStatus, { nullable: true, description: 'Current state of the KPI (DRAFT, RELEASED, ARCHIVED).' }),
|
|
97
|
+
tslib_1.__metadata("design:type", String)
|
|
98
|
+
], KpiPatch.prototype, "state", void 0);
|
|
99
|
+
tslib_1.__decorate([
|
|
100
|
+
(0, type_graphql_1.Field)(type => GraphQLUpload_js_1.default, { nullable: true, description: 'Thumbnail image or file for this KPI.' }),
|
|
63
101
|
tslib_1.__metadata("design:type", Object)
|
|
64
102
|
], KpiPatch.prototype, "thumbnail", void 0);
|
|
65
103
|
tslib_1.__decorate([
|
|
66
|
-
(0, type_graphql_1.Field)({
|
|
104
|
+
(0, type_graphql_1.Field)({
|
|
105
|
+
nullable: true,
|
|
106
|
+
description: 'Visualization type for this KPI (e.g., bar, line, gauge, progress, card, table, icon, badge, text).'
|
|
107
|
+
}),
|
|
108
|
+
tslib_1.__metadata("design:type", String)
|
|
109
|
+
], KpiPatch.prototype, "vizType", void 0);
|
|
110
|
+
tslib_1.__decorate([
|
|
111
|
+
(0, type_graphql_1.Field)(type => shell_1.ScalarObject, {
|
|
112
|
+
nullable: true,
|
|
113
|
+
description: 'Visualization options and metadata for this KPI, such as color, icon, thresholds, unit, decimal places, etc.'
|
|
114
|
+
}),
|
|
115
|
+
tslib_1.__metadata("design:type", Object)
|
|
116
|
+
], KpiPatch.prototype, "vizMeta", void 0);
|
|
117
|
+
tslib_1.__decorate([
|
|
118
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Custom flag for update operations (internal use).' }),
|
|
67
119
|
tslib_1.__metadata("design:type", String)
|
|
68
120
|
], KpiPatch.prototype, "cuFlag", void 0);
|
|
121
|
+
tslib_1.__decorate([
|
|
122
|
+
(0, type_graphql_1.Field)({
|
|
123
|
+
nullable: true,
|
|
124
|
+
description: 'Cron schedule string for periodic KPI value aggregation (e.g., "0 0 * * *" for daily).'
|
|
125
|
+
}),
|
|
126
|
+
tslib_1.__metadata("design:type", String)
|
|
127
|
+
], KpiPatch.prototype, "schedule", void 0);
|
|
128
|
+
tslib_1.__decorate([
|
|
129
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Timezone for the KPI schedule.' }),
|
|
130
|
+
tslib_1.__metadata("design:type", String)
|
|
131
|
+
], KpiPatch.prototype, "timezone", void 0);
|
|
69
132
|
exports.KpiPatch = KpiPatch = tslib_1.__decorate([
|
|
70
|
-
(0, type_graphql_1.InputType)()
|
|
133
|
+
(0, type_graphql_1.InputType)({ description: 'Input type for updating an existing KPI. Used in mutations to patch KPI details.' })
|
|
71
134
|
], KpiPatch);
|
|
72
135
|
let KpiList = class KpiList {
|
|
73
136
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kpi-type.js","sourceRoot":"","sources":["../../../server/service/kpi/kpi-type.ts"],"names":[],"mappings":";;;;AACA,+FAA2D;AAC3D,+CAAsF;
|
|
1
|
+
{"version":3,"file":"kpi-type.js","sourceRoot":"","sources":["../../../server/service/kpi/kpi-type.ts"],"names":[],"mappings":";;;;AACA,+FAA2D;AAC3D,+CAAsF;AAEtF,iDAA+D;AAE/D,+BAAsC;AAG/B,IAAM,MAAM,GAAZ,MAAM,MAAM;CA2ClB,CAAA;AA3CY,wBAAM;AAEjB;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC;;oCAC/B;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;;2CACvD;AAGpB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,+CAA+C,EAAE,CAAC;;0CACjF;AAGnB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,oEAAoE,EAAE,CAAC;;uCAC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EAAE,IAAI,EAAE,WAAW,EAAE,gCAAgC,EAAE,CAAC;;0CACxD;mBAhDN,QAAQ;IADpB,IAAA,wBAAS,EAAC,EAAE,WAAW,EAAE,kFAAkF,EAAE,CAAC;GAClG,QAAQ,CAiDpB;AAGM,IAAM,OAAO,GAAb,MAAM,OAAO;CAMnB,CAAA;AANY,0BAAO;AAElB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,SAAG,CAAC,CAAC;;sCACT;AAGZ;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;sCACN;kBALF,OAAO;IADnB,IAAA,yBAAU,GAAE;GACA,OAAO,CAMnB","sourcesContent":["import type { FileUpload } from 'graphql-upload/GraphQLUpload.js'\nimport GraphQLUpload from 'graphql-upload/GraphQLUpload.js'\nimport { ObjectType, Field, InputType, Int, ID, registerEnumType } from 'type-graphql'\n\nimport { ObjectRef, ScalarObject } from '@things-factory/shell'\n\nimport { Kpi, KpiStatus } from './kpi'\n\n@InputType({ description: 'Input type for creating a new KPI. Used in mutations to provide KPI details.' })\nexport class NewKpi {\n @Field({ description: 'Name of the KPI.' })\n name: string\n\n @Field({ nullable: true, description: 'Detailed description of the KPI.' })\n description?: string\n\n @Field(type => ID, { nullable: true, description: 'ID of the category to which this KPI belongs.' })\n categoryId?: string\n\n @Field({ nullable: true, description: 'Calculation formula for the KPI, using metric codes and operators.' })\n formula?: string\n\n @Field({ nullable: true, description: 'Indicates whether this KPI is active and usable.' })\n active?: boolean\n\n @Field(type => KpiStatus, { nullable: true, description: 'Current state of the KPI (DRAFT, RELEASED, ARCHIVED).' })\n state?: KpiStatus\n\n @Field(type => GraphQLUpload, { nullable: true, description: 'Thumbnail image or file for this KPI.' })\n thumbnail?: FileUpload\n\n @Field({\n nullable: true,\n description: 'Visualization type for this KPI (e.g., bar, line, gauge, progress, card, table, icon, badge, text).'\n })\n vizType?: string\n\n @Field(type => ScalarObject, {\n nullable: true,\n description:\n 'Visualization options and metadata for this KPI, such as color, icon, thresholds, unit, decimal places, etc.'\n })\n vizMeta?: any\n\n @Field({\n nullable: true,\n description: 'Cron schedule string for periodic KPI value aggregation (e.g., \"0 0 * * *\" for daily).'\n })\n schedule?: string\n\n @Field({ nullable: true, description: 'Timezone for the KPI schedule.' })\n timezone?: string\n}\n\n@InputType({ description: 'Input type for updating an existing KPI. Used in mutations to patch KPI details.' })\nexport class KpiPatch {\n @Field(type => ID, { nullable: true, description: 'ID of the KPI to update.' })\n id?: string\n\n @Field({ nullable: true, description: 'Name of the KPI.' })\n name?: string\n\n @Field({ nullable: true, description: 'Detailed description of the KPI.' })\n description?: string\n\n @Field(type => ID, { nullable: true, description: 'ID of the category to which this KPI belongs.' })\n categoryId?: string\n\n @Field({ nullable: true, description: 'Calculation formula for the KPI, using metric codes and operators.' })\n formula?: string\n\n @Field({ nullable: true, description: 'Indicates whether this KPI is active and usable.' })\n active?: boolean\n\n @Field(type => KpiStatus, { nullable: true, description: 'Current state of the KPI (DRAFT, RELEASED, ARCHIVED).' })\n state?: KpiStatus\n\n @Field(type => GraphQLUpload, { nullable: true, description: 'Thumbnail image or file for this KPI.' })\n thumbnail?: FileUpload\n\n @Field({\n nullable: true,\n description: 'Visualization type for this KPI (e.g., bar, line, gauge, progress, card, table, icon, badge, text).'\n })\n vizType?: string\n\n @Field(type => ScalarObject, {\n nullable: true,\n description:\n 'Visualization options and metadata for this KPI, such as color, icon, thresholds, unit, decimal places, etc.'\n })\n vizMeta?: any\n\n @Field({ nullable: true, description: 'Custom flag for update operations (internal use).' })\n cuFlag?: string\n\n @Field({\n nullable: true,\n description: 'Cron schedule string for periodic KPI value aggregation (e.g., \"0 0 * * *\" for daily).'\n })\n schedule?: string\n\n @Field({ nullable: true, description: 'Timezone for the KPI schedule.' })\n timezone?: string\n}\n\n@ObjectType()\nexport class KpiList {\n @Field(type => [Kpi])\n items: Kpi[]\n\n @Field(type => Int)\n total: number\n}\n"]}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { Domain } from '@things-factory/shell';
|
|
2
2
|
import { User } from '@things-factory/auth-base';
|
|
3
|
+
import { KpiCategory } from '../kpi-category/kpi-category';
|
|
4
|
+
import { KpiGrade } from '../kpi-grade/kpi-grade';
|
|
3
5
|
export declare enum KpiStatus {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
DRAFT = "DRAFT",
|
|
7
|
+
RELEASE = "RELEASE",
|
|
8
|
+
ARCHIVED = "ARCHIVED"
|
|
6
9
|
}
|
|
7
10
|
export declare class Kpi {
|
|
8
11
|
readonly id: string;
|
|
@@ -11,9 +14,16 @@ export declare class Kpi {
|
|
|
11
14
|
domainId?: string;
|
|
12
15
|
name?: string;
|
|
13
16
|
description?: string;
|
|
17
|
+
category?: KpiCategory;
|
|
18
|
+
categoryId?: string;
|
|
19
|
+
formula?: string;
|
|
14
20
|
active?: boolean;
|
|
15
21
|
state?: KpiStatus;
|
|
16
|
-
|
|
22
|
+
vizType?: string;
|
|
23
|
+
vizMeta?: any;
|
|
24
|
+
schedule?: string;
|
|
25
|
+
scheduleId?: string;
|
|
26
|
+
timezone?: string;
|
|
17
27
|
createdAt?: Date;
|
|
18
28
|
updatedAt?: Date;
|
|
19
29
|
deletedAt?: Date;
|
|
@@ -22,4 +32,5 @@ export declare class Kpi {
|
|
|
22
32
|
updater?: User;
|
|
23
33
|
updaterId?: string;
|
|
24
34
|
thumbnail?: string;
|
|
35
|
+
grades?: KpiGrade[];
|
|
25
36
|
}
|
|
@@ -6,14 +6,21 @@ const typeorm_1 = require("typeorm");
|
|
|
6
6
|
const type_graphql_1 = require("type-graphql");
|
|
7
7
|
const shell_1 = require("@things-factory/shell");
|
|
8
8
|
const auth_base_1 = require("@things-factory/auth-base");
|
|
9
|
+
const kpi_category_1 = require("../kpi-category/kpi-category");
|
|
10
|
+
const kpi_grade_1 = require("../kpi-grade/kpi-grade");
|
|
11
|
+
const env_1 = require("@things-factory/env");
|
|
12
|
+
const shell_2 = require("@things-factory/shell");
|
|
13
|
+
const ORMCONFIG = env_1.config.get('ormconfig', {});
|
|
14
|
+
const DATABASE_TYPE = ORMCONFIG.type;
|
|
9
15
|
var KpiStatus;
|
|
10
16
|
(function (KpiStatus) {
|
|
11
|
-
KpiStatus["
|
|
12
|
-
KpiStatus["
|
|
17
|
+
KpiStatus["DRAFT"] = "DRAFT";
|
|
18
|
+
KpiStatus["RELEASE"] = "RELEASE";
|
|
19
|
+
KpiStatus["ARCHIVED"] = "ARCHIVED";
|
|
13
20
|
})(KpiStatus || (exports.KpiStatus = KpiStatus = {}));
|
|
14
21
|
(0, type_graphql_1.registerEnumType)(KpiStatus, {
|
|
15
22
|
name: 'KpiStatus',
|
|
16
|
-
description: '
|
|
23
|
+
description: 'State enumeration of a KPI (DRAFT, RELEASED, ARCHIVED)'
|
|
17
24
|
});
|
|
18
25
|
let Kpi = class Kpi {
|
|
19
26
|
constructor() {
|
|
@@ -23,91 +30,161 @@ let Kpi = class Kpi {
|
|
|
23
30
|
exports.Kpi = Kpi;
|
|
24
31
|
tslib_1.__decorate([
|
|
25
32
|
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
26
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
|
33
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { description: 'Unique identifier for this KPI.' }),
|
|
27
34
|
tslib_1.__metadata("design:type", String)
|
|
28
35
|
], Kpi.prototype, "id", void 0);
|
|
29
36
|
tslib_1.__decorate([
|
|
30
37
|
(0, typeorm_1.VersionColumn)(),
|
|
31
|
-
(0, type_graphql_1.Field)({
|
|
38
|
+
(0, type_graphql_1.Field)({
|
|
39
|
+
nullable: true,
|
|
40
|
+
description: 'Version number of the KPI. Increments on each modification. When the KPI is released, a snapshot is saved in kpi-history and the status becomes RELEASED. Editing after release increases the version and sets status to DRAFT.'
|
|
41
|
+
}),
|
|
32
42
|
tslib_1.__metadata("design:type", Number)
|
|
33
43
|
], Kpi.prototype, "version", void 0);
|
|
34
44
|
tslib_1.__decorate([
|
|
35
45
|
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
|
36
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
46
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Domain (tenant) to which this KPI belongs.' }),
|
|
37
47
|
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
38
48
|
], Kpi.prototype, "domain", void 0);
|
|
39
49
|
tslib_1.__decorate([
|
|
40
50
|
(0, typeorm_1.RelationId)((kpi) => kpi.domain),
|
|
51
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'ID of the domain (tenant) for this KPI.' }),
|
|
41
52
|
tslib_1.__metadata("design:type", String)
|
|
42
53
|
], Kpi.prototype, "domainId", void 0);
|
|
43
54
|
tslib_1.__decorate([
|
|
44
55
|
(0, typeorm_1.Column)(),
|
|
45
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
56
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Name of the KPI.' }),
|
|
46
57
|
tslib_1.__metadata("design:type", String)
|
|
47
58
|
], Kpi.prototype, "name", void 0);
|
|
48
59
|
tslib_1.__decorate([
|
|
49
60
|
(0, typeorm_1.Column)({ nullable: true }),
|
|
50
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
61
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Detailed description of the KPI.' }),
|
|
51
62
|
tslib_1.__metadata("design:type", String)
|
|
52
63
|
], Kpi.prototype, "description", void 0);
|
|
64
|
+
tslib_1.__decorate([
|
|
65
|
+
(0, typeorm_1.ManyToOne)(() => kpi_category_1.KpiCategory, { nullable: true }),
|
|
66
|
+
(0, type_graphql_1.Field)(type => kpi_category_1.KpiCategory, { nullable: true, description: 'Category to which this KPI belongs.' }),
|
|
67
|
+
tslib_1.__metadata("design:type", kpi_category_1.KpiCategory)
|
|
68
|
+
], Kpi.prototype, "category", void 0);
|
|
69
|
+
tslib_1.__decorate([
|
|
70
|
+
(0, typeorm_1.RelationId)((kpi) => kpi.category),
|
|
71
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'ID of the category for this KPI.' }),
|
|
72
|
+
tslib_1.__metadata("design:type", String)
|
|
73
|
+
], Kpi.prototype, "categoryId", void 0);
|
|
74
|
+
tslib_1.__decorate([
|
|
75
|
+
(0, typeorm_1.Column)({
|
|
76
|
+
nullable: true,
|
|
77
|
+
type: DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
|
|
78
|
+
? 'longtext'
|
|
79
|
+
: DATABASE_TYPE == 'oracle'
|
|
80
|
+
? 'clob'
|
|
81
|
+
: DATABASE_TYPE == 'mssql'
|
|
82
|
+
? 'nvarchar'
|
|
83
|
+
: 'varchar',
|
|
84
|
+
length: DATABASE_TYPE == 'mssql' ? 'MAX' : undefined
|
|
85
|
+
}),
|
|
86
|
+
(0, type_graphql_1.Field)({
|
|
87
|
+
nullable: true,
|
|
88
|
+
description: 'Calculation formula for the KPI. Expressed as a string using metric codes and operators, e.g., "defect_count / total_count * 100".'
|
|
89
|
+
}),
|
|
90
|
+
tslib_1.__metadata("design:type", String)
|
|
91
|
+
], Kpi.prototype, "formula", void 0);
|
|
53
92
|
tslib_1.__decorate([
|
|
54
93
|
(0, typeorm_1.Column)({ nullable: false, default: false }),
|
|
55
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
94
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Indicates whether this KPI is active and usable.' }),
|
|
56
95
|
tslib_1.__metadata("design:type", Boolean)
|
|
57
96
|
], Kpi.prototype, "active", void 0);
|
|
58
97
|
tslib_1.__decorate([
|
|
59
98
|
(0, typeorm_1.Column)({ nullable: true }),
|
|
60
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
99
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Current state of the KPI (DRAFT, RELEASED, ARCHIVED).' }),
|
|
61
100
|
tslib_1.__metadata("design:type", String)
|
|
62
101
|
], Kpi.prototype, "state", void 0);
|
|
63
102
|
tslib_1.__decorate([
|
|
64
103
|
(0, typeorm_1.Column)({ nullable: true }),
|
|
65
|
-
(0, type_graphql_1.Field)({
|
|
104
|
+
(0, type_graphql_1.Field)({
|
|
105
|
+
nullable: true,
|
|
106
|
+
description: 'Visualization type for this KPI (e.g., bar, line, gauge, progress, card, table, icon, badge, text).'
|
|
107
|
+
}),
|
|
66
108
|
tslib_1.__metadata("design:type", String)
|
|
67
|
-
], Kpi.prototype, "
|
|
109
|
+
], Kpi.prototype, "vizType", void 0);
|
|
110
|
+
tslib_1.__decorate([
|
|
111
|
+
(0, typeorm_1.Column)({ type: 'json', nullable: true }),
|
|
112
|
+
(0, type_graphql_1.Field)(type => shell_2.ScalarObject, {
|
|
113
|
+
nullable: true,
|
|
114
|
+
description: 'Visualization options and metadata for this KPI, such as color, icon, thresholds, unit, decimal places, etc.'
|
|
115
|
+
}),
|
|
116
|
+
tslib_1.__metadata("design:type", Object)
|
|
117
|
+
], Kpi.prototype, "vizMeta", void 0);
|
|
118
|
+
tslib_1.__decorate([
|
|
119
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
120
|
+
(0, type_graphql_1.Field)({
|
|
121
|
+
nullable: true,
|
|
122
|
+
description: 'Cron schedule string for periodic KPI value aggregation (e.g., "0 0 * * *" for daily).'
|
|
123
|
+
}),
|
|
124
|
+
tslib_1.__metadata("design:type", String)
|
|
125
|
+
], Kpi.prototype, "schedule", void 0);
|
|
126
|
+
tslib_1.__decorate([
|
|
127
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
128
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Schedule ID for the KPI (used for scheduler registration).' }),
|
|
129
|
+
tslib_1.__metadata("design:type", String)
|
|
130
|
+
], Kpi.prototype, "scheduleId", void 0);
|
|
131
|
+
tslib_1.__decorate([
|
|
132
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
133
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Timezone for the KPI schedule.' }),
|
|
134
|
+
tslib_1.__metadata("design:type", String)
|
|
135
|
+
], Kpi.prototype, "timezone", void 0);
|
|
68
136
|
tslib_1.__decorate([
|
|
69
137
|
(0, typeorm_1.CreateDateColumn)(),
|
|
70
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
138
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Timestamp when this KPI was created.' }),
|
|
71
139
|
tslib_1.__metadata("design:type", Date)
|
|
72
140
|
], Kpi.prototype, "createdAt", void 0);
|
|
73
141
|
tslib_1.__decorate([
|
|
74
142
|
(0, typeorm_1.UpdateDateColumn)(),
|
|
75
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
143
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Timestamp when this KPI was last updated.' }),
|
|
76
144
|
tslib_1.__metadata("design:type", Date)
|
|
77
145
|
], Kpi.prototype, "updatedAt", void 0);
|
|
78
146
|
tslib_1.__decorate([
|
|
79
147
|
(0, typeorm_1.DeleteDateColumn)(),
|
|
80
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
148
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Timestamp when this KPI was deleted (soft delete).' }),
|
|
81
149
|
tslib_1.__metadata("design:type", Date)
|
|
82
150
|
], Kpi.prototype, "deletedAt", void 0);
|
|
83
151
|
tslib_1.__decorate([
|
|
84
152
|
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
85
|
-
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
|
153
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'User who created this KPI.' }),
|
|
86
154
|
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
87
155
|
], Kpi.prototype, "creator", void 0);
|
|
88
156
|
tslib_1.__decorate([
|
|
89
157
|
(0, typeorm_1.RelationId)((kpi) => kpi.creator),
|
|
158
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'ID of the user who created this KPI.' }),
|
|
90
159
|
tslib_1.__metadata("design:type", String)
|
|
91
160
|
], Kpi.prototype, "creatorId", void 0);
|
|
92
161
|
tslib_1.__decorate([
|
|
93
162
|
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
94
|
-
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
|
163
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'User who last updated this KPI.' }),
|
|
95
164
|
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
96
165
|
], Kpi.prototype, "updater", void 0);
|
|
97
166
|
tslib_1.__decorate([
|
|
98
167
|
(0, typeorm_1.RelationId)((kpi) => kpi.updater),
|
|
168
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'ID of the user who last updated this KPI.' }),
|
|
99
169
|
tslib_1.__metadata("design:type", String)
|
|
100
170
|
], Kpi.prototype, "updaterId", void 0);
|
|
101
171
|
tslib_1.__decorate([
|
|
102
|
-
(0, type_graphql_1.Field)(type => String, { nullable: true }),
|
|
172
|
+
(0, type_graphql_1.Field)(type => String, { nullable: true, description: 'Thumbnail image or file path for this KPI.' }),
|
|
103
173
|
tslib_1.__metadata("design:type", String)
|
|
104
174
|
], Kpi.prototype, "thumbnail", void 0);
|
|
175
|
+
tslib_1.__decorate([
|
|
176
|
+
(0, typeorm_1.OneToMany)(type => kpi_grade_1.KpiGrade, kpiGrade => kpiGrade.kpi),
|
|
177
|
+
(0, type_graphql_1.Field)(type => [kpi_grade_1.KpiGrade], { nullable: true, description: 'List of grades for this KPI.' }),
|
|
178
|
+
tslib_1.__metadata("design:type", Array)
|
|
179
|
+
], Kpi.prototype, "grades", void 0);
|
|
105
180
|
exports.Kpi = Kpi = tslib_1.__decorate([
|
|
106
181
|
(0, typeorm_1.Entity)(),
|
|
107
182
|
(0, typeorm_1.Index)('ix_kpi_0', (kpi) => [kpi.domain, kpi.name], {
|
|
108
183
|
where: '"deleted_at" IS NULL',
|
|
109
184
|
unique: true
|
|
110
185
|
}),
|
|
111
|
-
(0, type_graphql_1.ObjectType)({
|
|
186
|
+
(0, type_graphql_1.ObjectType)({
|
|
187
|
+
description: 'KPI entity. Represents a key performance indicator with calculation formula, target, category, and other attributes.'
|
|
188
|
+
})
|
|
112
189
|
], Kpi);
|
|
113
190
|
//# sourceMappingURL=kpi.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kpi.js","sourceRoot":"","sources":["../../../server/service/kpi/kpi.ts"],"names":[],"mappings":";;;;AAAA,qCAWgB;AAChB,+CAA2E;AAE3E,iDAA8C;AAC9C,yDAAgD;AAEhD,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,kCAAqB,CAAA;IACrB,kCAAqB,CAAA;AACvB,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB;AAED,IAAA,+BAAgB,EAAC,SAAS,EAAE;IAC1B,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,4BAA4B;CAC1C,CAAC,CAAA;AAQK,IAAM,GAAG,GAAT,MAAM,GAAG;IAAT;QAOL,YAAO,GAAY,CAAC,CAAA;IAyDtB,CAAC;CAAA,CAAA;AAhEY,kBAAG;AAGL;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;+BACC;AAInB;IAFC,IAAA,uBAAa,GAAE;IACf,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;oCACN;AAIpB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IACzB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACjB,cAAM;mCAAA;AAGf;IADC,IAAA,oBAAU,EAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC;;qCACpB;AAIjB;IAFC,IAAA,gBAA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oCAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC;;sCACpB;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,CAAC;sCAC9B,gBAAI;oCAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC;;sCACpB;AAGlB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;sCACxB;cA/DP,GAAG;IANf,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,UAAU,EAAE,CAAC,GAAQ,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC,EAAE;QACvD,KAAK,EAAE,sBAAsB;QAC7B,MAAM,EAAE,IAAI;KACb,CAAC;IACD,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,gBAAgB,EAAE,CAAC;GACjC,GAAG,CAgEf","sourcesContent":["import {\n CreateDateColumn,\n UpdateDateColumn,\n DeleteDateColumn,\n Entity,\n Index,\n Column,\n RelationId,\n ManyToOne,\n VersionColumn,\n PrimaryGeneratedColumn\n} from 'typeorm'\nimport { ObjectType, Field, Int, ID, registerEnumType } from 'type-graphql'\n\nimport { Domain } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\n\nexport enum KpiStatus {\n STATUS_A = 'STATUS_A',\n STATUS_B = 'STATUS_B'\n}\n\nregisterEnumType(KpiStatus, {\n name: 'KpiStatus',\n description: 'state enumeration of a kpi'\n})\n\n@Entity()\n@Index('ix_kpi_0', (kpi: Kpi) => [kpi.domain, kpi.name], {\n where: '\"deleted_at\" IS NULL',\n unique: true\n})\n@ObjectType({ description: 'Entity for Kpi' })\nexport class Kpi {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n \n @VersionColumn()\n @Field({ nullable: true })\n version?: number = 1\n\n @ManyToOne(type => Domain)\n @Field({ nullable: true })\n domain?: Domain\n\n @RelationId((kpi: Kpi) => kpi.domain)\n domainId?: string\n\n @Column()\n @Field({ nullable: true })\n name?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n description?: string\n\n @Column({ nullable: false, default: false })\n @Field({ nullable: true })\n active?: boolean\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n state?: KpiStatus\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n params?: string\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt?: Date\n\n @DeleteDateColumn()\n @Field({ nullable: true })\n deletedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n creator?: User\n\n @RelationId((kpi: Kpi) => kpi.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((kpi: Kpi) => kpi.updater)\n updaterId?: string\n\n @Field(type => String, { nullable: true })\n thumbnail?: string\n}\n"]}
|
|
1
|
+
{"version":3,"file":"kpi.js","sourceRoot":"","sources":["../../../server/service/kpi/kpi.ts"],"names":[],"mappings":";;;;AAAA,qCAYgB;AAChB,+CAA2E;AAE3E,iDAA8C;AAC9C,yDAAgD;AAChD,+DAA0D;AAC1D,sDAAiD;AACjD,6CAA4C;AAC5C,iDAAoD;AAEpD,MAAM,SAAS,GAAG,YAAM,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;AAC7C,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAA;AAEpC,IAAY,SA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,IAAI,CAAC,EAAE,CAAC,oBAAQ,EAAE,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC;IACrD,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,oBAAQ,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,8BAA8B,EAAE,CAAC;;mCACxE;cA/HR,GAAG;IATf,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,UAAU,EAAE,CAAC,GAAQ,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC,EAAE;QACvD,KAAK,EAAE,sBAAsB;QAC7B,MAAM,EAAE,IAAI;KACb,CAAC;IACD,IAAA,yBAAU,EAAC;QACV,WAAW,EACT,sHAAsH;KACzH,CAAC;GACW,GAAG,CAgIf","sourcesContent":["import {\n CreateDateColumn,\n UpdateDateColumn,\n DeleteDateColumn,\n Entity,\n Index,\n Column,\n RelationId,\n ManyToOne,\n OneToMany,\n VersionColumn,\n PrimaryGeneratedColumn\n} from 'typeorm'\nimport { ObjectType, Field, Int, ID, registerEnumType } from 'type-graphql'\n\nimport { Domain } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { KpiCategory } from '../kpi-category/kpi-category'\nimport { KpiGrade } from '../kpi-grade/kpi-grade'\nimport { config } from '@things-factory/env'\nimport { ScalarObject } from '@things-factory/shell'\n\nconst ORMCONFIG = config.get('ormconfig', {})\nconst DATABASE_TYPE = ORMCONFIG.type\n\nexport enum KpiStatus {\n DRAFT = 'DRAFT',\n RELEASE = 'RELEASE',\n ARCHIVED = 'ARCHIVED'\n}\n\nregisterEnumType(KpiStatus, {\n name: 'KpiStatus',\n description: 'State enumeration of a KPI (DRAFT, RELEASED, ARCHIVED)'\n})\n\n@Entity()\n@Index('ix_kpi_0', (kpi: Kpi) => [kpi.domain, kpi.name], {\n where: '\"deleted_at\" IS NULL',\n unique: true\n})\n@ObjectType({\n description:\n 'KPI entity. Represents a key performance indicator with calculation formula, target, category, and other attributes.'\n})\nexport class Kpi {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID, { description: 'Unique identifier for this KPI.' })\n readonly id: string\n\n @VersionColumn()\n @Field({\n nullable: true,\n description:\n 'Version number of the KPI. Increments on each modification. When the KPI is released, a snapshot is saved in kpi-history and the status becomes RELEASED. Editing after release increases the version and sets status to DRAFT.'\n })\n version?: number = 1\n\n @ManyToOne(type => Domain)\n @Field({ nullable: true, description: 'Domain (tenant) to which this KPI belongs.' })\n domain?: Domain\n\n @RelationId((kpi: Kpi) => kpi.domain)\n @Field({ nullable: true, description: 'ID of the domain (tenant) for this KPI.' })\n domainId?: string\n\n @Column()\n @Field({ nullable: true, description: 'Name of the KPI.' })\n name?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Detailed description of the KPI.' })\n description?: string\n\n @ManyToOne(() => KpiCategory, { nullable: true })\n @Field(type => KpiCategory, { nullable: true, description: 'Category to which this KPI belongs.' })\n category?: KpiCategory\n\n @RelationId((kpi: Kpi) => kpi.category)\n @Field({ nullable: true, description: 'ID of the category for this KPI.' })\n categoryId?: string\n\n @Column({\n nullable: true,\n type:\n DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'\n ? 'longtext'\n : DATABASE_TYPE == 'oracle'\n ? 'clob'\n : DATABASE_TYPE == 'mssql'\n ? 'nvarchar'\n : 'varchar',\n length: DATABASE_TYPE == 'mssql' ? 'MAX' : undefined\n })\n @Field({\n nullable: true,\n description:\n 'Calculation formula for the KPI. Expressed as a string using metric codes and operators, e.g., \"defect_count / total_count * 100\".'\n })\n formula?: string\n\n @Column({ nullable: false, default: false })\n @Field({ nullable: true, description: 'Indicates whether this KPI is active and usable.' })\n active?: boolean\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Current state of the KPI (DRAFT, RELEASED, ARCHIVED).' })\n state?: KpiStatus\n\n @Column({ nullable: true })\n @Field({\n nullable: true,\n description: 'Visualization type for this KPI (e.g., bar, line, gauge, progress, card, table, icon, badge, text).'\n })\n vizType?: string\n\n @Column({ type: 'json', nullable: true })\n @Field(type => ScalarObject, {\n nullable: true,\n description:\n 'Visualization options and metadata for this KPI, such as color, icon, thresholds, unit, decimal places, etc.'\n })\n vizMeta?: any\n\n @Column({ nullable: true })\n @Field({\n nullable: true,\n description: 'Cron schedule string for periodic KPI value aggregation (e.g., \"0 0 * * *\" for daily).'\n })\n schedule?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Schedule ID for the KPI (used for scheduler registration).' })\n scheduleId?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Timezone for the KPI schedule.' })\n timezone?: string\n\n @CreateDateColumn()\n @Field({ nullable: true, description: 'Timestamp when this KPI was created.' })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true, description: 'Timestamp when this KPI was last updated.' })\n updatedAt?: Date\n\n @DeleteDateColumn()\n @Field({ nullable: true, description: 'Timestamp when this KPI was deleted (soft delete).' })\n deletedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'User who created this KPI.' })\n creator?: User\n\n @RelationId((kpi: Kpi) => kpi.creator)\n @Field({ nullable: true, description: 'ID of the user who created this KPI.' })\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'User who last updated this KPI.' })\n updater?: User\n\n @RelationId((kpi: Kpi) => kpi.updater)\n @Field({ nullable: true, description: 'ID of the user who last updated this KPI.' })\n updaterId?: string\n\n @Field(type => String, { nullable: true, description: 'Thumbnail image or file path for this KPI.' })\n thumbnail?: string\n\n @OneToMany(type => KpiGrade, kpiGrade => kpiGrade.kpi)\n @Field(type => [KpiGrade], { nullable: true, description: 'List of grades for this KPI.' })\n grades?: KpiGrade[]\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/kpi-alert/index.ts"],"names":[],"mappings":";;;AAAA,uDAAiD;AAEpC,QAAA,SAAS,GAAG,CAAC,+BAAa,CAAC,CAAA","sourcesContent":["import { KpiAlertQuery } from './kpi-alert-query'\n\nexport const resolvers = [KpiAlertQuery]\n"]}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.KpiAlertQuery = 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 kpi_1 = require("../kpi/kpi");
|
|
8
|
+
const kpi_value_1 = require("../kpi-value/kpi-value");
|
|
9
|
+
const kpi_alert_type_1 = require("./kpi-alert-type");
|
|
10
|
+
let KpiAlertQuery = class KpiAlertQuery {
|
|
11
|
+
async kpiAlerts(context) {
|
|
12
|
+
const { domain } = context.state;
|
|
13
|
+
// 1. KPI 전체 조회
|
|
14
|
+
const kpis = await (0, shell_1.getRepository)(kpi_1.Kpi).find({ where: { domain: { id: domain.id } }, relations: ['grades'] });
|
|
15
|
+
// 2. KPI별 최신 실적값 조회
|
|
16
|
+
const alerts = [];
|
|
17
|
+
for (const kpi of kpis) {
|
|
18
|
+
const value = await (0, shell_1.getRepository)(kpi_value_1.KpiValue).findOne({
|
|
19
|
+
where: { domain: { id: domain.id }, kpi: { id: kpi.id } },
|
|
20
|
+
order: { valueDate: 'DESC' }
|
|
21
|
+
});
|
|
22
|
+
if (!value) {
|
|
23
|
+
alerts.push({
|
|
24
|
+
id: `${kpi.id}-no-value`,
|
|
25
|
+
kpi,
|
|
26
|
+
message: `${kpi.name} 실적값 미입력`,
|
|
27
|
+
level: 'info',
|
|
28
|
+
createdAt: new Date()
|
|
29
|
+
});
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
// 목표값(예: kpi.vizMeta?.targetValue) 기준 경고
|
|
33
|
+
const target = kpi.vizMeta?.targetValue;
|
|
34
|
+
if (target !== undefined && value.value < target) {
|
|
35
|
+
alerts.push({
|
|
36
|
+
id: `${kpi.id}-target-miss`,
|
|
37
|
+
kpi,
|
|
38
|
+
message: `${kpi.name} 실적(${value.value})이 목표(${target}) 미달`,
|
|
39
|
+
level: 'warning',
|
|
40
|
+
createdAt: new Date()
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
// 등급 기준 경고(예: 최하위 등급)
|
|
44
|
+
if (kpi.grades?.length) {
|
|
45
|
+
const grade = kpi.grades.find(g => value.value >= g.minValue && value.value <= g.maxValue);
|
|
46
|
+
if (grade && grade.score !== undefined && grade.score <= 2) {
|
|
47
|
+
alerts.push({
|
|
48
|
+
id: `${kpi.id}-grade-low`,
|
|
49
|
+
kpi,
|
|
50
|
+
message: `${kpi.name} 등급(${grade.name})(${grade.score}점)`,
|
|
51
|
+
level: 'critical',
|
|
52
|
+
createdAt: new Date()
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return alerts;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
exports.KpiAlertQuery = KpiAlertQuery;
|
|
61
|
+
tslib_1.__decorate([
|
|
62
|
+
(0, type_graphql_1.Query)(returns => [kpi_alert_type_1.KpiAlert], { description: 'KPI 실적/등급/목표 미달 등 경고/알림 리스트 반환' }),
|
|
63
|
+
tslib_1.__param(0, (0, type_graphql_1.Ctx)()),
|
|
64
|
+
tslib_1.__metadata("design:type", Function),
|
|
65
|
+
tslib_1.__metadata("design:paramtypes", [Object]),
|
|
66
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
67
|
+
], KpiAlertQuery.prototype, "kpiAlerts", null);
|
|
68
|
+
exports.KpiAlertQuery = KpiAlertQuery = tslib_1.__decorate([
|
|
69
|
+
(0, type_graphql_1.Resolver)()
|
|
70
|
+
], KpiAlertQuery);
|
|
71
|
+
//# sourceMappingURL=kpi-alert-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CAAC,yBAAQ,CAAC,EAAE,EAAE,WAAW,EAAE,gCAAgC,EAAE,CAAC;IAC/D,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;8CA+CrB;wBAjDU,aAAa;IADzB,IAAA,uBAAQ,GAAE;GACE,aAAa,CAkDzB","sourcesContent":["import { Resolver, Query, Ctx } from 'type-graphql'\nimport { getRepository } from '@things-factory/shell'\nimport { Kpi } from '../kpi/kpi'\nimport { KpiValue } from '../kpi-value/kpi-value'\nimport { KpiGrade } from '../kpi-grade/kpi-grade'\nimport { KpiAlert } from './kpi-alert-type'\n\n@Resolver()\nexport class KpiAlertQuery {\n @Query(returns => [KpiAlert], { description: 'KPI 실적/등급/목표 미달 등 경고/알림 리스트 반환' })\n async kpiAlerts(@Ctx() context): Promise<KpiAlert[]> {\n const { domain } = context.state\n // 1. KPI 전체 조회\n const kpis = await getRepository(Kpi).find({ where: { domain: { id: domain.id } }, relations: ['grades'] })\n // 2. KPI별 최신 실적값 조회\n const alerts: KpiAlert[] = []\n for (const kpi of kpis) {\n const value = await getRepository(KpiValue).findOne({\n where: { domain: { id: domain.id }, kpi: { id: kpi.id } },\n order: { valueDate: 'DESC' }\n })\n if (!value) {\n alerts.push({\n id: `${kpi.id}-no-value`,\n kpi,\n message: `${kpi.name} 실적값 미입력`,\n level: 'info',\n createdAt: new Date()\n })\n continue\n }\n // 목표값(예: kpi.vizMeta?.targetValue) 기준 경고\n const target = kpi.vizMeta?.targetValue\n if (target !== undefined && value.value < target) {\n alerts.push({\n id: `${kpi.id}-target-miss`,\n kpi,\n message: `${kpi.name} 실적(${value.value})이 목표(${target}) 미달`,\n level: 'warning',\n createdAt: new Date()\n })\n }\n // 등급 기준 경고(예: 최하위 등급)\n if (kpi.grades?.length) {\n const grade = kpi.grades.find(g => value.value >= g.minValue && value.value <= g.maxValue)\n if (grade && grade.score !== undefined && grade.score <= 2) {\n alerts.push({\n id: `${kpi.id}-grade-low`,\n kpi,\n message: `${kpi.name} 등급(${grade.name})(${grade.score}점)`,\n level: 'critical',\n createdAt: new Date()\n })\n }\n }\n }\n return alerts\n }\n}\n"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.KpiAlert = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const type_graphql_1 = require("type-graphql");
|
|
6
|
+
const kpi_1 = require("../kpi/kpi");
|
|
7
|
+
let KpiAlert = class KpiAlert {
|
|
8
|
+
};
|
|
9
|
+
exports.KpiAlert = KpiAlert;
|
|
10
|
+
tslib_1.__decorate([
|
|
11
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
|
12
|
+
tslib_1.__metadata("design:type", String)
|
|
13
|
+
], KpiAlert.prototype, "id", void 0);
|
|
14
|
+
tslib_1.__decorate([
|
|
15
|
+
(0, type_graphql_1.Field)(type => kpi_1.Kpi, { nullable: true, description: '경고/알림이 발생한 KPI.' }),
|
|
16
|
+
tslib_1.__metadata("design:type", kpi_1.Kpi)
|
|
17
|
+
], KpiAlert.prototype, "kpi", void 0);
|
|
18
|
+
tslib_1.__decorate([
|
|
19
|
+
(0, type_graphql_1.Field)({ description: '경고/알림 메시지.' }),
|
|
20
|
+
tslib_1.__metadata("design:type", String)
|
|
21
|
+
], KpiAlert.prototype, "message", void 0);
|
|
22
|
+
tslib_1.__decorate([
|
|
23
|
+
(0, type_graphql_1.Field)({ description: '경고 레벨(예: warning, critical, info 등).' }),
|
|
24
|
+
tslib_1.__metadata("design:type", String)
|
|
25
|
+
], KpiAlert.prototype, "level", void 0);
|
|
26
|
+
tslib_1.__decorate([
|
|
27
|
+
(0, type_graphql_1.Field)({ description: '경고/알림 발생 시각.' }),
|
|
28
|
+
tslib_1.__metadata("design:type", Date)
|
|
29
|
+
], KpiAlert.prototype, "createdAt", void 0);
|
|
30
|
+
exports.KpiAlert = KpiAlert = tslib_1.__decorate([
|
|
31
|
+
(0, type_graphql_1.ObjectType)({ description: 'KPI 경고/알림 엔티티. KPI 실적, 등급, 목표 미달 등 경고/알림 정보를 제공.' })
|
|
32
|
+
], KpiAlert);
|
|
33
|
+
//# sourceMappingURL=kpi-alert-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kpi-alert-type.js","sourceRoot":"","sources":["../../../server/service/kpi-alert/kpi-alert-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAoD;AACpD,oCAAgC;AAGzB,IAAM,QAAQ,GAAd,MAAM,QAAQ;CAepB,CAAA;AAfY,4BAAQ;AAEnB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;oCACR;AAGV;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,SAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC;sCACjE,SAAG;qCAAA;AAGT;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC;;yCACtB;AAGf;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,sCAAsC,EAAE,CAAC;;uCAClD;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC;sCAC5B,IAAI;2CAAA;mBAdJ,QAAQ;IADpB,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,kDAAkD,EAAE,CAAC;GACnE,QAAQ,CAepB","sourcesContent":["import { ObjectType, Field, ID } from 'type-graphql'\nimport { Kpi } from '../kpi/kpi'\n\n@ObjectType({ description: 'KPI 경고/알림 엔티티. KPI 실적, 등급, 목표 미달 등 경고/알림 정보를 제공.' })\nexport class KpiAlert {\n @Field(type => ID)\n id: string\n\n @Field(type => Kpi, { nullable: true, description: '경고/알림이 발생한 KPI.' })\n kpi?: Kpi\n\n @Field({ description: '경고/알림 메시지.' })\n message: string\n\n @Field({ description: '경고 레벨(예: warning, critical, info 등).' })\n level: string\n\n @Field({ description: '경고/알림 발생 시각.' })\n createdAt: Date\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { KpiCategory } from './kpi-category';
|
|
2
2
|
import { NewKpiCategory, KpiCategoryPatch } from './kpi-category-type';
|
|
3
3
|
export declare class KpiCategoryMutation {
|
|
4
|
-
createKpiCategory(
|
|
4
|
+
createKpiCategory(category: NewKpiCategory, context: ResolverContext): Promise<KpiCategory>;
|
|
5
5
|
updateKpiCategory(id: string, patch: KpiCategoryPatch, context: ResolverContext): Promise<KpiCategory>;
|
|
6
6
|
updateMultipleKpiCategory(patches: KpiCategoryPatch[], context: ResolverContext): Promise<KpiCategory[]>;
|
|
7
7
|
deleteKpiCategory(id: string, context: ResolverContext): Promise<boolean>;
|