@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
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.KpiGradeHistory = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const type_graphql_1 = require("type-graphql");
|
|
6
|
-
const typeorm_1 = require("typeorm");
|
|
7
|
-
const typeorm_history_1 = require("@operato/typeorm-history");
|
|
8
|
-
const auth_base_1 = require("@things-factory/auth-base");
|
|
9
|
-
const env_1 = require("@things-factory/env");
|
|
10
|
-
const shell_1 = require("@things-factory/shell");
|
|
11
|
-
const kpi_grade_1 = require("./kpi-grade");
|
|
12
|
-
const ORMCONFIG = env_1.config.get('ormconfig', {});
|
|
13
|
-
const DATABASE_TYPE = ORMCONFIG.type;
|
|
14
|
-
let KpiGradeHistory = class KpiGradeHistory {
|
|
15
|
-
constructor() {
|
|
16
|
-
this.version = 1;
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
exports.KpiGradeHistory = KpiGradeHistory;
|
|
20
|
-
tslib_1.__decorate([
|
|
21
|
-
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
22
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
|
23
|
-
tslib_1.__metadata("design:type", String)
|
|
24
|
-
], KpiGradeHistory.prototype, "id", void 0);
|
|
25
|
-
tslib_1.__decorate([
|
|
26
|
-
(0, typeorm_1.Column)({ nullable: true, default: 1 }),
|
|
27
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
28
|
-
tslib_1.__metadata("design:type", Number)
|
|
29
|
-
], KpiGradeHistory.prototype, "version", void 0);
|
|
30
|
-
tslib_1.__decorate([
|
|
31
|
-
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
|
32
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
33
|
-
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
34
|
-
], KpiGradeHistory.prototype, "domain", void 0);
|
|
35
|
-
tslib_1.__decorate([
|
|
36
|
-
(0, typeorm_1.RelationId)((kpiGrade) => kpiGrade.domain),
|
|
37
|
-
tslib_1.__metadata("design:type", String)
|
|
38
|
-
], KpiGradeHistory.prototype, "domainId", void 0);
|
|
39
|
-
tslib_1.__decorate([
|
|
40
|
-
(0, typeorm_1.Column)(),
|
|
41
|
-
(0, type_graphql_1.Field)(),
|
|
42
|
-
tslib_1.__metadata("design:type", String)
|
|
43
|
-
], KpiGradeHistory.prototype, "name", void 0);
|
|
44
|
-
tslib_1.__decorate([
|
|
45
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
46
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
47
|
-
tslib_1.__metadata("design:type", String)
|
|
48
|
-
], KpiGradeHistory.prototype, "description", void 0);
|
|
49
|
-
tslib_1.__decorate([
|
|
50
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
51
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
52
|
-
tslib_1.__metadata("design:type", Boolean)
|
|
53
|
-
], KpiGradeHistory.prototype, "active", void 0);
|
|
54
|
-
tslib_1.__decorate([
|
|
55
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
56
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
57
|
-
tslib_1.__metadata("design:type", String)
|
|
58
|
-
], KpiGradeHistory.prototype, "state", void 0);
|
|
59
|
-
tslib_1.__decorate([
|
|
60
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
61
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
62
|
-
tslib_1.__metadata("design:type", String)
|
|
63
|
-
], KpiGradeHistory.prototype, "params", void 0);
|
|
64
|
-
tslib_1.__decorate([
|
|
65
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
66
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
67
|
-
tslib_1.__metadata("design:type", Date)
|
|
68
|
-
], KpiGradeHistory.prototype, "createdAt", void 0);
|
|
69
|
-
tslib_1.__decorate([
|
|
70
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
71
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
72
|
-
tslib_1.__metadata("design:type", Date)
|
|
73
|
-
], KpiGradeHistory.prototype, "updatedAt", void 0);
|
|
74
|
-
tslib_1.__decorate([
|
|
75
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
76
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
77
|
-
tslib_1.__metadata("design:type", Date)
|
|
78
|
-
], KpiGradeHistory.prototype, "deletedAt", void 0);
|
|
79
|
-
tslib_1.__decorate([
|
|
80
|
-
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
81
|
-
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
|
82
|
-
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
83
|
-
], KpiGradeHistory.prototype, "creator", void 0);
|
|
84
|
-
tslib_1.__decorate([
|
|
85
|
-
(0, typeorm_1.RelationId)((kpiGrade) => kpiGrade.creator),
|
|
86
|
-
tslib_1.__metadata("design:type", String)
|
|
87
|
-
], KpiGradeHistory.prototype, "creatorId", void 0);
|
|
88
|
-
tslib_1.__decorate([
|
|
89
|
-
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
90
|
-
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
|
91
|
-
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
92
|
-
], KpiGradeHistory.prototype, "updater", void 0);
|
|
93
|
-
tslib_1.__decorate([
|
|
94
|
-
(0, typeorm_1.RelationId)((kpiGrade) => kpiGrade.updater),
|
|
95
|
-
tslib_1.__metadata("design:type", String)
|
|
96
|
-
], KpiGradeHistory.prototype, "updaterId", void 0);
|
|
97
|
-
tslib_1.__decorate([
|
|
98
|
-
(0, type_graphql_1.Field)(type => String, { nullable: true }),
|
|
99
|
-
tslib_1.__metadata("design:type", String)
|
|
100
|
-
], KpiGradeHistory.prototype, "thumbnail", void 0);
|
|
101
|
-
tslib_1.__decorate([
|
|
102
|
-
(0, typeorm_history_1.HistoryOriginalIdColumn)(),
|
|
103
|
-
tslib_1.__metadata("design:type", String)
|
|
104
|
-
], KpiGradeHistory.prototype, "originalId", void 0);
|
|
105
|
-
tslib_1.__decorate([
|
|
106
|
-
(0, typeorm_history_1.HistoryActionColumn)({
|
|
107
|
-
nullable: false,
|
|
108
|
-
type: DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
|
|
109
|
-
? 'enum'
|
|
110
|
-
: DATABASE_TYPE == 'oracle'
|
|
111
|
-
? 'varchar2'
|
|
112
|
-
: DATABASE_TYPE == 'mssql'
|
|
113
|
-
? 'nvarchar'
|
|
114
|
-
: 'varchar',
|
|
115
|
-
enum: DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
|
|
116
|
-
? typeorm_history_1.HistoryActionType
|
|
117
|
-
: undefined,
|
|
118
|
-
length: DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb' ? undefined : 32
|
|
119
|
-
}),
|
|
120
|
-
tslib_1.__metadata("design:type", String)
|
|
121
|
-
], KpiGradeHistory.prototype, "action", void 0);
|
|
122
|
-
exports.KpiGradeHistory = KpiGradeHistory = tslib_1.__decorate([
|
|
123
|
-
(0, typeorm_1.Entity)(),
|
|
124
|
-
(0, typeorm_1.Index)('ix_kpi-grade_history_0', (kpiGradeHistory) => [kpiGradeHistory.originalId, kpiGradeHistory.version], { unique: true }),
|
|
125
|
-
(0, typeorm_1.Index)('ix_kpi-grade_history_1', (kpiGradeHistory) => [kpiGradeHistory.domain, kpiGradeHistory.originalId, kpiGradeHistory.version], { unique: true }),
|
|
126
|
-
(0, type_graphql_1.ObjectType)({ description: 'History Entity of KpiGrade' })
|
|
127
|
-
], KpiGradeHistory);
|
|
128
|
-
//# sourceMappingURL=kpi-grade-history.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"kpi-grade-history.js","sourceRoot":"","sources":["../../../server/service/kpi-grade/kpi-grade-history.ts"],"names":[],"mappings":";;;;AAAA,+CAAoD;AACpD,qCAA8F;AAE9F,8DAKiC;AACjC,yDAAsD;AACtD,6CAA4C;AAC5C,iDAA8C;AAE9C,2CAAsD;AAEtD,MAAM,SAAS,GAAG,YAAM,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;AAC7C,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAA;AAc7B,IAAM,eAAe,GAArB,MAAM,eAAe;IAArB;QAOL,YAAO,GAAY,CAAC,CAAA;IA8EtB,CAAC;CAAA,CAAA;AArFY,0CAAe;AAGjB;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,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AI,OAAO,IAAI,aAAa,IAAI,SAAS;YACnF,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,aAAa,IAAI,QAAQ;gBACzB,CAAC,CAAC,UAAU;gBACZ,CAAC,CAAC,aAAa,IAAI,OAAO;oBACxB,CAAC,CAAC,UAAU;oBACZ,CAAC,CAAC,SAAS;QACnB,IAAI,EACF,aAAa,IAAI,UAAU,IAAI,aAAa,IAAI,OAAO,IAAI,aAAa,IAAI,SAAS;YACnF,CAAC,CAAC,mCAAiB;YACnB,CAAC,CAAC,SAAS;QACf,MAAM,EAAE,aAAa,IAAI,UAAU,IAAI,aAAa,IAAI,OAAO,IAAI,aAAa,IAAI,SAAS,CAAC,CAAC,CAAC,SAAS,CAAA,CAAC,CAAC,EAAE;KAC9G,CAAC;;+CAC+B;0BApFtB,eAAe;IAZ3B,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EACJ,wBAAwB,EACxB,CAAC,eAAgC,EAAE,EAAE,CAAC,CAAC,eAAe,CAAC,UAAU,EAAE,eAAe,CAAC,OAAO,CAAC,EAC3F,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB;IACA,IAAA,eAAK,EACJ,wBAAwB,EACxB,CAAC,eAAgC,EAAE,EAAE,CAAC,CAAC,eAAe,CAAC,MAAM,EAAE,eAAe,CAAC,UAAU,EAAE,eAAe,CAAC,OAAO,CAAC,EACnH,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB;IACA,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,4BAA4B,EAAE,CAAC;GAC7C,eAAe,CAqF3B","sourcesContent":["import { Field, ID, ObjectType } from 'type-graphql'\nimport { Column, Entity, Index, ManyToOne, PrimaryGeneratedColumn, RelationId } from 'typeorm'\n\nimport {\n HistoryActionColumn,\n HistoryActionType,\n HistoryEntityInterface,\n HistoryOriginalIdColumn\n} from '@operato/typeorm-history'\nimport { Role, User } from '@things-factory/auth-base'\nimport { config } from '@things-factory/env'\nimport { Domain } from '@things-factory/shell'\n\nimport { KpiGrade, KpiGradeStatus } from './kpi-grade'\n\nconst ORMCONFIG = config.get('ormconfig', {})\nconst DATABASE_TYPE = ORMCONFIG.type\n\n@Entity()\n@Index(\n 'ix_kpi-grade_history_0',\n (kpiGradeHistory: KpiGradeHistory) => [kpiGradeHistory.originalId, kpiGradeHistory.version],\n { unique: true }\n)\n@Index(\n 'ix_kpi-grade_history_1',\n (kpiGradeHistory: KpiGradeHistory) => [kpiGradeHistory.domain, kpiGradeHistory.originalId, kpiGradeHistory.version],\n { unique: true }\n)\n@ObjectType({ description: 'History Entity of KpiGrade' })\nexport class KpiGradeHistory implements HistoryEntityInterface<KpiGrade> {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @Column({ nullable: true, default: 1 })\n @Field({ nullable: true })\n version?: number = 1\n\n @ManyToOne(type => Domain)\n @Field({ nullable: true })\n domain?: Domain\n\n @RelationId((kpiGrade: KpiGrade) => kpiGrade.domain)\n domainId?: string\n\n @Column()\n @Field()\n name: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n description?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n active?: boolean\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n state?: KpiGradeStatus\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n params?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n createdAt?: Date\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n updatedAt?: Date\n\n @Column({ nullable: true })\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((kpiGrade: KpiGrade) => kpiGrade.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((kpiGrade: KpiGrade) => kpiGrade.updater)\n updaterId?: string\n\n @Field(type => String, { nullable: true })\n thumbnail?: string\n\n @HistoryOriginalIdColumn()\n public originalId!: string\n\n @HistoryActionColumn({\n nullable: false,\n type:\n DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'\n ? 'enum'\n : DATABASE_TYPE == 'oracle'\n ? 'varchar2'\n : DATABASE_TYPE == 'mssql'\n ? 'nvarchar'\n : 'varchar',\n enum:\n DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'\n ? HistoryActionType\n : undefined,\n length: DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb' ? undefined: 32\n })\n public action!: HistoryActionType\n}\n"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { HistoryEntitySubscriber } from '@operato/typeorm-history';
|
|
2
|
-
import { KpiMetric } from './kpi-metric';
|
|
3
|
-
import { KpiMetricHistory } from './kpi-metric-history';
|
|
4
|
-
export declare class KpiMetricHistoryEntitySubscriber extends HistoryEntitySubscriber<KpiMetric, KpiMetricHistory> {
|
|
5
|
-
get entity(): typeof KpiMetric;
|
|
6
|
-
get historyEntity(): typeof KpiMetricHistory;
|
|
7
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.KpiMetricHistoryEntitySubscriber = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const typeorm_1 = require("typeorm");
|
|
6
|
-
const typeorm_history_1 = require("@operato/typeorm-history");
|
|
7
|
-
const kpi_metric_1 = require("./kpi-metric");
|
|
8
|
-
const kpi_metric_history_1 = require("./kpi-metric-history");
|
|
9
|
-
let KpiMetricHistoryEntitySubscriber = class KpiMetricHistoryEntitySubscriber extends typeorm_history_1.HistoryEntitySubscriber {
|
|
10
|
-
get entity() {
|
|
11
|
-
return kpi_metric_1.KpiMetric;
|
|
12
|
-
}
|
|
13
|
-
get historyEntity() {
|
|
14
|
-
return kpi_metric_history_1.KpiMetricHistory;
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
exports.KpiMetricHistoryEntitySubscriber = KpiMetricHistoryEntitySubscriber;
|
|
18
|
-
exports.KpiMetricHistoryEntitySubscriber = KpiMetricHistoryEntitySubscriber = tslib_1.__decorate([
|
|
19
|
-
(0, typeorm_1.EventSubscriber)()
|
|
20
|
-
], KpiMetricHistoryEntitySubscriber);
|
|
21
|
-
//# sourceMappingURL=event-subscriber.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"event-subscriber.js","sourceRoot":"","sources":["../../../server/service/kpi-metric/event-subscriber.ts"],"names":[],"mappings":";;;;AAAA,qCAAyC;AAEzC,8DAAkE;AAElE,6CAAwC;AACxC,6DAAuD;AAGhD,IAAM,gCAAgC,GAAtC,MAAM,gCAAiC,SAAQ,yCAAoD;IACxG,IAAW,MAAM;QACf,OAAO,sBAAS,CAAA;IAClB,CAAC;IAED,IAAW,aAAa;QACtB,OAAO,qCAAgB,CAAA;IACzB,CAAC;CACF,CAAA;AARY,4EAAgC;2CAAhC,gCAAgC;IAD5C,IAAA,yBAAe,GAAE;GACL,gCAAgC,CAQ5C","sourcesContent":["import { EventSubscriber } from 'typeorm'\n\nimport { HistoryEntitySubscriber } from '@operato/typeorm-history'\n\nimport { KpiMetric } from './kpi-metric'\nimport { KpiMetricHistory } from './kpi-metric-history'\n\n@EventSubscriber()\nexport class KpiMetricHistoryEntitySubscriber extends HistoryEntitySubscriber<KpiMetric, KpiMetricHistory> {\n public get entity() {\n return KpiMetric\n }\n\n public get historyEntity() {\n return KpiMetricHistory\n }\n}\n"]}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { HistoryActionType, HistoryEntityInterface } from '@operato/typeorm-history';
|
|
2
|
-
import { User } from '@things-factory/auth-base';
|
|
3
|
-
import { Domain } from '@things-factory/shell';
|
|
4
|
-
import { KpiMetric, KpiMetricStatus } from './kpi-metric';
|
|
5
|
-
export declare class KpiMetricHistory implements HistoryEntityInterface<KpiMetric> {
|
|
6
|
-
readonly id: string;
|
|
7
|
-
version?: number;
|
|
8
|
-
domain?: Domain;
|
|
9
|
-
domainId?: string;
|
|
10
|
-
name: string;
|
|
11
|
-
description?: string;
|
|
12
|
-
active?: boolean;
|
|
13
|
-
state?: KpiMetricStatus;
|
|
14
|
-
params?: string;
|
|
15
|
-
createdAt?: Date;
|
|
16
|
-
updatedAt?: Date;
|
|
17
|
-
deletedAt?: Date;
|
|
18
|
-
creator?: User;
|
|
19
|
-
creatorId?: string;
|
|
20
|
-
updater?: User;
|
|
21
|
-
updaterId?: string;
|
|
22
|
-
thumbnail?: string;
|
|
23
|
-
originalId: string;
|
|
24
|
-
action: HistoryActionType;
|
|
25
|
-
}
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.KpiMetricHistory = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const type_graphql_1 = require("type-graphql");
|
|
6
|
-
const typeorm_1 = require("typeorm");
|
|
7
|
-
const typeorm_history_1 = require("@operato/typeorm-history");
|
|
8
|
-
const auth_base_1 = require("@things-factory/auth-base");
|
|
9
|
-
const env_1 = require("@things-factory/env");
|
|
10
|
-
const shell_1 = require("@things-factory/shell");
|
|
11
|
-
const kpi_metric_1 = require("./kpi-metric");
|
|
12
|
-
const ORMCONFIG = env_1.config.get('ormconfig', {});
|
|
13
|
-
const DATABASE_TYPE = ORMCONFIG.type;
|
|
14
|
-
let KpiMetricHistory = class KpiMetricHistory {
|
|
15
|
-
constructor() {
|
|
16
|
-
this.version = 1;
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
exports.KpiMetricHistory = KpiMetricHistory;
|
|
20
|
-
tslib_1.__decorate([
|
|
21
|
-
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
22
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
|
23
|
-
tslib_1.__metadata("design:type", String)
|
|
24
|
-
], KpiMetricHistory.prototype, "id", void 0);
|
|
25
|
-
tslib_1.__decorate([
|
|
26
|
-
(0, typeorm_1.Column)({ nullable: true, default: 1 }),
|
|
27
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
28
|
-
tslib_1.__metadata("design:type", Number)
|
|
29
|
-
], KpiMetricHistory.prototype, "version", void 0);
|
|
30
|
-
tslib_1.__decorate([
|
|
31
|
-
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
|
32
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
33
|
-
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
34
|
-
], KpiMetricHistory.prototype, "domain", void 0);
|
|
35
|
-
tslib_1.__decorate([
|
|
36
|
-
(0, typeorm_1.RelationId)((kpiMetric) => kpiMetric.domain),
|
|
37
|
-
tslib_1.__metadata("design:type", String)
|
|
38
|
-
], KpiMetricHistory.prototype, "domainId", void 0);
|
|
39
|
-
tslib_1.__decorate([
|
|
40
|
-
(0, typeorm_1.Column)(),
|
|
41
|
-
(0, type_graphql_1.Field)(),
|
|
42
|
-
tslib_1.__metadata("design:type", String)
|
|
43
|
-
], KpiMetricHistory.prototype, "name", void 0);
|
|
44
|
-
tslib_1.__decorate([
|
|
45
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
46
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
47
|
-
tslib_1.__metadata("design:type", String)
|
|
48
|
-
], KpiMetricHistory.prototype, "description", void 0);
|
|
49
|
-
tslib_1.__decorate([
|
|
50
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
51
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
52
|
-
tslib_1.__metadata("design:type", Boolean)
|
|
53
|
-
], KpiMetricHistory.prototype, "active", void 0);
|
|
54
|
-
tslib_1.__decorate([
|
|
55
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
56
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
57
|
-
tslib_1.__metadata("design:type", String)
|
|
58
|
-
], KpiMetricHistory.prototype, "state", void 0);
|
|
59
|
-
tslib_1.__decorate([
|
|
60
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
61
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
62
|
-
tslib_1.__metadata("design:type", String)
|
|
63
|
-
], KpiMetricHistory.prototype, "params", void 0);
|
|
64
|
-
tslib_1.__decorate([
|
|
65
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
66
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
67
|
-
tslib_1.__metadata("design:type", Date)
|
|
68
|
-
], KpiMetricHistory.prototype, "createdAt", void 0);
|
|
69
|
-
tslib_1.__decorate([
|
|
70
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
71
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
72
|
-
tslib_1.__metadata("design:type", Date)
|
|
73
|
-
], KpiMetricHistory.prototype, "updatedAt", void 0);
|
|
74
|
-
tslib_1.__decorate([
|
|
75
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
76
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
77
|
-
tslib_1.__metadata("design:type", Date)
|
|
78
|
-
], KpiMetricHistory.prototype, "deletedAt", void 0);
|
|
79
|
-
tslib_1.__decorate([
|
|
80
|
-
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
81
|
-
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
|
82
|
-
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
83
|
-
], KpiMetricHistory.prototype, "creator", void 0);
|
|
84
|
-
tslib_1.__decorate([
|
|
85
|
-
(0, typeorm_1.RelationId)((kpiMetric) => kpiMetric.creator),
|
|
86
|
-
tslib_1.__metadata("design:type", String)
|
|
87
|
-
], KpiMetricHistory.prototype, "creatorId", void 0);
|
|
88
|
-
tslib_1.__decorate([
|
|
89
|
-
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
90
|
-
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
|
91
|
-
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
92
|
-
], KpiMetricHistory.prototype, "updater", void 0);
|
|
93
|
-
tslib_1.__decorate([
|
|
94
|
-
(0, typeorm_1.RelationId)((kpiMetric) => kpiMetric.updater),
|
|
95
|
-
tslib_1.__metadata("design:type", String)
|
|
96
|
-
], KpiMetricHistory.prototype, "updaterId", void 0);
|
|
97
|
-
tslib_1.__decorate([
|
|
98
|
-
(0, type_graphql_1.Field)(type => String, { nullable: true }),
|
|
99
|
-
tslib_1.__metadata("design:type", String)
|
|
100
|
-
], KpiMetricHistory.prototype, "thumbnail", void 0);
|
|
101
|
-
tslib_1.__decorate([
|
|
102
|
-
(0, typeorm_history_1.HistoryOriginalIdColumn)(),
|
|
103
|
-
tslib_1.__metadata("design:type", String)
|
|
104
|
-
], KpiMetricHistory.prototype, "originalId", void 0);
|
|
105
|
-
tslib_1.__decorate([
|
|
106
|
-
(0, typeorm_history_1.HistoryActionColumn)({
|
|
107
|
-
nullable: false,
|
|
108
|
-
type: DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
|
|
109
|
-
? 'enum'
|
|
110
|
-
: DATABASE_TYPE == 'oracle'
|
|
111
|
-
? 'varchar2'
|
|
112
|
-
: DATABASE_TYPE == 'mssql'
|
|
113
|
-
? 'nvarchar'
|
|
114
|
-
: 'varchar',
|
|
115
|
-
enum: DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
|
|
116
|
-
? typeorm_history_1.HistoryActionType
|
|
117
|
-
: undefined,
|
|
118
|
-
length: DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb' ? undefined : 32
|
|
119
|
-
}),
|
|
120
|
-
tslib_1.__metadata("design:type", String)
|
|
121
|
-
], KpiMetricHistory.prototype, "action", void 0);
|
|
122
|
-
exports.KpiMetricHistory = KpiMetricHistory = tslib_1.__decorate([
|
|
123
|
-
(0, typeorm_1.Entity)(),
|
|
124
|
-
(0, typeorm_1.Index)('ix_kpi-metric_history_0', (kpiMetricHistory) => [kpiMetricHistory.originalId, kpiMetricHistory.version], { unique: true }),
|
|
125
|
-
(0, typeorm_1.Index)('ix_kpi-metric_history_1', (kpiMetricHistory) => [kpiMetricHistory.domain, kpiMetricHistory.originalId, kpiMetricHistory.version], { unique: true }),
|
|
126
|
-
(0, type_graphql_1.ObjectType)({ description: 'History Entity of KpiMetric' })
|
|
127
|
-
], KpiMetricHistory);
|
|
128
|
-
//# sourceMappingURL=kpi-metric-history.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"kpi-metric-history.js","sourceRoot":"","sources":["../../../server/service/kpi-metric/kpi-metric-history.ts"],"names":[],"mappings":";;;;AAAA,+CAAoD;AACpD,qCAA8F;AAE9F,8DAKiC;AACjC,yDAAsD;AACtD,6CAA4C;AAC5C,iDAA8C;AAE9C,6CAAyD;AAEzD,MAAM,SAAS,GAAG,YAAM,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;AAC7C,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAA;AAc7B,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAAtB;QAOL,YAAO,GAAY,CAAC,CAAA;IA8EtB,CAAC;CAAA,CAAA;AArFY,4CAAgB;AAGlB;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;4CACC;AAInB;IAFC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IACtC,IAAA,oBAAK,EAAC,EAAE,QAA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CAAC,CAAC,SAAS;QACnB,IAAI,EACF,aAAa,IAAI,UAAU,IAAI,aAAa,IAAI,OAAO,IAAI,aAAa,IAAI,SAAS;YACnF,CAAC,CAAC,mCAAiB;YACnB,CAAC,CAAC,SAAS;QACf,MAAM,EAAE,aAAa,IAAI,UAAU,IAAI,aAAa,IAAI,OAAO,IAAI,aAAa,IAAI,SAAS,CAAC,CAAC,CAAC,SAAS,CAAA,CAAC,CAAC,EAAE;KAC9G,CAAC;;gDAC+B;2BApFtB,gBAAgB;IAZ5B,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EACJ,yBAAyB,EACzB,CAAC,gBAAkC,EAAE,EAAE,CAAC,CAAC,gBAAgB,CAAC,UAAU,EAAE,gBAAgB,CAAC,OAAO,CAAC,EAC/F,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB;IACA,IAAA,eAAK,EACJ,yBAAyB,EACzB,CAAC,gBAAkC,EAAE,EAAE,CAAC,CAAC,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,CAAC,UAAU,EAAE,gBAAgB,CAAC,OAAO,CAAC,EACxH,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB;IACA,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,6BAA6B,EAAE,CAAC;GAC9C,gBAAgB,CAqF5B","sourcesContent":["import { Field, ID, ObjectType } from 'type-graphql'\nimport { Column, Entity, Index, ManyToOne, PrimaryGeneratedColumn, RelationId } from 'typeorm'\n\nimport {\n HistoryActionColumn,\n HistoryActionType,\n HistoryEntityInterface,\n HistoryOriginalIdColumn\n} from '@operato/typeorm-history'\nimport { Role, User } from '@things-factory/auth-base'\nimport { config } from '@things-factory/env'\nimport { Domain } from '@things-factory/shell'\n\nimport { KpiMetric, KpiMetricStatus } from './kpi-metric'\n\nconst ORMCONFIG = config.get('ormconfig', {})\nconst DATABASE_TYPE = ORMCONFIG.type\n\n@Entity()\n@Index(\n 'ix_kpi-metric_history_0',\n (kpiMetricHistory: KpiMetricHistory) => [kpiMetricHistory.originalId, kpiMetricHistory.version],\n { unique: true }\n)\n@Index(\n 'ix_kpi-metric_history_1',\n (kpiMetricHistory: KpiMetricHistory) => [kpiMetricHistory.domain, kpiMetricHistory.originalId, kpiMetricHistory.version],\n { unique: true }\n)\n@ObjectType({ description: 'History Entity of KpiMetric' })\nexport class KpiMetricHistory implements HistoryEntityInterface<KpiMetric> {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @Column({ nullable: true, default: 1 })\n @Field({ nullable: true })\n version?: number = 1\n\n @ManyToOne(type => Domain)\n @Field({ nullable: true })\n domain?: Domain\n\n @RelationId((kpiMetric: KpiMetric) => kpiMetric.domain)\n domainId?: string\n\n @Column()\n @Field()\n name: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n description?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n active?: boolean\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n state?: KpiMetricStatus\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n params?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n createdAt?: Date\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n updatedAt?: Date\n\n @Column({ nullable: true })\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((kpiMetric: KpiMetric) => kpiMetric.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((kpiMetric: KpiMetric) => kpiMetric.updater)\n updaterId?: string\n\n @Field(type => String, { nullable: true })\n thumbnail?: string\n\n @HistoryOriginalIdColumn()\n public originalId!: string\n\n @HistoryActionColumn({\n nullable: false,\n type:\n DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'\n ? 'enum'\n : DATABASE_TYPE == 'oracle'\n ? 'varchar2'\n : DATABASE_TYPE == 'mssql'\n ? 'nvarchar'\n : 'varchar',\n enum:\n DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'\n ? HistoryActionType\n : undefined,\n length: DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb' ? undefined: 32\n })\n public action!: HistoryActionType\n}\n"]}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { EventSubscriber } from 'typeorm'
|
|
2
|
-
|
|
3
|
-
import { HistoryEntitySubscriber } from '@operato/typeorm-history'
|
|
4
|
-
|
|
5
|
-
import { KpiFormula } from './kpi-formula'
|
|
6
|
-
import { KpiFormulaHistory } from './kpi-formula-history'
|
|
7
|
-
|
|
8
|
-
@EventSubscriber()
|
|
9
|
-
export class KpiFormulaHistoryEntitySubscriber extends HistoryEntitySubscriber<KpiFormula, KpiFormulaHistory> {
|
|
10
|
-
public get entity() {
|
|
11
|
-
return KpiFormula
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
public get historyEntity() {
|
|
15
|
-
return KpiFormulaHistory
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { KpiFormula } from './kpi-formula'
|
|
2
|
-
import { KpiFormulaHistory } from './kpi-formula-history'
|
|
3
|
-
import { KpiFormulaHistoryEntitySubscriber } from './event-subscriber'
|
|
4
|
-
import { KpiFormulaQuery } from './kpi-formula-query'
|
|
5
|
-
import { KpiFormulaMutation } from './kpi-formula-mutation'
|
|
6
|
-
|
|
7
|
-
export const entities = [KpiFormula, KpiFormulaHistory]
|
|
8
|
-
export const resolvers = [KpiFormulaQuery, KpiFormulaMutation]
|
|
9
|
-
export const subscribers = [KpiFormulaHistoryEntitySubscriber]
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { Field, ID, ObjectType } from 'type-graphql'
|
|
2
|
-
import { Column, Entity, Index, ManyToOne, PrimaryGeneratedColumn, RelationId } from 'typeorm'
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
HistoryActionColumn,
|
|
6
|
-
HistoryActionType,
|
|
7
|
-
HistoryEntityInterface,
|
|
8
|
-
HistoryOriginalIdColumn
|
|
9
|
-
} from '@operato/typeorm-history'
|
|
10
|
-
import { Role, User } from '@things-factory/auth-base'
|
|
11
|
-
import { config } from '@things-factory/env'
|
|
12
|
-
import { Domain } from '@things-factory/shell'
|
|
13
|
-
|
|
14
|
-
import { KpiFormula, KpiFormulaStatus } from './kpi-formula'
|
|
15
|
-
|
|
16
|
-
const ORMCONFIG = config.get('ormconfig', {})
|
|
17
|
-
const DATABASE_TYPE = ORMCONFIG.type
|
|
18
|
-
|
|
19
|
-
@Entity()
|
|
20
|
-
@Index(
|
|
21
|
-
'ix_kpi-formula_history_0',
|
|
22
|
-
(kpiFormulaHistory: KpiFormulaHistory) => [kpiFormulaHistory.originalId, kpiFormulaHistory.version],
|
|
23
|
-
{ unique: true }
|
|
24
|
-
)
|
|
25
|
-
@Index(
|
|
26
|
-
'ix_kpi-formula_history_1',
|
|
27
|
-
(kpiFormulaHistory: KpiFormulaHistory) => [kpiFormulaHistory.domain, kpiFormulaHistory.originalId, kpiFormulaHistory.version],
|
|
28
|
-
{ unique: true }
|
|
29
|
-
)
|
|
30
|
-
@ObjectType({ description: 'History Entity of KpiFormula' })
|
|
31
|
-
export class KpiFormulaHistory implements HistoryEntityInterface<KpiFormula> {
|
|
32
|
-
@PrimaryGeneratedColumn('uuid')
|
|
33
|
-
@Field(type => ID)
|
|
34
|
-
readonly id: string
|
|
35
|
-
|
|
36
|
-
@Column({ nullable: true, default: 1 })
|
|
37
|
-
@Field({ nullable: true })
|
|
38
|
-
version?: number = 1
|
|
39
|
-
|
|
40
|
-
@ManyToOne(type => Domain)
|
|
41
|
-
@Field({ nullable: true })
|
|
42
|
-
domain?: Domain
|
|
43
|
-
|
|
44
|
-
@RelationId((kpiFormula: KpiFormula) => kpiFormula.domain)
|
|
45
|
-
domainId?: string
|
|
46
|
-
|
|
47
|
-
@Column()
|
|
48
|
-
@Field()
|
|
49
|
-
name: string
|
|
50
|
-
|
|
51
|
-
@Column({ nullable: true })
|
|
52
|
-
@Field({ nullable: true })
|
|
53
|
-
description?: string
|
|
54
|
-
|
|
55
|
-
@Column({ nullable: true })
|
|
56
|
-
@Field({ nullable: true })
|
|
57
|
-
active?: boolean
|
|
58
|
-
|
|
59
|
-
@Column({ nullable: true })
|
|
60
|
-
@Field({ nullable: true })
|
|
61
|
-
state?: KpiFormulaStatus
|
|
62
|
-
|
|
63
|
-
@Column({ nullable: true })
|
|
64
|
-
@Field({ nullable: true })
|
|
65
|
-
params?: string
|
|
66
|
-
|
|
67
|
-
@Column({ nullable: true })
|
|
68
|
-
@Field({ nullable: true })
|
|
69
|
-
createdAt?: Date
|
|
70
|
-
|
|
71
|
-
@Column({ nullable: true })
|
|
72
|
-
@Field({ nullable: true })
|
|
73
|
-
updatedAt?: Date
|
|
74
|
-
|
|
75
|
-
@Column({ nullable: true })
|
|
76
|
-
@Field({ nullable: true })
|
|
77
|
-
deletedAt?: Date
|
|
78
|
-
|
|
79
|
-
@ManyToOne(type => User, { nullable: true })
|
|
80
|
-
@Field(type => User, { nullable: true })
|
|
81
|
-
creator?: User
|
|
82
|
-
|
|
83
|
-
@RelationId((kpiFormula: KpiFormula) => kpiFormula.creator)
|
|
84
|
-
creatorId?: string
|
|
85
|
-
|
|
86
|
-
@ManyToOne(type => User, { nullable: true })
|
|
87
|
-
@Field(type => User, { nullable: true })
|
|
88
|
-
updater?: User
|
|
89
|
-
|
|
90
|
-
@RelationId((kpiFormula: KpiFormula) => kpiFormula.updater)
|
|
91
|
-
updaterId?: string
|
|
92
|
-
|
|
93
|
-
@Field(type => String, { nullable: true })
|
|
94
|
-
thumbnail?: string
|
|
95
|
-
|
|
96
|
-
@HistoryOriginalIdColumn()
|
|
97
|
-
public originalId!: string
|
|
98
|
-
|
|
99
|
-
@HistoryActionColumn({
|
|
100
|
-
nullable: false,
|
|
101
|
-
type:
|
|
102
|
-
DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
|
|
103
|
-
? 'enum'
|
|
104
|
-
: DATABASE_TYPE == 'oracle'
|
|
105
|
-
? 'varchar2'
|
|
106
|
-
: DATABASE_TYPE == 'mssql'
|
|
107
|
-
? 'nvarchar'
|
|
108
|
-
: 'varchar',
|
|
109
|
-
enum:
|
|
110
|
-
DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
|
|
111
|
-
? HistoryActionType
|
|
112
|
-
: undefined,
|
|
113
|
-
length: DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb' ? undefined: 32
|
|
114
|
-
})
|
|
115
|
-
public action!: HistoryActionType
|
|
116
|
-
}
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
|
|
2
|
-
import { In } from 'typeorm'
|
|
3
|
-
import { getRepository } from '@things-factory/shell'
|
|
4
|
-
|
|
5
|
-
import { KpiFormula } from './kpi-formula'
|
|
6
|
-
import { NewKpiFormula, KpiFormulaPatch } from './kpi-formula-type'
|
|
7
|
-
|
|
8
|
-
@Resolver(KpiFormula)
|
|
9
|
-
export class KpiFormulaMutation {
|
|
10
|
-
@Directive('@transaction')
|
|
11
|
-
@Mutation(returns => KpiFormula, { description: 'To create new KpiFormula' })
|
|
12
|
-
async createKpiFormula(@Arg('kpiFormula') kpiFormula: NewKpiFormula, @Ctx() context: ResolverContext): Promise<KpiFormula> {
|
|
13
|
-
const { domain, user, tx } = context.state
|
|
14
|
-
|
|
15
|
-
const result = await getRepository(KpiFormula, tx).save({
|
|
16
|
-
...kpiFormula,
|
|
17
|
-
domain,
|
|
18
|
-
creator: user,
|
|
19
|
-
updater: user
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
return result
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
@Directive('@transaction')
|
|
26
|
-
@Mutation(returns => KpiFormula, { description: 'To modify KpiFormula information' })
|
|
27
|
-
async updateKpiFormula(
|
|
28
|
-
@Arg('id') id: string,
|
|
29
|
-
@Arg('patch') patch: KpiFormulaPatch,
|
|
30
|
-
@Ctx() context: ResolverContext
|
|
31
|
-
): Promise<KpiFormula> {
|
|
32
|
-
const { domain, user, tx } = context.state
|
|
33
|
-
|
|
34
|
-
const repository = getRepository(KpiFormula, tx)
|
|
35
|
-
const kpiFormula = await repository.findOne({
|
|
36
|
-
where: { domain: { id: domain.id }, id }
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
const result = await repository.save({
|
|
40
|
-
...kpiFormula,
|
|
41
|
-
...patch,
|
|
42
|
-
updater: user
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
return result
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
@Directive('@transaction')
|
|
49
|
-
@Mutation(returns => [KpiFormula], { description: "To modify multiple KpiFormulas' information" })
|
|
50
|
-
async updateMultipleKpiFormula(
|
|
51
|
-
@Arg('patches', type => [KpiFormulaPatch]) patches: KpiFormulaPatch[],
|
|
52
|
-
@Ctx() context: ResolverContext
|
|
53
|
-
): Promise<KpiFormula[]> {
|
|
54
|
-
const { domain, user, tx } = context.state
|
|
55
|
-
|
|
56
|
-
let results = []
|
|
57
|
-
const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
|
|
58
|
-
const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
|
|
59
|
-
const kpiFormulaRepo = getRepository(KpiFormula, tx)
|
|
60
|
-
|
|
61
|
-
if (_createRecords.length > 0) {
|
|
62
|
-
for (let i = 0; i < _createRecords.length; i++) {
|
|
63
|
-
const newRecord = _createRecords[i]
|
|
64
|
-
|
|
65
|
-
const result = await kpiFormulaRepo.save({
|
|
66
|
-
...newRecord,
|
|
67
|
-
domain,
|
|
68
|
-
creator: user,
|
|
69
|
-
updater: user
|
|
70
|
-
})
|
|
71
|
-
|
|
72
|
-
results.push({ ...result, cuFlag: '+' })
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
if (_updateRecords.length > 0) {
|
|
77
|
-
for (let i = 0; i < _updateRecords.length; i++) {
|
|
78
|
-
const updateRecord = _updateRecords[i]
|
|
79
|
-
const kpiFormula = await kpiFormulaRepo.findOneBy({ id: updateRecord.id })
|
|
80
|
-
|
|
81
|
-
const result = await kpiFormulaRepo.save({
|
|
82
|
-
...kpiFormula,
|
|
83
|
-
...updateRecord,
|
|
84
|
-
updater: user
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
results.push({ ...result, cuFlag: 'M' })
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return results
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
@Directive('@transaction')
|
|
95
|
-
@Mutation(returns => Boolean, { description: 'To delete KpiFormula' })
|
|
96
|
-
async deleteKpiFormula(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
|
|
97
|
-
const { domain, tx } = context.state
|
|
98
|
-
|
|
99
|
-
await getRepository(KpiFormula, tx).delete({ domain: { id: domain.id }, id })
|
|
100
|
-
|
|
101
|
-
return true
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
@Directive('@transaction')
|
|
105
|
-
@Mutation(returns => Boolean, { description: 'To delete multiple KpiFormulas' })
|
|
106
|
-
async deleteKpiFormulas(
|
|
107
|
-
@Arg('ids', type => [String]) ids: string[],
|
|
108
|
-
@Ctx() context: ResolverContext
|
|
109
|
-
): Promise<boolean> {
|
|
110
|
-
const { domain, tx } = context.state
|
|
111
|
-
|
|
112
|
-
await getRepository(KpiFormula, tx).delete({
|
|
113
|
-
domain: { id: domain.id },
|
|
114
|
-
id: In(ids)
|
|
115
|
-
})
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
return true
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
@Directive('@transaction')
|
|
122
|
-
@Mutation(returns => Boolean, { description: 'To import multiple KpiFormulas' })
|
|
123
|
-
async importKpiFormulas(
|
|
124
|
-
@Arg('kpiFormulas', type => [KpiFormulaPatch]) kpiFormulas: KpiFormulaPatch[],
|
|
125
|
-
@Ctx() context: ResolverContext
|
|
126
|
-
): Promise<boolean> {
|
|
127
|
-
const { domain, tx } = context.state
|
|
128
|
-
|
|
129
|
-
await Promise.all(
|
|
130
|
-
kpiFormulas.map(async (kpiFormula: KpiFormulaPatch) => {
|
|
131
|
-
const createdKpiFormula: KpiFormula = await getRepository(KpiFormula, tx).save({ domain, ...kpiFormula })
|
|
132
|
-
})
|
|
133
|
-
)
|
|
134
|
-
|
|
135
|
-
return true
|
|
136
|
-
}
|
|
137
|
-
}
|