@hedhog/admin 0.12.4 → 0.12.6

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/hedhog.yaml CHANGED
@@ -342,55 +342,6 @@ data:
342
342
  icon: world
343
343
  url: /settings/locale
344
344
  slug: /settings/locale
345
- - name:
346
- en: TranslationNamespace
347
- pt: TranslationNamespace
348
- icon: file
349
- url: /translation-namespace
350
- slug: translation-namespace
351
- relations: *a1
352
- - name:
353
- en: Translation
354
- pt: Translation
355
- icon: file
356
- url: /translation
357
- slug: translation
358
- relations: *a2
359
- - name:
360
- en: Multifactor
361
- pt: Multifactor
362
- icon: file
363
- url: /multifactor
364
- slug: multifactor
365
- relations: *a3
366
- - name:
367
- en: User
368
- pt: User
369
- icon: file
370
- url: /user
371
- slug: user
372
- relations: *a4
373
- - name:
374
- en: Screen
375
- pt: Screen
376
- icon: file
377
- url: /screen
378
- slug: screen
379
- relations: *a5
380
- - name:
381
- en: Menu
382
- pt: Menu
383
- icon: file
384
- url: /menu
385
- slug: menu
386
- relations: *a6
387
- - name:
388
- en: MenuScreen
389
- pt: MenuScreen
390
- icon: file
391
- url: /menu-screen
392
- slug: menu-screen
393
- relations: *a7
394
345
  screen:
395
346
  - slug: /management/user
396
347
  icon: user
@@ -477,7 +428,7 @@ data:
477
428
  description:
478
429
  en: Screen to manage a group of settings
479
430
  pt: Tela para gerenciar grupo de configurações
480
- icon: file
431
+ icon: settings
481
432
  - name:
482
433
  en: Setting User
483
434
  pt: Configuração de Usuário
@@ -485,7 +436,7 @@ data:
485
436
  description:
486
437
  en: Screen to manage user settings
487
438
  pt: Tela para gerenciar configurações de usuário
488
- icon: file
439
+ icon: user-cog
489
440
  - name:
490
441
  en: Locale
491
442
  pt: Locale
@@ -493,68 +444,12 @@ data:
493
444
  description:
494
445
  en: Screen to manage locale
495
446
  pt: Tela para gerenciar localização/tradução
496
- icon: file
447
+ icon: world
497
448
  relations:
498
449
  route:
499
450
  - where:
500
451
  url:
501
452
  like: /locale%
502
- - name:
503
- en: TranslationNamespace
504
- pt: TranslationNamespace
505
- slug: translation-namespace
506
- description:
507
- en: Screen to manage translation_namespace
508
- pt: Tela para gerenciar translation_namespace
509
- icon: file
510
- - name:
511
- en: Translation
512
- pt: Translation
513
- slug: translation
514
- description:
515
- en: Screen to manage translation
516
- pt: Tela para gerenciar translation
517
- icon: file
518
- - name:
519
- en: Multifactor
520
- pt: Multifactor
521
- slug: multifactor
522
- description:
523
- en: Screen to manage multifactor
524
- pt: Tela para gerenciar multifactor
525
- icon: file
526
- - name:
527
- en: User
528
- pt: User
529
- slug: user
530
- description:
531
- en: Screen to manage user
532
- pt: Tela para gerenciar user
533
- icon: file
534
- - name:
535
- en: Screen
536
- pt: Screen
537
- slug: screen
538
- description:
539
- en: Screen to manage screen
540
- pt: Tela para gerenciar screen
541
- icon: file
542
- - name:
543
- en: Menu
544
- pt: Menu
545
- slug: menu
546
- description:
547
- en: Screen to manage menu
548
- pt: Tela para gerenciar menu
549
- icon: file
550
- - name:
551
- en: MenuScreen
552
- pt: MenuScreen
553
- slug: menu-screen
554
- description:
555
- en: Screen to manage menu_screen
556
- pt: Tela para gerenciar menu_screen
557
- icon: file
558
453
  multifactor:
559
454
  - name:
560
455
  en: Email
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hedhog/admin",
3
- "version": "0.12.4",
3
+ "version": "0.12.6",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -23,13 +23,13 @@ export class MenuService {
23
23
  ) { }
24
24
 
25
25
  async updateScreens(menuId: number, data: UpdateIdsDTO) {
26
- await (this.prismaService as any).menu_screen.deleteMany({
26
+ await this.prismaService.menu_screen.deleteMany({
27
27
  where: {
28
28
  menu_id: menuId,
29
29
  },
30
30
  });
31
31
 
32
- return (this.prismaService as any).menu_screen.createMany({
32
+ return this.prismaService.menu_screen.createMany({
33
33
  data: data.ids.map((screenId) => ({
34
34
  menu_id: menuId,
35
35
  screen_id: screenId,
@@ -38,13 +38,13 @@ export class MenuService {
38
38
  });
39
39
  }
40
40
  async updateRoles(menuId: number, data: UpdateIdsDTO) {
41
- await (this.prismaService as any).role_menu.deleteMany({
41
+ await this.prismaService.role_menu.deleteMany({
42
42
  where: {
43
43
  menu_id: menuId,
44
44
  },
45
45
  });
46
46
 
47
- return (this.prismaService as any).role_menu.createMany({
47
+ return this.prismaService.role_menu.createMany({
48
48
  data: data.ids.map((roleId) => ({
49
49
  menu_id: menuId,
50
50
  role_id: roleId,
@@ -58,7 +58,7 @@ export class MenuService {
58
58
  paginationParams: PaginationDTO,
59
59
  ) {
60
60
  return this.paginationService.paginate(
61
- (this.prismaService as any).screen,
61
+ this.prismaService.screen,
62
62
  paginationParams,
63
63
  {
64
64
  include: {
@@ -92,7 +92,7 @@ export class MenuService {
92
92
  paginationParams: PaginationDTO,
93
93
  ) {
94
94
  return this.paginationService.paginate(
95
- (this.prismaService as any).role,
95
+ this.prismaService.role,
96
96
  paginationParams,
97
97
  {
98
98
  include: {
@@ -127,7 +127,7 @@ export class MenuService {
127
127
  menuId = null;
128
128
  }
129
129
 
130
- let menu = (await (this.prismaService as any).menu.findMany({
130
+ let menu = (await this.prismaService.menu.findMany({
131
131
  where: {
132
132
  menu_id: menuId,
133
133
  role_menu: {
@@ -174,13 +174,13 @@ export class MenuService {
174
174
 
175
175
  async list(locale: string, paginationParams: PaginationDTO) {
176
176
  const fields = ['url', 'icon'];
177
- const OR = (this.prismaService as any).createInsensitiveSearch(
177
+ const OR = this.prismaService.createInsensitiveSearch(
178
178
  fields,
179
179
  paginationParams,
180
180
  );
181
181
 
182
182
  return this.paginationService.paginate(
183
- (this.prismaService as any).menu,
183
+ this.prismaService.menu,
184
184
  paginationParams,
185
185
  {
186
186
  where: {
@@ -204,19 +204,19 @@ export class MenuService {
204
204
  }
205
205
 
206
206
  async get(menuId: number) {
207
- return (this.prismaService as any).menu.findUnique({
207
+ return this.prismaService.menu.findUnique({
208
208
  where: { id: menuId },
209
209
  });
210
210
  }
211
211
 
212
212
  async create({ slug, url, icon, order, menuId }: CreateDTO) {
213
- return (this.prismaService as any).menu.create({
213
+ return this.prismaService.menu.create({
214
214
  data: { slug, url, icon, order, menu_id: menuId },
215
215
  });
216
216
  }
217
217
 
218
218
  async update({ id, data }: { id: number; data: UpdateDTO }) {
219
- return (this.prismaService as any).menu.update({
219
+ return this.prismaService.menu.update({
220
220
  where: { id },
221
221
  data,
222
222
  });
@@ -229,7 +229,7 @@ export class MenuService {
229
229
  );
230
230
  }
231
231
 
232
- return (this.prismaService as any).menu.deleteMany({
232
+ return this.prismaService.menu.deleteMany({
233
233
  where: {
234
234
  id: {
235
235
  in: ids,
@@ -239,7 +239,7 @@ export class MenuService {
239
239
  }
240
240
 
241
241
  async updateOrder({ ids }: OrderDTO): Promise<void> {
242
- const count = await (this.prismaService as any).menu.count({
242
+ const count = await this.prismaService.menu.count({
243
243
  where: {
244
244
  id: {
245
245
  in: ids,
@@ -253,7 +253,7 @@ export class MenuService {
253
253
 
254
254
  await Promise.all(
255
255
  ids.map((id, index) =>
256
- (this.prismaService as any).menu.update({
256
+ this.prismaService.menu.update({
257
257
  where: { id },
258
258
  data: { order: index + 1 },
259
259
  }),
@@ -25,13 +25,13 @@ export class RoleService {
25
25
  ) { }
26
26
 
27
27
  async updateUsers(roleId: number, { ids }: UpdateIdsDTO) {
28
- await (this.prismaService as any).role_user.deleteMany({
28
+ await this.prismaService.role_user.deleteMany({
29
29
  where: {
30
30
  role_id: roleId,
31
31
  },
32
32
  });
33
33
 
34
- return (this.prismaService as any).role_user.createMany({
34
+ return this.prismaService.role_user.createMany({
35
35
  data: ids.map((userId) => ({
36
36
  role_id: roleId,
37
37
  user_id: userId,
@@ -41,13 +41,13 @@ export class RoleService {
41
41
  }
42
42
 
43
43
  async updateScreens(roleId: number, data: UpdateIdsDTO) {
44
- await (this.prismaService as any).role_screen.deleteMany({
44
+ await this.prismaService.role_screen.deleteMany({
45
45
  where: {
46
46
  role_id: roleId,
47
47
  },
48
48
  });
49
49
 
50
- return (this.prismaService as any).role_screen.createMany({
50
+ return this.prismaService.role_screen.createMany({
51
51
  data: data.ids.map((screenId) => ({
52
52
  role_id: roleId,
53
53
  screen_id: screenId,
@@ -57,13 +57,13 @@ export class RoleService {
57
57
  }
58
58
 
59
59
  async updateRoutes(roleId: number, data: UpdateIdsDTO) {
60
- await (this.prismaService as any).role_route.deleteMany({
60
+ await this.prismaService.role_route.deleteMany({
61
61
  where: {
62
62
  role_id: roleId,
63
63
  },
64
64
  });
65
65
 
66
- return (this.prismaService as any).role_route.createMany({
66
+ return this.prismaService.role_route.createMany({
67
67
  data: data.ids.map((routeId) => ({
68
68
  role_id: roleId,
69
69
  route_id: routeId,
@@ -73,13 +73,13 @@ export class RoleService {
73
73
  }
74
74
 
75
75
  async updateMenus(roleId: number, data: UpdateIdsDTO) {
76
- await (this.prismaService as any).role_menu.deleteMany({
76
+ await this.prismaService.role_menu.deleteMany({
77
77
  where: {
78
78
  role_id: roleId,
79
79
  },
80
80
  });
81
81
 
82
- return (this.prismaService as any).role_menu.createMany({
82
+ return this.prismaService.role_menu.createMany({
83
83
  data: data.ids.map((menuId) => ({
84
84
  role_id: roleId,
85
85
  menu_id: menuId,
@@ -90,7 +90,7 @@ export class RoleService {
90
90
 
91
91
  async listUsers(roleId: number, paginationParams: PaginationDTO) {
92
92
  return this.paginationService.paginate(
93
- (this.prismaService as any).user,
93
+ this.prismaService.user,
94
94
  paginationParams,
95
95
  {
96
96
  include: {
@@ -114,7 +114,7 @@ export class RoleService {
114
114
  paginationParams: PaginationDTO,
115
115
  ) {
116
116
  return this.paginationService.paginate(
117
- (this.prismaService as any).menu,
117
+ this.prismaService.menu,
118
118
  paginationParams,
119
119
  {
120
120
  include: {
@@ -145,7 +145,7 @@ export class RoleService {
145
145
 
146
146
  async listRoutes(roleId: number, paginationParams: PaginationDTO) {
147
147
  return this.paginationService.paginate(
148
- (this.prismaService as any).route,
148
+ this.prismaService.route,
149
149
  paginationParams,
150
150
  {
151
151
  include: {
@@ -169,7 +169,7 @@ export class RoleService {
169
169
  paginationParams: PaginationDTO,
170
170
  ) {
171
171
  return this.paginationService.paginate(
172
- (this.prismaService as any).screen,
172
+ this.prismaService.screen,
173
173
  paginationParams,
174
174
  {
175
175
  include: {
@@ -201,13 +201,13 @@ export class RoleService {
201
201
  async list(locale: string, paginationParams: PaginationDTO) {
202
202
  const fields = [];
203
203
 
204
- const OR: any[] = (this.prismaService as any).createInsensitiveSearch(
204
+ const OR: any[] = this.prismaService.createInsensitiveSearch(
205
205
  fields,
206
206
  paginationParams,
207
207
  );
208
208
 
209
209
  return this.paginationService.paginate(
210
- (this.prismaService as any).role,
210
+ this.prismaService.role,
211
211
  paginationParams,
212
212
  {
213
213
  where: {
@@ -235,7 +235,7 @@ export class RoleService {
235
235
  return getWithLocale(
236
236
  locale,
237
237
  'role_locale',
238
- await (this.prismaService as any).role.findUnique({
238
+ await this.prismaService.role.findUnique({
239
239
  where: { id: roleId },
240
240
  include: {
241
241
  role_locale: {
@@ -278,7 +278,7 @@ export class RoleService {
278
278
  );
279
279
  }
280
280
 
281
- return (this.prismaService as any).role.deleteMany({
281
+ return this.prismaService.role.deleteMany({
282
282
  where: {
283
283
  id: {
284
284
  in: ids,
@@ -18,13 +18,13 @@ export class RouteService {
18
18
  async list(paginationParams: PaginationDTO) {
19
19
  const fields = ['url', 'method'];
20
20
 
21
- const OR: any[] = (this.prismaService as any).createInsensitiveSearch(
21
+ const OR: any[] = this.prismaService.createInsensitiveSearch(
22
22
  fields,
23
23
  paginationParams,
24
24
  );
25
25
 
26
26
  return this.paginationService.paginate(
27
- (this.prismaService as any).route,
27
+ this.prismaService.route,
28
28
  paginationParams,
29
29
  {
30
30
  where: {
@@ -35,22 +35,22 @@ export class RouteService {
35
35
  }
36
36
 
37
37
  async get(routeId: number) {
38
- return (this.prismaService as any).route.findUnique({ where: { id: routeId } });
38
+ return this.prismaService.route.findUnique({ where: { id: routeId } });
39
39
  }
40
40
 
41
41
  async create({ url, method }: CreateDTO) {
42
- return (this.prismaService as any).route.create({ data: { url, method } });
42
+ return this.prismaService.route.create({ data: { url, method } });
43
43
  }
44
44
 
45
45
  async update({ id, data }: { id: number; data: UpdateDTO }) {
46
- return (this.prismaService as any).route.update({
46
+ return this.prismaService.route.update({
47
47
  where: { id },
48
48
  data,
49
49
  });
50
50
  }
51
51
 
52
52
  async delete({ ids }: DeleteDTO) {
53
- return (this.prismaService as any).route.deleteMany({
53
+ return this.prismaService.route.deleteMany({
54
54
  where: {
55
55
  id: {
56
56
  in: ids,
@@ -65,7 +65,7 @@ export class RouteService {
65
65
  paginationParams: PaginationDTO,
66
66
  ) {
67
67
  return this.paginationService.paginate(
68
- (this.prismaService as any).role,
68
+ this.prismaService.role,
69
69
  paginationParams,
70
70
  {
71
71
  include: {
@@ -96,13 +96,13 @@ export class RouteService {
96
96
  }
97
97
 
98
98
  async updateRoles(routeId: number, data: UpdateIdsDTO) {
99
- await (this.prismaService as any).role_route.deleteMany({
99
+ await this.prismaService.role_route.deleteMany({
100
100
  where: {
101
101
  route_id: routeId,
102
102
  },
103
103
  });
104
104
 
105
- return (this.prismaService as any).role_route.createMany({
105
+ return this.prismaService.role_route.createMany({
106
106
  data: data.ids.map((roleId) => ({
107
107
  role_id: roleId,
108
108
  route_id: routeId,
@@ -117,7 +117,7 @@ export class RouteService {
117
117
  paginationParams: PaginationDTO,
118
118
  ) {
119
119
  return this.paginationService.paginate(
120
- (this.prismaService as any).screen,
120
+ this.prismaService.screen,
121
121
  paginationParams,
122
122
  {
123
123
  include: {
@@ -147,13 +147,13 @@ export class RouteService {
147
147
  }
148
148
 
149
149
  async updateScreens(routeId: number, data: UpdateIdsDTO) {
150
- await (this.prismaService as any).route_screen.deleteMany({
150
+ await this.prismaService.route_screen.deleteMany({
151
151
  where: {
152
152
  route_id: routeId,
153
153
  },
154
154
  });
155
155
 
156
- return (this.prismaService as any).route_screen.createMany({
156
+ return this.prismaService.route_screen.createMany({
157
157
  data: data.ids.map((screenId) => ({
158
158
  screen_id: screenId,
159
159
  route_id: routeId,
@@ -21,13 +21,13 @@ export class ScreenService {
21
21
  ) { }
22
22
 
23
23
  async updateRoles(screenId: number, data: UpdateIdsDTO) {
24
- await (this.prismaService as any).role_screen.deleteMany({
24
+ await this.prismaService.role_screen.deleteMany({
25
25
  where: {
26
26
  screen_id: screenId,
27
27
  },
28
28
  });
29
29
 
30
- return (this.prismaService as any).role_screen.createMany({
30
+ return this.prismaService.role_screen.createMany({
31
31
  data: data.ids.map((roleId) => ({
32
32
  screen_id: screenId,
33
33
  role_id: roleId,
@@ -37,7 +37,7 @@ export class ScreenService {
37
37
  }
38
38
  async updateRoutes(screenId: number, { ids }: UpdateIdsDTO) {
39
39
  ids = (
40
- await (this.prismaService as any).route.findMany({
40
+ await this.prismaService.route.findMany({
41
41
  where: {
42
42
  id: {
43
43
  in: ids,
@@ -49,13 +49,13 @@ export class ScreenService {
49
49
  })
50
50
  ).map((route) => route.id);
51
51
 
52
- await (this.prismaService as any).route_screen.deleteMany({
52
+ await this.prismaService.route_screen.deleteMany({
53
53
  where: {
54
54
  screen_id: screenId,
55
55
  },
56
56
  });
57
57
 
58
- return (this.prismaService as any).route_screen.createMany({
58
+ return this.prismaService.route_screen.createMany({
59
59
  data: ids.map((routeId) => ({
60
60
  screen_id: screenId,
61
61
  route_id: routeId,
@@ -65,7 +65,7 @@ export class ScreenService {
65
65
  }
66
66
  async listRoutes(screenId: number, paginationParams: PaginationDTO) {
67
67
  return this.paginationService.paginate(
68
- (this.prismaService as any).route,
68
+ this.prismaService.route,
69
69
  paginationParams,
70
70
  {
71
71
  include: {
@@ -89,7 +89,7 @@ export class ScreenService {
89
89
  paginationParams: PaginationDTO,
90
90
  ) {
91
91
  return this.paginationService.paginate(
92
- (this.prismaService as any).role,
92
+ this.prismaService.role,
93
93
  paginationParams,
94
94
  {
95
95
  include: {
@@ -109,13 +109,13 @@ export class ScreenService {
109
109
 
110
110
  async list(locale: string, paginationParams: PaginationDTO) {
111
111
  const fields = ['slug', 'icon'];
112
- const OR: any[] = (this.prismaService as any).createInsensitiveSearch(
112
+ const OR: any[] = this.prismaService.createInsensitiveSearch(
113
113
  fields,
114
114
  paginationParams,
115
115
  );
116
116
 
117
117
  const result = await this.paginationService.paginate(
118
- (this.prismaService as any).screen,
118
+ this.prismaService.screen,
119
119
  paginationParams,
120
120
  {
121
121
  where: {
@@ -142,11 +142,11 @@ export class ScreenService {
142
142
  }
143
143
 
144
144
  async get(screenId: number) {
145
- return (this.prismaService as any).screen.findUnique({ where: { id: screenId } });
145
+ return this.prismaService.screen.findUnique({ where: { id: screenId } });
146
146
  }
147
147
 
148
148
  async create({ slug, icon }: CreateDTO) {
149
- return (this.prismaService as any).screen.create({
149
+ return this.prismaService.screen.create({
150
150
  data: {
151
151
  slug,
152
152
  icon,
@@ -155,7 +155,7 @@ export class ScreenService {
155
155
  }
156
156
 
157
157
  async update({ id, data }: { id: number; data: UpdateDTO }) {
158
- return (this.prismaService as any).screen.update({
158
+ return this.prismaService.screen.update({
159
159
  where: { id },
160
160
  data,
161
161
  });
@@ -168,7 +168,7 @@ export class ScreenService {
168
168
  );
169
169
  }
170
170
 
171
- return (this.prismaService as any).screen.deleteMany({
171
+ return this.prismaService.screen.deleteMany({
172
172
  where: {
173
173
  id: {
174
174
  in: ids,
@@ -24,7 +24,7 @@ export class UserService {
24
24
 
25
25
  async listRoles(userId: number, paginationParams: PaginationDTO) {
26
26
  return this.paginationService.paginate(
27
- (this.prismaService as any).role,
27
+ this.prismaService.role,
28
28
  paginationParams,
29
29
  {
30
30
  include: {
@@ -43,13 +43,13 @@ export class UserService {
43
43
  }
44
44
 
45
45
  async updateRoles(userId: number, { ids }: UpdateIdsDTO) {
46
- await (this.prismaService as any).role_user.deleteMany({
46
+ await this.prismaService.role_user.deleteMany({
47
47
  where: {
48
48
  user_id: userId,
49
49
  },
50
50
  });
51
51
 
52
- return (this.prismaService as any).role_user.createMany({
52
+ return this.prismaService.role_user.createMany({
53
53
  data: ids.map((role) => {
54
54
  return {
55
55
  user_id: userId,
@@ -62,13 +62,13 @@ export class UserService {
62
62
 
63
63
  async list(paginationParams: PaginationDTO) {
64
64
  const fields = ['name', 'email'];
65
- const OR = (this.prismaService as any).createInsensitiveSearch(
65
+ const OR = this.prismaService.createInsensitiveSearch(
66
66
  fields,
67
67
  paginationParams,
68
68
  );
69
69
 
70
70
  return this.paginationService.paginate(
71
- (this.prismaService as any).user,
71
+ this.prismaService.user,
72
72
  paginationParams,
73
73
  {
74
74
  where: {
@@ -79,7 +79,7 @@ export class UserService {
79
79
  }
80
80
 
81
81
  async get(userId: number) {
82
- return (this.prismaService as any).user.findUnique({ where: { id: userId } });
82
+ return this.prismaService.user.findUnique({ where: { id: userId } });
83
83
  }
84
84
 
85
85
  async hashPassword(password: string): Promise<string> {
@@ -90,7 +90,7 @@ export class UserService {
90
90
  async create({ email, name, password }: CreateDTO) {
91
91
  const hashedPassword = await this.hashPassword(password);
92
92
 
93
- return (this.prismaService as any).user.create({
93
+ return this.prismaService.user.create({
94
94
  data: {
95
95
  email,
96
96
  name,
@@ -100,7 +100,7 @@ export class UserService {
100
100
  }
101
101
 
102
102
  async update({ id, data }: { id: number; data: UpdateDTO }) {
103
- return (this.prismaService as any).user.update({
103
+ return this.prismaService.user.update({
104
104
  where: { id },
105
105
  data,
106
106
  });
@@ -113,7 +113,7 @@ export class UserService {
113
113
  );
114
114
  }
115
115
 
116
- return (this.prismaService as any).user.deleteMany({
116
+ return this.prismaService.user.deleteMany({
117
117
  where: {
118
118
  id: {
119
119
  in: ids,