@things-factory/kpi 9.0.27 → 9.0.29

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.
Files changed (85) hide show
  1. package/client/pages/kpi-statistic/kpi-statistic-editor-page.ts +761 -0
  2. package/client/pages/kpi-statistic/kpi-statistic-importer.ts +90 -0
  3. package/client/pages/kpi-statistic/kpi-statistic-list-page.ts +505 -0
  4. package/client/route.ts +8 -0
  5. package/dist-client/pages/kpi-statistic/kpi-statistic-editor-page.d.ts +53 -0
  6. package/dist-client/pages/kpi-statistic/kpi-statistic-editor-page.js +718 -0
  7. package/dist-client/pages/kpi-statistic/kpi-statistic-editor-page.js.map +1 -0
  8. package/dist-client/pages/kpi-statistic/kpi-statistic-importer.d.ts +23 -0
  9. package/dist-client/pages/kpi-statistic/kpi-statistic-importer.js +92 -0
  10. package/dist-client/pages/kpi-statistic/kpi-statistic-importer.js.map +1 -0
  11. package/dist-client/pages/kpi-statistic/kpi-statistic-list-page.d.ts +66 -0
  12. package/dist-client/pages/kpi-statistic/kpi-statistic-list-page.js +487 -0
  13. package/dist-client/pages/kpi-statistic/kpi-statistic-list-page.js.map +1 -0
  14. package/dist-client/route.d.ts +1 -1
  15. package/dist-client/route.js +6 -0
  16. package/dist-client/route.js.map +1 -1
  17. package/dist-client/tsconfig.tsbuildinfo +1 -1
  18. package/dist-server/service/index.d.ts +3 -2
  19. package/dist-server/service/index.js +4 -0
  20. package/dist-server/service/index.js.map +1 -1
  21. package/dist-server/service/kpi/index.d.ts +1 -1
  22. package/dist-server/service/kpi/kpi-mutation.js +9 -0
  23. package/dist-server/service/kpi/kpi-mutation.js.map +1 -1
  24. package/dist-server/service/kpi/kpi-query.js +2 -0
  25. package/dist-server/service/kpi/kpi-query.js.map +1 -1
  26. package/dist-server/service/kpi-alert/kpi-alert-query.js +1 -0
  27. package/dist-server/service/kpi-alert/kpi-alert-query.js.map +1 -1
  28. package/dist-server/service/kpi-category/kpi-category-mutation.js +4 -0
  29. package/dist-server/service/kpi-category/kpi-category-mutation.js.map +1 -1
  30. package/dist-server/service/kpi-category/kpi-category-query.js +2 -0
  31. package/dist-server/service/kpi-category/kpi-category-query.js.map +1 -1
  32. package/dist-server/service/kpi-metric/kpi-metric-mutation.js +6 -0
  33. package/dist-server/service/kpi-metric/kpi-metric-mutation.js.map +1 -1
  34. package/dist-server/service/kpi-metric/kpi-metric-query.js +2 -0
  35. package/dist-server/service/kpi-metric/kpi-metric-query.js.map +1 -1
  36. package/dist-server/service/kpi-metric-value/kpi-metric-value-mutation.js +7 -0
  37. package/dist-server/service/kpi-metric-value/kpi-metric-value-mutation.js.map +1 -1
  38. package/dist-server/service/kpi-metric-value/kpi-metric-value-query.js +2 -0
  39. package/dist-server/service/kpi-metric-value/kpi-metric-value-query.js.map +1 -1
  40. package/dist-server/service/kpi-statistic/index.d.ts +6 -0
  41. package/dist-server/service/kpi-statistic/index.js +10 -0
  42. package/dist-server/service/kpi-statistic/index.js.map +1 -0
  43. package/dist-server/service/kpi-statistic/kpi-statistic-mutation.d.ts +10 -0
  44. package/dist-server/service/kpi-statistic/kpi-statistic-mutation.js +198 -0
  45. package/dist-server/service/kpi-statistic/kpi-statistic-mutation.js.map +1 -0
  46. package/dist-server/service/kpi-statistic/kpi-statistic-query.d.ts +13 -0
  47. package/dist-server/service/kpi-statistic/kpi-statistic-query.js +92 -0
  48. package/dist-server/service/kpi-statistic/kpi-statistic-query.js.map +1 -0
  49. package/dist-server/service/kpi-statistic/kpi-statistic-type.d.ts +59 -0
  50. package/dist-server/service/kpi-statistic/kpi-statistic-type.js +200 -0
  51. package/dist-server/service/kpi-statistic/kpi-statistic-type.js.map +1 -0
  52. package/dist-server/service/kpi-statistic/kpi-statistic.d.ts +38 -0
  53. package/dist-server/service/kpi-statistic/kpi-statistic.js +177 -0
  54. package/dist-server/service/kpi-statistic/kpi-statistic.js.map +1 -0
  55. package/dist-server/service/kpi-value/index.d.ts +1 -1
  56. package/dist-server/service/kpi-value/kpi-value-mutation.js +9 -0
  57. package/dist-server/service/kpi-value/kpi-value-mutation.js.map +1 -1
  58. package/dist-server/service/kpi-value/kpi-value-query.js +2 -0
  59. package/dist-server/service/kpi-value/kpi-value-query.js.map +1 -1
  60. package/dist-server/tsconfig.tsbuildinfo +1 -1
  61. package/helps/kpi/kpi-statistic.md +160 -0
  62. package/package.json +3 -3
  63. package/server/service/index.ts +8 -0
  64. package/server/service/kpi/kpi-mutation.ts +9 -0
  65. package/server/service/kpi/kpi-query.ts +2 -0
  66. package/server/service/kpi-alert/kpi-alert-query.ts +2 -1
  67. package/server/service/kpi-category/kpi-category-mutation.ts +4 -0
  68. package/server/service/kpi-category/kpi-category-query.ts +2 -0
  69. package/server/service/kpi-metric/kpi-metric-mutation.ts +6 -0
  70. package/server/service/kpi-metric/kpi-metric-query.ts +2 -0
  71. package/server/service/kpi-metric-value/kpi-metric-value-mutation.ts +7 -0
  72. package/server/service/kpi-metric-value/kpi-metric-value-query.ts +3 -1
  73. package/server/service/kpi-statistic/index.ts +7 -0
  74. package/server/service/kpi-statistic/kpi-statistic-mutation.ts +194 -0
  75. package/server/service/kpi-statistic/kpi-statistic-query.ts +59 -0
  76. package/server/service/kpi-statistic/kpi-statistic-type.ts +152 -0
  77. package/server/service/kpi-statistic/kpi-statistic.ts +167 -0
  78. package/server/service/kpi-value/kpi-value-mutation.ts +9 -0
  79. package/server/service/kpi-value/kpi-value-query.ts +2 -0
  80. package/things-factory.config.js +3 -1
  81. package/translations/en.json +23 -1
  82. package/translations/ja.json +42 -20
  83. package/translations/ko.json +29 -7
  84. package/translations/ms.json +34 -12
  85. package/translations/zh.json +38 -16
@@ -0,0 +1,160 @@
1
+ # KpiStatistic
2
+
3
+ Paragraphs are separated by a blank line.
4
+
5
+ 2nd paragraph. _Italic_, **bold**, and `monospace`. Itemized lists
6
+ look like:
7
+
8
+ - this one
9
+ - that one
10
+ - the other one
11
+
12
+ Note that --- not considering the asterisk --- the actual text
13
+ content starts at 4-columns in.
14
+
15
+ > Block quotes are
16
+ > written like so.
17
+ >
18
+ > They can span multiple paragraphs,
19
+ > if you like.
20
+
21
+ Use 3 dashes for an em-dash. Use 2 dashes for ranges (ex., "it's all
22
+ in chapters 12--14"). Three dots ... will be converted to an ellipsis.
23
+ Unicode is supported. ☺
24
+
25
+ ## An h2 header
26
+
27
+ Here's a numbered list:
28
+
29
+ 1. first item
30
+ 2. second item
31
+ 3. third item
32
+
33
+ Note again how the actual text starts at 4 columns in (4 characters
34
+ from the left side). Here's a code sample:
35
+
36
+ # Let me re-iterate ...
37
+
38
+ for i in 1 .. 10 { do-something(i) }
39
+
40
+ As you probably guessed, indented 4 spaces. By the way, instead of
41
+ indenting the block, you can use delimited blocks, if you like:
42
+
43
+ ```
44
+ define foobar() {
45
+ print "Welcome to flavor country!";
46
+ }
47
+ ```
48
+
49
+ (which makes copying & pasting easier). You can optionally mark the
50
+ delimited block for Pandoc to syntax highlight it:
51
+
52
+ ```python
53
+ import time
54
+ # Quick, count to ten!
55
+ for i in range(10):
56
+ # (but not *too* quick)
57
+ time.sleep(0.5)
58
+ print(i)
59
+ ```
60
+
61
+ ### An h3 header
62
+
63
+ Now a nested list:
64
+
65
+ 1. First, get these ingredients:
66
+
67
+ - carrots
68
+ - celery
69
+ - lentils
70
+
71
+ 2. Boil some water.
72
+
73
+ 3. Dump everything in the pot and follow
74
+ this algorithm:
75
+
76
+ find wooden spoon
77
+ uncover pot
78
+ stir
79
+ cover pot
80
+ balance wooden spoon precariously on pot handle
81
+ wait 10 minutes
82
+ goto first step (or shut off burner when done)
83
+
84
+ Do not bump wooden spoon or it will fall.
85
+
86
+ Notice again how text always lines up on 4-space indents (including
87
+ that last line which continues item 3 above).
88
+
89
+ Here's a link to [a website](http://foo.bar), to a [local
90
+ doc](local-doc.html), and to a [section heading in the current
91
+ doc](#an-h2-header). Here's a footnote [^1].
92
+
93
+ [^1]: Some footnote text.
94
+
95
+ Tables can look like this:
96
+
97
+ Name Size Material Color
98
+
99
+ ---
100
+
101
+ All Business 9 leather brown
102
+ Roundabout 10 hemp canvas natural
103
+ Cinderella 11 glass transparent
104
+
105
+ Table: Shoes sizes, materials, and colors.
106
+
107
+ (The above is the caption for the table.) Pandoc also supports
108
+ multi-line tables:
109
+
110
+ ---
111
+
112
+ Keyword Text
113
+
114
+ ---
115
+
116
+ red Sunsets, apples, and
117
+ other red or reddish
118
+ things.
119
+
120
+ green Leaves, grass, frogs
121
+ and other things it's
122
+ not easy being.
123
+
124
+ ---
125
+
126
+ A horizontal rule follows.
127
+
128
+ ---
129
+
130
+ Here's a definition list:
131
+
132
+ apples
133
+ : Good for making applesauce.
134
+
135
+ oranges
136
+ : Citrus!
137
+
138
+ tomatoes
139
+ : There's no "e" in tomatoe.
140
+
141
+ Again, text is indented 4 spaces. (Put a blank line between each
142
+ term and its definition to spread things out more.)
143
+
144
+ Here's a "line block" (note how whitespace is honored):
145
+
146
+ | Line one
147
+ | Line too
148
+ | Line tree
149
+
150
+ and images can be specified like so:
151
+
152
+ ![example image](example-image.jpg 'An exemplary image')
153
+
154
+ Inline math equation: $\omega = d\phi / dt$. Display
155
+ math should get its own line like so:
156
+
157
+ $$I = \int \rho R^{2} dV$$
158
+
159
+ And note that you can backslash-escape any punctuation characters
160
+ which you wish to be displayed literally, ex.: \`foo\`, \*bar\*, etc.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/kpi",
3
- "version": "9.0.27",
3
+ "version": "9.0.29",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "things-factory": true,
@@ -41,8 +41,8 @@
41
41
  "@operato/styles": "^9.0.0",
42
42
  "@operato/utils": "^9.0.0",
43
43
  "@things-factory/auth-base": "^9.0.25",
44
- "@things-factory/dataset": "^9.0.27",
44
+ "@things-factory/dataset": "^9.0.28",
45
45
  "@things-factory/shell": "^9.0.25"
46
46
  },
47
- "gitHead": "7dbcca8920f72218807a5583c510df97fe2102ba"
47
+ "gitHead": "7e3b1a58f5c971d960bb7ca88ccc3fca4c4bd08d"
48
48
  }
@@ -1,4 +1,5 @@
1
1
  /* EXPORT ENTITY TYPES */
2
+ export * from './kpi-statistic/kpi-statistic'
2
3
  export * from './kpi/kpi'
3
4
  export * from './kpi/kpi-type'
4
5
  export * from './kpi-category/kpi-category'
@@ -14,6 +15,11 @@ export * from './kpi-metric-value/kpi-metric-value-type'
14
15
  export * from './kpi-alert'
15
16
 
16
17
  /* IMPORT ENTITIES AND RESOLVERS */
18
+ import {
19
+ entities as KpiStatisticEntities,
20
+ resolvers as KpiStatisticResolvers,
21
+ subscribers as KpiStatisticSubscribers
22
+ } from './kpi-statistic'
17
23
  import { entities as KpiEntities, resolvers as KpiResolvers } from './kpi'
18
24
  import { entities as KpiCategoryEntities, resolvers as KpiCategoryResolvers } from './kpi-category'
19
25
  import { entities as KpiCategoryValueEntities, resolvers as KpiCategoryValueResolvers } from './kpi-category-value'
@@ -24,6 +30,7 @@ import { resolvers as KpiAlertResolvers } from './kpi-alert'
24
30
 
25
31
  export const entities = [
26
32
  /* ENTITIES */
33
+ ...KpiStatisticEntities,
27
34
  ...KpiEntities,
28
35
  ...KpiCategoryEntities,
29
36
  ...KpiCategoryValueEntities,
@@ -35,6 +42,7 @@ export const entities = [
35
42
  export const schema = {
36
43
  resolverClasses: [
37
44
  /* RESOLVER CLASSES */
45
+ ...KpiStatisticResolvers,
38
46
  ...KpiResolvers,
39
47
  ...KpiCategoryResolvers,
40
48
  ...KpiCategoryValueResolvers,
@@ -21,6 +21,7 @@ import { KpiMetricValueProvider } from '../../controllers/kpi-metric-value-provi
21
21
  @Resolver(Kpi)
22
22
  export class KpiMutation {
23
23
  @Directive('@transaction')
24
+ @Directive('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)')
24
25
  @Mutation(returns => Kpi, { description: 'Create a new KPI with the provided details.' })
25
26
  async createKpi(
26
27
  @Arg('kpi', { description: 'Input object containing details for the new KPI.' }) kpi: NewKpi,
@@ -103,6 +104,7 @@ export class KpiMutation {
103
104
  }
104
105
 
105
106
  @Directive('@transaction')
107
+ @Directive('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)')
106
108
  @Mutation(returns => Kpi, { description: 'To modify Kpi information' })
107
109
  async updateKpi(@Arg('id') id: string, @Arg('patch') patch: KpiPatch, @Ctx() context: ResolverContext): Promise<Kpi> {
108
110
  const { domain, user, tx } = context.state
@@ -197,6 +199,7 @@ export class KpiMutation {
197
199
  }
198
200
 
199
201
  @Directive('@transaction')
202
+ @Directive('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)')
200
203
  @Mutation(returns => [Kpi], { description: "To modify multiple Kpis' information" })
201
204
  async updateMultipleKpi(
202
205
  @Arg('patches', type => [KpiPatch]) patches: KpiPatch[],
@@ -272,6 +275,7 @@ export class KpiMutation {
272
275
  }
273
276
 
274
277
  @Directive('@transaction')
278
+ @Directive('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)')
275
279
  @Mutation(returns => Boolean, { description: 'To delete Kpi' })
276
280
  async deleteKpi(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
277
281
  const { domain, tx } = context.state
@@ -288,6 +292,7 @@ export class KpiMutation {
288
292
  }
289
293
 
290
294
  @Directive('@transaction')
295
+ @Directive('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)')
291
296
  @Mutation(returns => Boolean, { description: 'To delete multiple Kpis' })
292
297
  async deleteKpis(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<boolean> {
293
298
  const { domain, tx } = context.state
@@ -303,6 +308,7 @@ export class KpiMutation {
303
308
  }
304
309
 
305
310
  @Directive('@transaction')
311
+ @Directive('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)')
306
312
  @Mutation(returns => Boolean, { description: 'To import multiple Kpis' })
307
313
  async importKpis(
308
314
  @Arg('kpis', type => [KpiPatch]) kpis: KpiPatch[],
@@ -320,6 +326,7 @@ export class KpiMutation {
320
326
  }
321
327
 
322
328
  @Directive('@transaction')
329
+ @Directive('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)')
323
330
  @Mutation(returns => Kpi, { description: 'Release a KPI and create a version history.' })
324
331
  async releaseKpi(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Kpi> {
325
332
  const { domain, user, tx } = context.state
@@ -350,6 +357,7 @@ export class KpiMutation {
350
357
  }
351
358
 
352
359
  @Directive('@transaction')
360
+ @Directive('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)')
353
361
  @Mutation(returns => Kpi, { description: 'Revert a KPI to a specific historical version.' })
354
362
  async revertKpiVersion(
355
363
  @Arg('id') id: string,
@@ -387,6 +395,7 @@ export class KpiMutation {
387
395
  }
388
396
 
389
397
  @Directive('@transaction')
398
+ @Directive('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)')
390
399
  @Mutation(returns => KpiValue, { description: 'KPI 기준으로 formula 계산 및 KPI Value upsert' })
391
400
  async calculateKpiValue(
392
401
  @Arg('kpiId') kpiId: string,
@@ -11,6 +11,7 @@ import { KpiCategory } from '../kpi-category/kpi-category'
11
11
 
12
12
  @Resolver(Kpi)
13
13
  export class KpiQuery {
14
+ @Directive('@privilege(category: "kpi", privilege: "query", domainOwnerGranted: true, superUserGranted: true)')
14
15
  @Query(returns => Kpi!, { nullable: true, description: 'Fetch a single KPI by its unique identifier.' })
15
16
  async kpi(
16
17
  @Arg('id', { description: 'Unique identifier of the KPI to fetch.' }) id: string,
@@ -23,6 +24,7 @@ export class KpiQuery {
23
24
  })
24
25
  }
25
26
 
27
+ @Directive('@privilege(category: "kpi", privilege: "query", domainOwnerGranted: true, superUserGranted: true)')
26
28
  @Query(returns => KpiList, { description: 'To fetch multiple Kpis' })
27
29
  async kpis(@Args(type => ListParam) params: ListParam, @Ctx() context: ResolverContext): Promise<KpiList> {
28
30
  const { domain } = context.state
@@ -1,4 +1,4 @@
1
- import { Resolver, Query, Ctx } from 'type-graphql'
1
+ import { Directive, Resolver, Query, Ctx } from 'type-graphql'
2
2
  import { getRepository } from '@things-factory/shell'
3
3
  import { Kpi } from '../kpi/kpi'
4
4
  import { KpiValue } from '../kpi-value/kpi-value'
@@ -6,6 +6,7 @@ import { KpiAlert } from './kpi-alert-type'
6
6
 
7
7
  @Resolver()
8
8
  export class KpiAlertQuery {
9
+ @Directive('@privilege(category: "kpi", privilege: "query", domainOwnerGranted: true, superUserGranted: true)')
9
10
  @Query(returns => [KpiAlert], { description: 'KPI 실적/등급/목표 미달 등 경고/알림 리스트 반환' })
10
11
  async kpiAlerts(@Ctx() context): Promise<KpiAlert[]> {
11
12
  const { domain } = context.state
@@ -15,6 +15,7 @@ import { KpiCategoryValue } from '../kpi-category-value/kpi-category-value'
15
15
  @Resolver(KpiCategory)
16
16
  export class KpiCategoryMutation {
17
17
  @Directive('@transaction')
18
+ @Directive('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)')
18
19
  @Mutation(returns => KpiCategory, { description: 'Create a new KPI category.' })
19
20
  async createKpiCategory(
20
21
  @Arg('kpiCategory') kpiCategory: NewKpiCategory,
@@ -33,6 +34,7 @@ export class KpiCategoryMutation {
33
34
  }
34
35
 
35
36
  @Directive('@transaction')
37
+ @Directive('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)')
36
38
  @Mutation(returns => KpiCategory, { description: 'Update an existing KPI category.' })
37
39
  async updateKpiCategory(
38
40
  @Arg('id') id: string,
@@ -57,6 +59,7 @@ export class KpiCategoryMutation {
57
59
  }
58
60
 
59
61
  @Directive('@transaction')
62
+ @Directive('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)')
60
63
  @Mutation(returns => Boolean, { description: 'Delete a KPI category.' })
61
64
  async deleteKpiCategory(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
62
65
  const { domain, tx } = context.state
@@ -73,6 +76,7 @@ export class KpiCategoryMutation {
73
76
  }
74
77
 
75
78
  @Directive('@transaction')
79
+ @Directive('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)')
76
80
  @Mutation(returns => KpiCategoryValueResult, { description: 'Calculate KPI category value and score.' })
77
81
  async calculateKpiValue(
78
82
  @Arg('categoryId') categoryId: string,
@@ -27,6 +27,7 @@ export class KpiCategoryValueResult {
27
27
 
28
28
  @Resolver(KpiCategory)
29
29
  export class KpiCategoryQuery {
30
+ @Directive('@privilege(category: "kpi", privilege: "query", domainOwnerGranted: true, superUserGranted: true)')
30
31
  @Query(returns => KpiCategory!, {
31
32
  nullable: true,
32
33
  description: 'Fetch a single KPI category by its unique identifier.'
@@ -42,6 +43,7 @@ export class KpiCategoryQuery {
42
43
  })
43
44
  }
44
45
 
46
+ @Directive('@privilege(category: "kpi", privilege: "query", domainOwnerGranted: true, superUserGranted: true)')
45
47
  @Query(returns => KpiCategoryList, { description: 'To fetch multiple KpiCategories' })
46
48
  async kpiCategories(
47
49
  @Args(type => ListParam) params: ListParam,
@@ -12,6 +12,7 @@ import { registerSchedule, unregisterSchedule, CallbackBase, Application } from
12
12
  @Resolver(KpiMetric)
13
13
  export class KpiMetricMutation {
14
14
  @Directive('@transaction')
15
+ @Directive('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)')
15
16
  @Mutation(returns => KpiMetric, { description: 'Create a new KPI metric with the provided details.' })
16
17
  async createKpiMetric(
17
18
  @Arg('kpiMetric', { description: 'Input object containing details for the new KPI metric.' })
@@ -90,6 +91,7 @@ export class KpiMetricMutation {
90
91
  }
91
92
 
92
93
  @Directive('@transaction')
94
+ @Directive('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)')
93
95
  @Mutation(returns => KpiMetric, { description: 'To modify KpiMetric information' })
94
96
  async updateKpiMetric(
95
97
  @Arg('id') id: string,
@@ -177,6 +179,7 @@ export class KpiMetricMutation {
177
179
  }
178
180
 
179
181
  @Directive('@transaction')
182
+ @Directive('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)')
180
183
  @Mutation(returns => [KpiMetric], { description: "To modify multiple KpiMetrics' information" })
181
184
  async updateMultipleKpiMetric(
182
185
  @Arg('patches', type => [KpiMetricPatch]) patches: KpiMetricPatch[],
@@ -252,6 +255,7 @@ export class KpiMetricMutation {
252
255
  }
253
256
 
254
257
  @Directive('@transaction')
258
+ @Directive('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)')
255
259
  @Mutation(returns => Boolean, { description: 'To delete KpiMetric' })
256
260
  async deleteKpiMetric(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
257
261
  const { domain, tx } = context.state
@@ -267,6 +271,7 @@ export class KpiMetricMutation {
267
271
  }
268
272
 
269
273
  @Directive('@transaction')
274
+ @Directive('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)')
270
275
  @Mutation(returns => Boolean, { description: 'To delete multiple KpiMetrics' })
271
276
  async deleteKpiMetrics(
272
277
  @Arg('ids', type => [String]) ids: string[],
@@ -285,6 +290,7 @@ export class KpiMetricMutation {
285
290
  }
286
291
 
287
292
  @Directive('@transaction')
293
+ @Directive('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)')
288
294
  @Mutation(returns => Boolean, { description: 'To import multiple KpiMetrics' })
289
295
  async importKpiMetrics(
290
296
  @Arg('kpiMetrics', type => [KpiMetricPatch]) kpiMetrics: KpiMetricPatch[],
@@ -7,6 +7,7 @@ import { KpiMetricList } from './kpi-metric-type'
7
7
 
8
8
  @Resolver(KpiMetric)
9
9
  export class KpiMetricQuery {
10
+ @Directive('@privilege(category: "kpi", privilege: "query", domainOwnerGranted: true, superUserGranted: true)')
10
11
  @Query(returns => KpiMetric!, { nullable: true, description: 'Fetch a single KPI metric by its unique identifier.' })
11
12
  async kpiMetric(
12
13
  @Arg('id', { description: 'Unique identifier of the KPI metric to fetch.' }) id: string,
@@ -19,6 +20,7 @@ export class KpiMetricQuery {
19
20
  })
20
21
  }
21
22
 
23
+ @Directive('@privilege(category: "kpi", privilege: "query", domainOwnerGranted: true, superUserGranted: true)')
22
24
  @Query(returns => KpiMetricList, { description: 'To fetch multiple KpiMetrics' })
23
25
  async kpiMetrics(
24
26
  @Args(type => ListParam) params: ListParam,
@@ -13,6 +13,7 @@ import { getDefaultValueDate } from '../utils/value-date-util'
13
13
  @Resolver(KpiMetricValue)
14
14
  export class KpiMetricValueMutation {
15
15
  @Directive('@transaction')
16
+ @Directive('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)')
16
17
  @Mutation(returns => KpiMetricValue, { description: 'Create a new metric value with the provided details.' })
17
18
  async createKpiMetricValue(
18
19
  @Arg('metricValue', { description: 'Input object containing details for the new metric value.' })
@@ -58,6 +59,7 @@ export class KpiMetricValueMutation {
58
59
  }
59
60
 
60
61
  @Directive('@transaction')
62
+ @Directive('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)')
61
63
  @Mutation(returns => KpiMetricValue, { description: 'Record a metric value by metric name, value, meta, and group.' })
62
64
  async recordKpiMetricValue(
63
65
  @Arg('metricName', { description: 'Metric code/name.' }) metricName: string,
@@ -108,6 +110,7 @@ export class KpiMetricValueMutation {
108
110
  }
109
111
 
110
112
  @Directive('@transaction')
113
+ @Directive('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)')
111
114
  @Mutation(returns => KpiMetricValue, { description: 'To modify KpiMetricValue information' })
112
115
  async updateKpiMetricValue(
113
116
  @Arg('id') id: string,
@@ -136,6 +139,7 @@ export class KpiMetricValueMutation {
136
139
  }
137
140
 
138
141
  @Directive('@transaction')
142
+ @Directive('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)')
139
143
  @Mutation(returns => [KpiMetricValue], { description: "To modify multiple KpiMetricValues' information" })
140
144
  async updateMultipleKpiMetricValue(
141
145
  @Arg('patches', type => [KpiMetricValuePatch]) patches: KpiMetricValuePatch[],
@@ -206,6 +210,7 @@ export class KpiMetricValueMutation {
206
210
  }
207
211
 
208
212
  @Directive('@transaction')
213
+ @Directive('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)')
209
214
  @Mutation(returns => Boolean, { description: 'To delete KpiMetricValue' })
210
215
  async deleteKpiMetricValue(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
211
216
  const { domain, tx } = context.state
@@ -214,6 +219,7 @@ export class KpiMetricValueMutation {
214
219
  }
215
220
 
216
221
  @Directive('@transaction')
222
+ @Directive('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)')
217
223
  @Mutation(returns => Boolean, { description: 'To delete multiple KpiMetricValues' })
218
224
  async deleteKpiMetricValues(
219
225
  @Arg('ids', type => [String]) ids: string[],
@@ -228,6 +234,7 @@ export class KpiMetricValueMutation {
228
234
  }
229
235
 
230
236
  @Directive('@transaction')
237
+ @Directive('@privilege(category: "kpi", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)')
231
238
  @Mutation(returns => Boolean, { description: 'To import multiple KpiMetricValues' })
232
239
  async importKpiMetricValues(
233
240
  @Arg('metricValues', type => [KpiMetricValuePatch]) metricValues: KpiMetricValuePatch[],
@@ -1,4 +1,4 @@
1
- import { Resolver, Query, Args, Arg, Ctx, FieldResolver, Root } from 'type-graphql'
1
+ import { Directive, Resolver, Query, Args, Arg, Ctx, FieldResolver, Root } from 'type-graphql'
2
2
  import { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
3
3
  import { User } from '@things-factory/auth-base'
4
4
  import { KpiMetricValue } from './kpi-metric-value'
@@ -7,6 +7,7 @@ import { KpiMetric } from '../kpi-metric/kpi-metric'
7
7
 
8
8
  @Resolver(KpiMetricValue)
9
9
  export class KpiMetricValueQuery {
10
+ @Directive('@privilege(category: "kpi", privilege: "query", domainOwnerGranted: true, superUserGranted: true)')
10
11
  @Query(returns => KpiMetricValueList, { description: 'To fetch multiple KpiMetricValues' })
11
12
  async kpiMetricValues(
12
13
  @Args(type => ListParam) params: ListParam,
@@ -23,6 +24,7 @@ export class KpiMetricValueQuery {
23
24
  return { items, total }
24
25
  }
25
26
 
27
+ @Directive('@privilege(category: "kpi", privilege: "query", domainOwnerGranted: true, superUserGranted: true)')
26
28
  @Query(returns => KpiMetricValue, {
27
29
  nullable: true,
28
30
  description: 'Fetch a single metric value by its unique identifier.'
@@ -0,0 +1,7 @@
1
+ import { KpiStatistic } from './kpi-statistic.js'
2
+ import { KpiStatisticQuery } from './kpi-statistic-query.js'
3
+ import { KpiStatisticMutation } from './kpi-statistic-mutation.js'
4
+
5
+ export const entities = [KpiStatistic]
6
+ export const resolvers = [KpiStatisticQuery, KpiStatisticMutation]
7
+ export const subscribers = []