@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
|
@@ -8,9 +8,18 @@ const shell_1 = require("@things-factory/shell");
|
|
|
8
8
|
const kpi_category_1 = require("./kpi-category");
|
|
9
9
|
const kpi_category_type_1 = require("./kpi-category-type");
|
|
10
10
|
let KpiCategoryMutation = class KpiCategoryMutation {
|
|
11
|
-
async createKpiCategory(
|
|
11
|
+
async createKpiCategory(category, context) {
|
|
12
12
|
const { domain, user, tx } = context.state;
|
|
13
|
-
|
|
13
|
+
let parent = category.parentId
|
|
14
|
+
? await (0, shell_1.getRepository)(kpi_category_1.KpiCategory).findOne({ where: { id: category.parentId } })
|
|
15
|
+
: undefined;
|
|
16
|
+
const result = await (0, shell_1.getRepository)(kpi_category_1.KpiCategory, tx).save({
|
|
17
|
+
...category,
|
|
18
|
+
parent,
|
|
19
|
+
domain,
|
|
20
|
+
creator: user,
|
|
21
|
+
updater: user
|
|
22
|
+
});
|
|
14
23
|
return result;
|
|
15
24
|
}
|
|
16
25
|
async updateKpiCategory(id, patch, context) {
|
|
@@ -19,7 +28,15 @@ let KpiCategoryMutation = class KpiCategoryMutation {
|
|
|
19
28
|
const kpiCategory = await repository.findOne({
|
|
20
29
|
where: { domain: { id: domain.id }, id }
|
|
21
30
|
});
|
|
22
|
-
|
|
31
|
+
let parent = patch.parentId
|
|
32
|
+
? await (0, shell_1.getRepository)(kpi_category_1.KpiCategory).findOne({ where: { id: patch.parentId } })
|
|
33
|
+
: kpiCategory.parent;
|
|
34
|
+
const result = await repository.save({
|
|
35
|
+
...kpiCategory,
|
|
36
|
+
...patch,
|
|
37
|
+
parent,
|
|
38
|
+
updater: user
|
|
39
|
+
});
|
|
23
40
|
return result;
|
|
24
41
|
}
|
|
25
42
|
async updateMultipleKpiCategory(patches, context) {
|
|
@@ -31,16 +48,25 @@ let KpiCategoryMutation = class KpiCategoryMutation {
|
|
|
31
48
|
if (_createRecords.length > 0) {
|
|
32
49
|
for (let i = 0; i < _createRecords.length; i++) {
|
|
33
50
|
const newRecord = _createRecords[i];
|
|
34
|
-
const result = await kpiCategoryRepo.save(
|
|
35
|
-
|
|
51
|
+
const result = await kpiCategoryRepo.save({
|
|
52
|
+
...newRecord,
|
|
53
|
+
domain,
|
|
54
|
+
creator: user,
|
|
55
|
+
updater: user
|
|
56
|
+
});
|
|
57
|
+
results.push({ ...result, cuFlag: '+' });
|
|
36
58
|
}
|
|
37
59
|
}
|
|
38
60
|
if (_updateRecords.length > 0) {
|
|
39
61
|
for (let i = 0; i < _updateRecords.length; i++) {
|
|
40
62
|
const updateRecord = _updateRecords[i];
|
|
41
63
|
const kpiCategory = await kpiCategoryRepo.findOneBy({ id: updateRecord.id });
|
|
42
|
-
const result = await kpiCategoryRepo.save(
|
|
43
|
-
|
|
64
|
+
const result = await kpiCategoryRepo.save({
|
|
65
|
+
...kpiCategory,
|
|
66
|
+
...updateRecord,
|
|
67
|
+
updater: user
|
|
68
|
+
});
|
|
69
|
+
results.push({ ...result, cuFlag: 'M' });
|
|
44
70
|
}
|
|
45
71
|
}
|
|
46
72
|
return results;
|
|
@@ -61,7 +87,7 @@ let KpiCategoryMutation = class KpiCategoryMutation {
|
|
|
61
87
|
async importKpiCategories(kpiCategories, context) {
|
|
62
88
|
const { domain, tx } = context.state;
|
|
63
89
|
await Promise.all(kpiCategories.map(async (kpiCategory) => {
|
|
64
|
-
const createdKpiCategory = await (0, shell_1.getRepository)(kpi_category_1.KpiCategory, tx).save(
|
|
90
|
+
const createdKpiCategory = await (0, shell_1.getRepository)(kpi_category_1.KpiCategory, tx).save({ domain, ...kpiCategory });
|
|
65
91
|
}));
|
|
66
92
|
return true;
|
|
67
93
|
}
|
|
@@ -69,8 +95,8 @@ let KpiCategoryMutation = class KpiCategoryMutation {
|
|
|
69
95
|
exports.KpiCategoryMutation = KpiCategoryMutation;
|
|
70
96
|
tslib_1.__decorate([
|
|
71
97
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
72
|
-
(0, type_graphql_1.Mutation)(returns => kpi_category_1.KpiCategory, { description: '
|
|
73
|
-
tslib_1.__param(0, (0, type_graphql_1.Arg)('
|
|
98
|
+
(0, type_graphql_1.Mutation)(returns => kpi_category_1.KpiCategory, { description: 'Create a new KPI category with the provided details.' }),
|
|
99
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('category', { description: 'Input object containing details for the new KPI category.' })),
|
|
74
100
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
75
101
|
tslib_1.__metadata("design:type", Function),
|
|
76
102
|
tslib_1.__metadata("design:paramtypes", [kpi_category_type_1.NewKpiCategory, Object]),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kpi-category-mutation.js","sourceRoot":"","sources":["../../../server/service/kpi-category/kpi-category-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAC5B,iDAAqD;AAErD,iDAA4C;AAC5C,2DAAsE;AAG/D,IAAM,mBAAmB,GAAzB,M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AAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;8DAWP;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;IAE/E,mBAAA,IAAA,kBAAG,EAAC,eAAe,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,oCAAgB,CAAC,CAAC,CAAA;IAChD,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;8DAWP;8BA/HU,mBAAmB;IAD/B,IAAA,uBAAQ,EAAC,0BAAW,CAAC;GACT,mBAAmB,CAgI/B","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\nimport { getRepository } from '@things-factory/shell'\n\nimport { KpiCategory } from './kpi-category'\nimport { NewKpiCategory, KpiCategoryPatch } from './kpi-category-type'\n\n@Resolver(KpiCategory)\nexport class KpiCategoryMutation {\n @Directive('@transaction')\n @Mutation(returns => KpiCategory, { description: 'To create new KpiCategory' })\n async createKpiCategory(@Arg('kpiCategory') kpiCategory: NewKpiCategory, @Ctx() context: ResolverContext): Promise<KpiCategory> {\n const { domain, user, tx } = context.state\n\n const result = await getRepository(KpiCategory, tx).save({\n ...kpiCategory,\n domain,\n creator: user,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => KpiCategory, { description: 'To modify KpiCategory information' })\n async updateKpiCategory(\n @Arg('id') id: string,\n @Arg('patch') patch: KpiCategoryPatch,\n @Ctx() context: ResolverContext\n ): Promise<KpiCategory> {\n const { domain, user, tx } = context.state\n\n const repository = getRepository(KpiCategory, tx)\n const kpiCategory = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...kpiCategory,\n ...patch,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => [KpiCategory], { description: \"To modify multiple KpiCategories' information\" })\n async updateMultipleKpiCategory(\n @Arg('patches', type => [KpiCategoryPatch]) patches: KpiCategoryPatch[],\n @Ctx() context: ResolverContext\n ): Promise<KpiCategory[]> {\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 kpiCategoryRepo = getRepository(KpiCategory, 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 kpiCategoryRepo.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 kpiCategory = await kpiCategoryRepo.findOneBy({ id: updateRecord.id })\n\n const result = await kpiCategoryRepo.save({\n ...kpiCategory,\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 @Mutation(returns => Boolean, { description: 'To delete KpiCategory' })\n async deleteKpiCategory(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(KpiCategory, tx).delete({ domain: { id: domain.id }, id })\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple KpiCategories' })\n async deleteKpiCategories(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(KpiCategory, tx).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To import multiple KpiCategories' })\n async importKpiCategories(\n @Arg('kpiCategories', type => [KpiCategoryPatch]) kpiCategories: KpiCategoryPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n kpiCategories.map(async (kpiCategory: KpiCategoryPatch) => {\n const createdKpiCategory: KpiCategory = await getRepository(KpiCategory, tx).save({ domain, ...kpiCategory })\n })\n )\n\n return true\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"kpi-category-mutation.js","sourceRoot":"","sources":["../../../server/service/kpi-category/kpi-category-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAC5B,iDAAqD;AAErD,iDAA4C;AAC5C,2DAAsE;AAG/D,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAGxB,AAAN,KAAK,CAAC,iBAAiB,CAErB,QAAwB,EACjB,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,IAAI,MAAM,GAAG,QAAQ,CAAC,QAAQ;YAC5B,CAAC,CAAC,MAAM,IAAA,qBAAa,EAAC,0BAAW,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC;YAChF,CAAC,CAAC,SAAS,CAAA;QAEb,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAa,EAAC,0BAAW,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC;YACvD,GAAG,QAAQ;YACX,MAAM;YACN,MAAM;YACN,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,IAAI;SACd,CAAC,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC;IAIK,AAAN,KAAK,CAAC,iBAAiB,CACV,EAAU,EACP,KAAuB,EAC9B,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,UAAU,GAAG,IAAA,qBAA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,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;IAE/E,mBAAA,IAAA,kBAAG,EAAC,eAAe,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,oCAAgB,CAAC,CAAC,CAAA;IAChD,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;8DAWP;8BA5IU,mBAAmB;IAD/B,IAAA,uBAAQ,EAAC,0BAAW,CAAC;GACT,mBAAmB,CA6I/B","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\nimport { getRepository } from '@things-factory/shell'\n\nimport { KpiCategory } from './kpi-category'\nimport { NewKpiCategory, KpiCategoryPatch } from './kpi-category-type'\n\n@Resolver(KpiCategory)\nexport class KpiCategoryMutation {\n @Directive('@transaction')\n @Mutation(returns => KpiCategory, { description: 'Create a new KPI category with the provided details.' })\n async createKpiCategory(\n @Arg('category', { description: 'Input object containing details for the new KPI category.' })\n category: NewKpiCategory,\n @Ctx() context: ResolverContext\n ): Promise<KpiCategory> {\n const { domain, user, tx } = context.state\n\n let parent = category.parentId\n ? await getRepository(KpiCategory).findOne({ where: { id: category.parentId } })\n : undefined\n\n const result = await getRepository(KpiCategory, tx).save({\n ...category,\n parent,\n domain,\n creator: user,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => KpiCategory, { description: 'To modify KpiCategory information' })\n async updateKpiCategory(\n @Arg('id') id: string,\n @Arg('patch') patch: KpiCategoryPatch,\n @Ctx() context: ResolverContext\n ): Promise<KpiCategory> {\n const { domain, user, tx } = context.state\n\n const repository = getRepository(KpiCategory, tx)\n const kpiCategory = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n let parent = patch.parentId\n ? await getRepository(KpiCategory).findOne({ where: { id: patch.parentId } })\n : kpiCategory.parent\n\n const result = await repository.save({\n ...kpiCategory,\n ...patch,\n parent,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => [KpiCategory], { description: \"To modify multiple KpiCategories' information\" })\n async updateMultipleKpiCategory(\n @Arg('patches', type => [KpiCategoryPatch]) patches: KpiCategoryPatch[],\n @Ctx() context: ResolverContext\n ): Promise<KpiCategory[]> {\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 kpiCategoryRepo = getRepository(KpiCategory, 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 kpiCategoryRepo.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 kpiCategory = await kpiCategoryRepo.findOneBy({ id: updateRecord.id })\n\n const result = await kpiCategoryRepo.save({\n ...kpiCategory,\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 @Mutation(returns => Boolean, { description: 'To delete KpiCategory' })\n async deleteKpiCategory(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(KpiCategory, tx).delete({ domain: { id: domain.id }, id })\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple KpiCategories' })\n async deleteKpiCategories(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(KpiCategory, tx).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To import multiple KpiCategories' })\n async importKpiCategories(\n @Arg('kpiCategories', type => [KpiCategoryPatch]) kpiCategories: KpiCategoryPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n kpiCategories.map(async (kpiCategory: KpiCategoryPatch) => {\n const createdKpiCategory: KpiCategory = await getRepository(KpiCategory, tx).save({ domain, ...kpiCategory })\n })\n )\n\n return true\n }\n}\n"]}
|
|
@@ -2,9 +2,11 @@ import { Domain, ListParam } from '@things-factory/shell';
|
|
|
2
2
|
import { User } from '@things-factory/auth-base';
|
|
3
3
|
import { KpiCategory } from './kpi-category';
|
|
4
4
|
import { KpiCategoryList } from './kpi-category-type';
|
|
5
|
+
import { Kpi } from '../kpi/kpi';
|
|
5
6
|
export declare class KpiCategoryQuery {
|
|
6
7
|
kpiCategory(id: string, context: ResolverContext): Promise<KpiCategory>;
|
|
7
8
|
kpiCategories(params: ListParam, context: ResolverContext): Promise<KpiCategoryList>;
|
|
9
|
+
kpis(kpiCategory: KpiCategory): Promise<Kpi[]>;
|
|
8
10
|
domain(kpiCategory: KpiCategory): Promise<Domain>;
|
|
9
11
|
updater(kpiCategory: KpiCategory): Promise<User>;
|
|
10
12
|
creator(kpiCategory: KpiCategory): Promise<User>;
|
|
@@ -7,6 +7,7 @@ const shell_1 = require("@things-factory/shell");
|
|
|
7
7
|
const auth_base_1 = require("@things-factory/auth-base");
|
|
8
8
|
const kpi_category_1 = require("./kpi-category");
|
|
9
9
|
const kpi_category_type_1 = require("./kpi-category-type");
|
|
10
|
+
const kpi_1 = require("../kpi/kpi");
|
|
10
11
|
let KpiCategoryQuery = class KpiCategoryQuery {
|
|
11
12
|
async kpiCategory(id, context) {
|
|
12
13
|
const { domain } = context.state;
|
|
@@ -25,6 +26,11 @@ let KpiCategoryQuery = class KpiCategoryQuery {
|
|
|
25
26
|
const [items, total] = await queryBuilder.getManyAndCount();
|
|
26
27
|
return { items, total };
|
|
27
28
|
}
|
|
29
|
+
async kpis(kpiCategory) {
|
|
30
|
+
return await (0, shell_1.getRepository)(kpi_1.Kpi).find({
|
|
31
|
+
where: { domain: { id: kpiCategory.domainId }, category: { id: kpiCategory.id } }
|
|
32
|
+
});
|
|
33
|
+
}
|
|
28
34
|
async domain(kpiCategory) {
|
|
29
35
|
return kpiCategory.domainId && (await (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: kpiCategory.domainId }));
|
|
30
36
|
}
|
|
@@ -37,8 +43,11 @@ let KpiCategoryQuery = class KpiCategoryQuery {
|
|
|
37
43
|
};
|
|
38
44
|
exports.KpiCategoryQuery = KpiCategoryQuery;
|
|
39
45
|
tslib_1.__decorate([
|
|
40
|
-
(0, type_graphql_1.Query)(returns => kpi_category_1.KpiCategory, {
|
|
41
|
-
|
|
46
|
+
(0, type_graphql_1.Query)(returns => kpi_category_1.KpiCategory, {
|
|
47
|
+
nullable: true,
|
|
48
|
+
description: 'Fetch a single KPI category by its unique identifier.'
|
|
49
|
+
}),
|
|
50
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('id', { description: 'Unique identifier of the KPI category to fetch.' })),
|
|
42
51
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
43
52
|
tslib_1.__metadata("design:type", Function),
|
|
44
53
|
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
|
@@ -52,6 +61,13 @@ tslib_1.__decorate([
|
|
|
52
61
|
tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
|
|
53
62
|
tslib_1.__metadata("design:returntype", Promise)
|
|
54
63
|
], KpiCategoryQuery.prototype, "kpiCategories", null);
|
|
64
|
+
tslib_1.__decorate([
|
|
65
|
+
(0, type_graphql_1.FieldResolver)(type => [kpi_1.Kpi]),
|
|
66
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
67
|
+
tslib_1.__metadata("design:type", Function),
|
|
68
|
+
tslib_1.__metadata("design:paramtypes", [kpi_category_1.KpiCategory]),
|
|
69
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
70
|
+
], KpiCategoryQuery.prototype, "kpis", null);
|
|
55
71
|
tslib_1.__decorate([
|
|
56
72
|
(0, type_graphql_1.FieldResolver)(type => shell_1.Domain),
|
|
57
73
|
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kpi-category-query.js","sourceRoot":"","sources":["../../../server/service/kpi-category/kpi-category-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,iDAAuG;AACvG,yDAAgD;AAChD,iDAA4C;AAC5C,2DAAqD;
|
|
1
|
+
{"version":3,"file":"kpi-category-query.js","sourceRoot":"","sources":["../../../server/service/kpi-category/kpi-category-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,iDAAuG;AACvG,yDAAgD;AAChD,iDAA4C;AAC5C,2DAAqD;AACrD,oCAAgC;AAGzB,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAKrB,AAAN,KAAK,CAAC,WAAW,CACgE,EAAU,EAClF,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,qBAAa,EAAC,0BAAW,CAAC,CAAC,OAAO,CAAC;YAC9C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;SACzC,CAAC,CAAA;IACJ,CAAC;IAGK,AAAN,KAAK,CAAC,aAAa,CACQ,MAAiB,EACnC,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,MAAM,YAAY,GAAG,IAAA,qCAA6B,EAAC;YACjD,MAAM;YACN,MAAM;YACN,UAAU,EAAE,MAAM,IAAA,qBAAa,EAAC,0BAAW,CAAC;YAC5C,WAAW,EAAE,CAAC,MAAM,EAAE,aAAa,CAAC;SACrC,CAAC,CAAA;QAEF,MAAM,CAAC,KAAK,EAAE,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AAG,EAAC,IAAI,EAAE,EAAE,WAAW,EAAE,iDAAiD,EAAE,CAAC,CAAA;IAC7E,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;mDAOP;AAGK;IADL,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,mCAAe,EAAE,EAAE,WAAW,EAAE,iCAAiC,EAAE,CAAC;IAEnF,mBAAA,IAAA,mBAAI,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAS,CAAC,CAAA;IACvB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAD2B,iBAAS;;qDAe3C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,SAAG,CAAC,CAAC;IACjB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAc,0BAAW;;4CAI1C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAc,0BAAW;;8CAE5C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAc,0BAAW;;+CAE7C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAc,0BAAW;;+CAE7C;2BAvDU,gBAAgB;IAD5B,IAAA,uBAAQ,EAAC,0BAAW,CAAC;GACT,gBAAgB,CAwD5B","sourcesContent":["import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { KpiCategory } from './kpi-category'\nimport { KpiCategoryList } from './kpi-category-type'\nimport { Kpi } from '../kpi/kpi'\n\n@Resolver(KpiCategory)\nexport class KpiCategoryQuery {\n @Query(returns => KpiCategory!, {\n nullable: true,\n description: 'Fetch a single KPI category by its unique identifier.'\n })\n async kpiCategory(\n @Arg('id', { description: 'Unique identifier of the KPI category to fetch.' }) id: string,\n @Ctx() context: ResolverContext\n ): Promise<KpiCategory> {\n const { domain } = context.state\n\n return await getRepository(KpiCategory).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Query(returns => KpiCategoryList, { description: 'To fetch multiple KpiCategories' })\n async kpiCategories(\n @Args(type => ListParam) params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<KpiCategoryList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(KpiCategory),\n searchables: ['name', 'description']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => [Kpi])\n async kpis(@Root() kpiCategory: KpiCategory): Promise<Kpi[]> {\n return await getRepository(Kpi).find({\n where: { domain: { id: kpiCategory.domainId }, category: { id: kpiCategory.id } }\n })\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() kpiCategory: KpiCategory): Promise<Domain> {\n return kpiCategory.domainId && (await getRepository(Domain).findOneBy({ id: kpiCategory.domainId }))\n }\n\n @FieldResolver(type => User)\n async updater(@Root() kpiCategory: KpiCategory): Promise<User> {\n return kpiCategory.updaterId && (await getRepository(User).findOneBy({ id: kpiCategory.updaterId }))\n }\n\n @FieldResolver(type => User)\n async creator(@Root() kpiCategory: KpiCategory): Promise<User> {\n return kpiCategory.creatorId && (await getRepository(User).findOneBy({ id: kpiCategory.creatorId }))\n }\n}\n"]}
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import { KpiCategory
|
|
1
|
+
import { KpiCategory } from './kpi-category';
|
|
2
2
|
export declare class NewKpiCategory {
|
|
3
3
|
name: string;
|
|
4
4
|
description?: string;
|
|
5
|
-
|
|
5
|
+
parentId?: string;
|
|
6
6
|
active?: boolean;
|
|
7
|
-
params?: string;
|
|
8
7
|
}
|
|
9
8
|
export declare class KpiCategoryPatch {
|
|
10
9
|
id?: string;
|
|
11
10
|
name?: string;
|
|
12
11
|
description?: string;
|
|
13
|
-
|
|
14
|
-
active?: boolean;
|
|
12
|
+
parentId?: string;
|
|
15
13
|
cuFlag?: string;
|
|
16
14
|
}
|
|
17
15
|
export declare class KpiCategoryList {
|
|
@@ -8,57 +8,53 @@ let NewKpiCategory = class NewKpiCategory {
|
|
|
8
8
|
};
|
|
9
9
|
exports.NewKpiCategory = NewKpiCategory;
|
|
10
10
|
tslib_1.__decorate([
|
|
11
|
-
(0, type_graphql_1.Field)(),
|
|
11
|
+
(0, type_graphql_1.Field)({ description: 'Name of the KPI category.' }),
|
|
12
12
|
tslib_1.__metadata("design:type", String)
|
|
13
13
|
], NewKpiCategory.prototype, "name", void 0);
|
|
14
14
|
tslib_1.__decorate([
|
|
15
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
15
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Detailed description of this KPI category.' }),
|
|
16
16
|
tslib_1.__metadata("design:type", String)
|
|
17
17
|
], NewKpiCategory.prototype, "description", void 0);
|
|
18
18
|
tslib_1.__decorate([
|
|
19
|
-
(0, type_graphql_1.Field)(type =>
|
|
19
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true, description: 'ID of the parent category, if any.' }),
|
|
20
20
|
tslib_1.__metadata("design:type", String)
|
|
21
|
-
], NewKpiCategory.prototype, "
|
|
21
|
+
], NewKpiCategory.prototype, "parentId", void 0);
|
|
22
22
|
tslib_1.__decorate([
|
|
23
23
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
24
24
|
tslib_1.__metadata("design:type", Boolean)
|
|
25
25
|
], NewKpiCategory.prototype, "active", void 0);
|
|
26
|
-
tslib_1.__decorate([
|
|
27
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
28
|
-
tslib_1.__metadata("design:type", String)
|
|
29
|
-
], NewKpiCategory.prototype, "params", void 0);
|
|
30
26
|
exports.NewKpiCategory = NewKpiCategory = tslib_1.__decorate([
|
|
31
|
-
(0, type_graphql_1.InputType)(
|
|
27
|
+
(0, type_graphql_1.InputType)({
|
|
28
|
+
description: 'Input type for creating a new KPI category. Used in mutations to provide category details.'
|
|
29
|
+
})
|
|
32
30
|
], NewKpiCategory);
|
|
33
31
|
let KpiCategoryPatch = class KpiCategoryPatch {
|
|
34
32
|
};
|
|
35
33
|
exports.KpiCategoryPatch = KpiCategoryPatch;
|
|
36
34
|
tslib_1.__decorate([
|
|
37
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
|
|
35
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true, description: 'ID of the KPI category to update.' }),
|
|
38
36
|
tslib_1.__metadata("design:type", String)
|
|
39
37
|
], KpiCategoryPatch.prototype, "id", void 0);
|
|
40
38
|
tslib_1.__decorate([
|
|
41
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
39
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Name of the KPI category.' }),
|
|
42
40
|
tslib_1.__metadata("design:type", String)
|
|
43
41
|
], KpiCategoryPatch.prototype, "name", void 0);
|
|
44
42
|
tslib_1.__decorate([
|
|
45
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
43
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Detailed description of this KPI category.' }),
|
|
46
44
|
tslib_1.__metadata("design:type", String)
|
|
47
45
|
], KpiCategoryPatch.prototype, "description", void 0);
|
|
48
46
|
tslib_1.__decorate([
|
|
49
|
-
(0, type_graphql_1.Field)(type =>
|
|
47
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true, description: 'ID of the parent category, if any.' }),
|
|
50
48
|
tslib_1.__metadata("design:type", String)
|
|
51
|
-
], KpiCategoryPatch.prototype, "
|
|
49
|
+
], KpiCategoryPatch.prototype, "parentId", void 0);
|
|
52
50
|
tslib_1.__decorate([
|
|
53
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
54
|
-
tslib_1.__metadata("design:type", Boolean)
|
|
55
|
-
], KpiCategoryPatch.prototype, "active", void 0);
|
|
56
|
-
tslib_1.__decorate([
|
|
57
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
51
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Custom flag for update operations (internal use).' }),
|
|
58
52
|
tslib_1.__metadata("design:type", String)
|
|
59
53
|
], KpiCategoryPatch.prototype, "cuFlag", void 0);
|
|
60
54
|
exports.KpiCategoryPatch = KpiCategoryPatch = tslib_1.__decorate([
|
|
61
|
-
(0, type_graphql_1.InputType)(
|
|
55
|
+
(0, type_graphql_1.InputType)({
|
|
56
|
+
description: 'Input type for updating an existing KPI category. Used in mutations to patch category details.'
|
|
57
|
+
})
|
|
62
58
|
], KpiCategoryPatch);
|
|
63
59
|
let KpiCategoryList = class KpiCategoryList {
|
|
64
60
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kpi-category-type.js","sourceRoot":"","sources":["../../../server/service/kpi-category/kpi-category-type.ts"],"names":[],"mappings":";;;;AAEA,+CAAsF;AAItF,
|
|
1
|
+
{"version":3,"file":"kpi-category-type.js","sourceRoot":"","sources":["../../../server/service/kpi-category/kpi-category-type.ts"],"names":[],"mappings":";;;;AAEA,+CAAsF;AAItF,iDAA4C;AAKrC,IAAM,cAAc,GAApB,MAAM,cAAc;CAY1B,CAAA;AAZY,wCAAc;AAEzB;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,2BAA2B,EAAE,CAAC;;4CACxC;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,4CAA4C,EAAE,CAAC;;mDACjE;AAGpB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,oCAAoC,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AM3B","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 { KpiCategory } from './kpi-category'\n\n@InputType({\n description: 'Input type for creating a new KPI category. Used in mutations to provide category details.'\n})\nexport class NewKpiCategory {\n @Field({ description: 'Name of the KPI category.' })\n name: string\n\n @Field({ nullable: true, description: 'Detailed description of this KPI category.' })\n description?: string\n\n @Field(type => ID, { nullable: true, description: 'ID of the parent category, if any.' })\n parentId?: string\n\n @Field({ nullable: true })\n active?: boolean\n}\n\n@InputType({\n description: 'Input type for updating an existing KPI category. Used in mutations to patch category details.'\n})\nexport class KpiCategoryPatch {\n @Field(type => ID, { nullable: true, description: 'ID of the KPI category to update.' })\n id?: string\n\n @Field({ nullable: true, description: 'Name of the KPI category.' })\n name?: string\n\n @Field({ nullable: true, description: 'Detailed description of this KPI category.' })\n description?: string\n\n @Field(type => ID, { nullable: true, description: 'ID of the parent category, if any.' })\n parentId?: string\n\n @Field({ nullable: true, description: 'Custom flag for update operations (internal use).' })\n cuFlag?: string\n}\n\n@ObjectType()\nexport class KpiCategoryList {\n @Field(type => [KpiCategory])\n items: KpiCategory[]\n\n @Field(type => Int)\n total: number\n}\n"]}
|
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
import { Domain } from '@things-factory/shell';
|
|
2
2
|
import { User } from '@things-factory/auth-base';
|
|
3
|
-
|
|
4
|
-
STATUS_A = "STATUS_A",
|
|
5
|
-
STATUS_B = "STATUS_B"
|
|
6
|
-
}
|
|
3
|
+
import { Kpi } from '../kpi/kpi';
|
|
7
4
|
export declare class KpiCategory {
|
|
8
5
|
readonly id: string;
|
|
9
6
|
domain?: Domain;
|
|
10
7
|
domainId?: string;
|
|
11
|
-
name
|
|
8
|
+
name: string;
|
|
12
9
|
description?: string;
|
|
13
10
|
active?: boolean;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
createdAt?: Date;
|
|
17
|
-
updatedAt?: Date;
|
|
11
|
+
parent?: KpiCategory;
|
|
12
|
+
parentId?: string;
|
|
18
13
|
creator?: User;
|
|
19
14
|
creatorId?: string;
|
|
20
15
|
updater?: User;
|
|
21
16
|
updaterId?: string;
|
|
17
|
+
createdAt?: Date;
|
|
18
|
+
updatedAt?: Date;
|
|
19
|
+
kpis?: Kpi[];
|
|
22
20
|
}
|
|
@@ -1,95 +1,97 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.KpiCategory =
|
|
3
|
+
exports.KpiCategory = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
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
|
-
|
|
10
|
-
(function (KpiCategoryStatus) {
|
|
11
|
-
KpiCategoryStatus["STATUS_A"] = "STATUS_A";
|
|
12
|
-
KpiCategoryStatus["STATUS_B"] = "STATUS_B";
|
|
13
|
-
})(KpiCategoryStatus || (exports.KpiCategoryStatus = KpiCategoryStatus = {}));
|
|
14
|
-
(0, type_graphql_1.registerEnumType)(KpiCategoryStatus, {
|
|
15
|
-
name: 'KpiCategoryStatus',
|
|
16
|
-
description: 'state enumeration of a kpiCategory'
|
|
17
|
-
});
|
|
9
|
+
const kpi_1 = require("../kpi/kpi");
|
|
18
10
|
let KpiCategory = class KpiCategory {
|
|
19
11
|
};
|
|
20
12
|
exports.KpiCategory = KpiCategory;
|
|
21
13
|
tslib_1.__decorate([
|
|
22
14
|
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
23
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
|
15
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { description: 'Unique identifier for this KPI category.' }),
|
|
24
16
|
tslib_1.__metadata("design:type", String)
|
|
25
17
|
], KpiCategory.prototype, "id", void 0);
|
|
26
18
|
tslib_1.__decorate([
|
|
27
19
|
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
|
28
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
20
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Domain (tenant) to which this KPI category belongs.' }),
|
|
29
21
|
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
30
22
|
], KpiCategory.prototype, "domain", void 0);
|
|
31
23
|
tslib_1.__decorate([
|
|
32
|
-
(0, typeorm_1.RelationId)((
|
|
24
|
+
(0, typeorm_1.RelationId)((category) => category.domain),
|
|
25
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'ID of the domain (tenant) for this KPI category.' }),
|
|
33
26
|
tslib_1.__metadata("design:type", String)
|
|
34
27
|
], KpiCategory.prototype, "domainId", void 0);
|
|
35
28
|
tslib_1.__decorate([
|
|
36
29
|
(0, typeorm_1.Column)(),
|
|
37
|
-
(0, type_graphql_1.Field)({
|
|
30
|
+
(0, type_graphql_1.Field)({ description: 'Name of the KPI category.' }),
|
|
38
31
|
tslib_1.__metadata("design:type", String)
|
|
39
32
|
], KpiCategory.prototype, "name", void 0);
|
|
40
33
|
tslib_1.__decorate([
|
|
41
34
|
(0, typeorm_1.Column)({ nullable: true }),
|
|
42
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
35
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Detailed description of this KPI category.' }),
|
|
43
36
|
tslib_1.__metadata("design:type", String)
|
|
44
37
|
], KpiCategory.prototype, "description", void 0);
|
|
45
38
|
tslib_1.__decorate([
|
|
46
39
|
(0, typeorm_1.Column)({ nullable: false, default: false }),
|
|
47
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
40
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Whether this category is active (usable) or not.' }),
|
|
48
41
|
tslib_1.__metadata("design:type", Boolean)
|
|
49
42
|
], KpiCategory.prototype, "active", void 0);
|
|
50
43
|
tslib_1.__decorate([
|
|
51
|
-
(0, typeorm_1.
|
|
52
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
53
|
-
tslib_1.__metadata("design:type",
|
|
54
|
-
], KpiCategory.prototype, "
|
|
44
|
+
(0, typeorm_1.ManyToOne)(type => KpiCategory, { nullable: true }),
|
|
45
|
+
(0, type_graphql_1.Field)(type => KpiCategory, { nullable: true, description: 'Parent category for hierarchical category structure.' }),
|
|
46
|
+
tslib_1.__metadata("design:type", KpiCategory)
|
|
47
|
+
], KpiCategory.prototype, "parent", void 0);
|
|
55
48
|
tslib_1.__decorate([
|
|
56
|
-
(0, typeorm_1.
|
|
57
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
49
|
+
(0, typeorm_1.RelationId)((category) => category.parent),
|
|
50
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'ID of the parent category, if any.' }),
|
|
58
51
|
tslib_1.__metadata("design:type", String)
|
|
59
|
-
], KpiCategory.prototype, "
|
|
60
|
-
tslib_1.__decorate([
|
|
61
|
-
(0, typeorm_1.CreateDateColumn)(),
|
|
62
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
63
|
-
tslib_1.__metadata("design:type", Date)
|
|
64
|
-
], KpiCategory.prototype, "createdAt", void 0);
|
|
65
|
-
tslib_1.__decorate([
|
|
66
|
-
(0, typeorm_1.UpdateDateColumn)(),
|
|
67
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
68
|
-
tslib_1.__metadata("design:type", Date)
|
|
69
|
-
], KpiCategory.prototype, "updatedAt", void 0);
|
|
52
|
+
], KpiCategory.prototype, "parentId", void 0);
|
|
70
53
|
tslib_1.__decorate([
|
|
71
54
|
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
72
|
-
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
|
55
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'User who created this KPI category.' }),
|
|
73
56
|
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
74
57
|
], KpiCategory.prototype, "creator", void 0);
|
|
75
58
|
tslib_1.__decorate([
|
|
76
|
-
(0, typeorm_1.RelationId)((
|
|
59
|
+
(0, typeorm_1.RelationId)((category) => category.creator),
|
|
60
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'ID of the user who created this KPI category.' }),
|
|
77
61
|
tslib_1.__metadata("design:type", String)
|
|
78
62
|
], KpiCategory.prototype, "creatorId", void 0);
|
|
79
63
|
tslib_1.__decorate([
|
|
80
64
|
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
81
|
-
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
|
65
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'User who last updated this KPI category.' }),
|
|
82
66
|
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
83
67
|
], KpiCategory.prototype, "updater", void 0);
|
|
84
68
|
tslib_1.__decorate([
|
|
85
|
-
(0, typeorm_1.RelationId)((
|
|
69
|
+
(0, typeorm_1.RelationId)((category) => category.updater),
|
|
70
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'ID of the user who last updated this KPI category.' }),
|
|
86
71
|
tslib_1.__metadata("design:type", String)
|
|
87
72
|
], KpiCategory.prototype, "updaterId", void 0);
|
|
73
|
+
tslib_1.__decorate([
|
|
74
|
+
(0, typeorm_1.CreateDateColumn)(),
|
|
75
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Timestamp when this KPI category was created.' }),
|
|
76
|
+
tslib_1.__metadata("design:type", Date)
|
|
77
|
+
], KpiCategory.prototype, "createdAt", void 0);
|
|
78
|
+
tslib_1.__decorate([
|
|
79
|
+
(0, typeorm_1.UpdateDateColumn)(),
|
|
80
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Timestamp when this KPI category was last updated.' }),
|
|
81
|
+
tslib_1.__metadata("design:type", Date)
|
|
82
|
+
], KpiCategory.prototype, "updatedAt", void 0);
|
|
83
|
+
tslib_1.__decorate([
|
|
84
|
+
(0, typeorm_1.OneToMany)(type => kpi_1.Kpi, kpi => kpi.category),
|
|
85
|
+
(0, type_graphql_1.Field)(type => [kpi_1.Kpi], { nullable: true, description: 'List of KPIs belonging to this category.' }),
|
|
86
|
+
tslib_1.__metadata("design:type", Array)
|
|
87
|
+
], KpiCategory.prototype, "kpis", void 0);
|
|
88
88
|
exports.KpiCategory = KpiCategory = tslib_1.__decorate([
|
|
89
89
|
(0, typeorm_1.Entity)(),
|
|
90
90
|
(0, typeorm_1.Index)('ix_kpi_category_0', (kpiCategory) => [kpiCategory.domain, kpiCategory.name], {
|
|
91
91
|
unique: true
|
|
92
92
|
}),
|
|
93
|
-
(0, type_graphql_1.ObjectType)({
|
|
93
|
+
(0, type_graphql_1.ObjectType)({
|
|
94
|
+
description: 'KPI category entity. Represents a classification or group for KPIs. Supports hierarchical (tree) structure.'
|
|
95
|
+
})
|
|
94
96
|
], KpiCategory);
|
|
95
97
|
//# sourceMappingURL=kpi-category.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kpi-category.js","sourceRoot":"","sources":["../../../server/service/kpi-category/kpi-category.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"kpi-category.js","sourceRoot":"","sources":["../../../server/service/kpi-category/kpi-category.ts"],"names":[],"mappings":";;;;AAAA,qCAUgB;AAChB,+CAAyD;AAEzD,iDAA8C;AAC9C,yDAAgD;AAChD,oCAAgC;AAUzB,IAAM,WAAW,GAAjB,MAAM,WAAW;CA4DvB,CAAA;AA5DY,kCAAW;AAGb;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,WA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,IAAI;8CAAA;AAIhB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,SAAG,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC;IAC3C,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,SAAG,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,0CAA0C,EAAE,CAAC;;yCACtF;sBA3DD,WAAW;IARvB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,mBAAmB,EAAE,CAAC,WAAwB,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,EAAE;QAChG,MAAM,EAAE,IAAI;KACb,CAAC;IACD,IAAA,yBAAU,EAAC;QACV,WAAW,EACT,6GAA6G;KAChH,CAAC;GACW,WAAW,CA4DvB","sourcesContent":["import {\n CreateDateColumn,\n UpdateDateColumn,\n Entity,\n Index,\n Column,\n RelationId,\n ManyToOne,\n OneToMany,\n PrimaryGeneratedColumn\n} from 'typeorm'\nimport { ObjectType, Field, Int, ID } from 'type-graphql'\n\nimport { Domain } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { Kpi } from '../kpi/kpi'\n\n@Entity()\n@Index('ix_kpi_category_0', (kpiCategory: KpiCategory) => [kpiCategory.domain, kpiCategory.name], {\n unique: true\n})\n@ObjectType({\n description:\n 'KPI category entity. Represents a classification or group for KPIs. Supports hierarchical (tree) structure.'\n})\nexport class KpiCategory {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID, { description: 'Unique identifier for this KPI category.' })\n readonly id: string\n\n @ManyToOne(type => Domain)\n @Field({ nullable: true, description: 'Domain (tenant) to which this KPI category belongs.' })\n domain?: Domain\n\n @RelationId((category: KpiCategory) => category.domain)\n @Field({ nullable: true, description: 'ID of the domain (tenant) for this KPI category.' })\n domainId?: string\n\n @Column()\n @Field({ description: 'Name of the KPI category.' })\n name: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Detailed description of this KPI category.' })\n description?: string\n\n @Column({ nullable: false, default: false })\n @Field({ nullable: true, description: 'Whether this category is active (usable) or not.' })\n active?: boolean\n\n @ManyToOne(type => KpiCategory, { nullable: true })\n @Field(type => KpiCategory, { nullable: true, description: 'Parent category for hierarchical category structure.' })\n parent?: KpiCategory\n\n @RelationId((category: KpiCategory) => category.parent)\n @Field({ nullable: true, description: 'ID of the parent category, if any.' })\n parentId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'User who created this KPI category.' })\n creator?: User\n\n @RelationId((category: KpiCategory) => category.creator)\n @Field({ nullable: true, description: 'ID of the user who created this KPI category.' })\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'User who last updated this KPI category.' })\n updater?: User\n\n @RelationId((category: KpiCategory) => category.updater)\n @Field({ nullable: true, description: 'ID of the user who last updated this KPI category.' })\n updaterId?: string\n\n @CreateDateColumn()\n @Field({ nullable: true, description: 'Timestamp when this KPI category was created.' })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true, description: 'Timestamp when this KPI category was last updated.' })\n updatedAt?: Date\n\n @OneToMany(type => Kpi, kpi => kpi.category)\n @Field(type => [Kpi], { nullable: true, description: 'List of KPIs belonging to this category.' })\n kpis?: Kpi[]\n}\n"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { KpiGrade } from './kpi-grade';
|
|
2
|
-
import { KpiGradeHistoryEntitySubscriber } from './event-subscriber';
|
|
3
2
|
import { KpiGradeQuery } from './kpi-grade-query';
|
|
4
3
|
import { KpiGradeMutation } from './kpi-grade-mutation';
|
|
5
4
|
export declare const entities: (typeof KpiGrade)[];
|
|
6
5
|
export declare const resolvers: (typeof KpiGradeQuery | typeof KpiGradeMutation)[];
|
|
7
|
-
export declare const subscribers:
|
|
6
|
+
export declare const subscribers: any[];
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.subscribers = exports.resolvers = exports.entities = void 0;
|
|
4
4
|
const kpi_grade_1 = require("./kpi-grade");
|
|
5
|
-
const kpi_grade_history_1 = require("./kpi-grade-history");
|
|
6
|
-
const event_subscriber_1 = require("./event-subscriber");
|
|
7
5
|
const kpi_grade_query_1 = require("./kpi-grade-query");
|
|
8
6
|
const kpi_grade_mutation_1 = require("./kpi-grade-mutation");
|
|
9
|
-
exports.entities = [kpi_grade_1.KpiGrade
|
|
7
|
+
exports.entities = [kpi_grade_1.KpiGrade];
|
|
10
8
|
exports.resolvers = [kpi_grade_query_1.KpiGradeQuery, kpi_grade_mutation_1.KpiGradeMutation];
|
|
11
|
-
exports.subscribers = [
|
|
9
|
+
exports.subscribers = [];
|
|
12
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/kpi-grade/index.ts"],"names":[],"mappings":";;;AAAA,2CAAsC;AACtC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/kpi-grade/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;AAC7C,QAAA,WAAW,GAAG,EAAE,CAAA","sourcesContent":["import { KpiGrade } from './kpi-grade'\nimport { KpiGradeQuery } from './kpi-grade-query'\nimport { KpiGradeMutation } from './kpi-grade-mutation'\n\nexport const entities = [KpiGrade]\nexport const resolvers = [KpiGradeQuery, KpiGradeMutation]\nexport const subscribers = []\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { KpiGrade } from './kpi-grade';
|
|
2
2
|
import { NewKpiGrade, KpiGradePatch } from './kpi-grade-type';
|
|
3
3
|
export declare class KpiGradeMutation {
|
|
4
|
-
createKpiGrade(
|
|
4
|
+
createKpiGrade(grade: NewKpiGrade, context: ResolverContext): Promise<KpiGrade>;
|
|
5
5
|
updateKpiGrade(id: string, patch: KpiGradePatch, context: ResolverContext): Promise<KpiGrade>;
|
|
6
6
|
updateMultipleKpiGrade(patches: KpiGradePatch[], context: ResolverContext): Promise<KpiGrade[]>;
|
|
7
7
|
deleteKpiGrade(id: string, context: ResolverContext): Promise<boolean>;
|