@hedhog/admin 0.0.121 → 0.0.123
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/auth/auth.controller.d.ts +10 -1
- package/dist/auth/auth.controller.d.ts.map +1 -1
- package/dist/auth/auth.controller.js +6 -6
- package/dist/auth/auth.controller.js.map +1 -1
- package/dist/auth/auth.service.d.ts +10 -1
- package/dist/auth/auth.service.d.ts.map +1 -1
- package/dist/auth/guards/auth.guard.js +2 -2
- package/dist/auth/guards/auth.guard.js.map +1 -1
- package/dist/menu/dto/create.dto.d.ts +1 -1
- package/dist/menu/dto/create.dto.js +3 -3
- package/dist/menu/menu.controller.d.ts +33 -6
- package/dist/menu/menu.controller.d.ts.map +1 -1
- package/dist/menu/menu.controller.js +5 -5
- package/dist/menu/menu.controller.js.map +1 -1
- package/dist/menu/menu.service.d.ts +33 -6
- package/dist/menu/menu.service.d.ts.map +1 -1
- package/dist/menu/menu.service.js +4 -4
- package/dist/menu/menu.service.js.map +1 -1
- package/dist/menu/menu.service.spec.d.ts +0 -1
- package/dist/menu/menu.service.spec.js +206 -190
- package/dist/menu/menu.service.spec.js.map +1 -1
- package/dist/role/guards/role.guard.js +3 -3
- package/dist/role/guards/role.guard.js.map +1 -1
- package/dist/role/role.controller.d.ts +5 -5
- package/dist/role/role.controller.js +4 -4
- package/dist/role/role.controller.js.map +1 -1
- package/dist/role/role.service.d.ts +7 -7
- package/dist/role/role.service.d.ts.map +1 -1
- package/dist/role/role.service.js +8 -4
- package/dist/role/role.service.js.map +1 -1
- package/dist/route/route.controller.d.ts +27 -6
- package/dist/route/route.controller.d.ts.map +1 -1
- package/dist/route/route.controller.js +2 -2
- package/dist/route/route.controller.js.map +1 -1
- package/dist/route/route.service.d.ts +27 -6
- package/dist/route/route.service.d.ts.map +1 -1
- package/dist/route/route.service.spec.d.ts +0 -1
- package/dist/route/route.service.spec.js +260 -249
- package/dist/route/route.service.spec.js.map +1 -1
- package/dist/screen/dto/create.dto.d.ts +0 -2
- package/dist/screen/dto/create.dto.d.ts.map +1 -1
- package/dist/screen/dto/create.dto.js +0 -10
- package/dist/screen/dto/create.dto.js.map +1 -1
- package/dist/screen/screen.controller.d.ts +24 -6
- package/dist/screen/screen.controller.d.ts.map +1 -1
- package/dist/screen/screen.controller.js +2 -2
- package/dist/screen/screen.controller.js.map +1 -1
- package/dist/screen/screen.service.d.ts +24 -6
- package/dist/screen/screen.service.d.ts.map +1 -1
- package/dist/screen/screen.service.js +1 -3
- package/dist/screen/screen.service.js.map +1 -1
- package/dist/screen/screen.service.spec.d.ts +0 -1
- package/dist/screen/screen.service.spec.js +257 -240
- package/dist/screen/screen.service.spec.js.map +1 -1
- package/dist/user/user.controller.d.ts +32 -5
- package/dist/user/user.controller.d.ts.map +1 -1
- package/dist/user/user.controller.js +2 -2
- package/dist/user/user.controller.js.map +1 -1
- package/dist/user/user.service.d.ts +32 -5
- package/dist/user/user.service.d.ts.map +1 -1
- package/hedhog.yaml +5 -5
- package/package.json +3 -3
- package/src/auth/auth.controller.ts +1 -1
- package/src/auth/guards/auth.guard.ts +1 -1
- package/src/menu/dto/create.dto.ts +3 -3
- package/src/menu/menu.controller.ts +3 -3
- package/src/menu/menu.service.spec.ts +247 -247
- package/src/menu/menu.service.ts +3 -3
- package/src/role/guards/role.guard.ts +1 -1
- package/src/role/role.controller.ts +3 -3
- package/src/role/role.service.ts +8 -21
- package/src/route/route.controller.ts +1 -1
- package/src/route/route.service.spec.ts +300 -300
- package/src/screen/dto/create.dto.ts +0 -8
- package/src/screen/screen.controller.ts +1 -1
- package/src/screen/screen.service.spec.ts +298 -298
- package/src/screen/screen.service.ts +1 -3
- package/src/user/user.controller.ts +1 -1
@@ -1,247 +1,247 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
} from '@hedhog/pagination';
|
6
|
-
import { PrismaService } from '@hedhog/prisma';
|
7
|
-
import { BadRequestException } from '@nestjs/common';
|
8
|
-
import { Test, TestingModule } from '@nestjs/testing';
|
9
|
-
import { MenuService } from './menu.service';
|
10
|
-
|
11
|
-
describe('MenuService', () => {
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
});
|
1
|
+
// import {
|
2
|
+
// PageOrderDirection,
|
3
|
+
// PaginationDTO,
|
4
|
+
// PaginationService,
|
5
|
+
// } from '@hedhog/pagination';
|
6
|
+
// import { PrismaService } from '@hedhog/prisma';
|
7
|
+
// import { BadRequestException } from '@nestjs/common';
|
8
|
+
// import { Test, TestingModule } from '@nestjs/testing';
|
9
|
+
// import { MenuService } from './menu.service';
|
10
|
+
|
11
|
+
// describe('MenuService', () => {
|
12
|
+
// let menuService: MenuService;
|
13
|
+
// let prismaService: PrismaService;
|
14
|
+
// let paginationService: PaginationService;
|
15
|
+
|
16
|
+
// const mockPrismaService = {
|
17
|
+
// menu: {
|
18
|
+
// create: jest.fn(),
|
19
|
+
// update: jest.fn(),
|
20
|
+
// deleteMany: jest.fn(),
|
21
|
+
// findUnique: jest.fn(),
|
22
|
+
// findMany: jest.fn(),
|
23
|
+
// count: jest.fn(),
|
24
|
+
// },
|
25
|
+
// role_menu: {
|
26
|
+
// deleteMany: jest.fn(),
|
27
|
+
// createMany: jest.fn(),
|
28
|
+
// },
|
29
|
+
// menu_screen: {
|
30
|
+
// deleteMany: jest.fn(),
|
31
|
+
// createMany: jest.fn(),
|
32
|
+
// },
|
33
|
+
// };
|
34
|
+
|
35
|
+
// const mockPaginationService = {
|
36
|
+
// paginate: jest.fn(),
|
37
|
+
// createInsensitiveSearch: jest.fn(),
|
38
|
+
// };
|
39
|
+
|
40
|
+
// beforeEach(async () => {
|
41
|
+
// const module: TestingModule = await Test.createTestingModule({
|
42
|
+
// providers: [
|
43
|
+
// MenuService,
|
44
|
+
// { provide: PrismaService, useValue: mockPrismaService },
|
45
|
+
// { provide: PaginationService, useValue: mockPaginationService },
|
46
|
+
// ],
|
47
|
+
// }).compile();
|
48
|
+
|
49
|
+
// menuService = module.get<MenuService>(MenuService);
|
50
|
+
// prismaService = module.get<PrismaService>(PrismaService);
|
51
|
+
// paginationService = module.get<PaginationService>(PaginationService);
|
52
|
+
// });
|
53
|
+
|
54
|
+
// afterEach(() => {
|
55
|
+
// jest.clearAllMocks();
|
56
|
+
// });
|
57
|
+
|
58
|
+
// describe('create', () => {
|
59
|
+
// it('should create a new menu', async () => {
|
60
|
+
// const createMenuDto = {
|
61
|
+
// name: 'Test Menu',
|
62
|
+
// url: '/test',
|
63
|
+
// icon: 'test-icon',
|
64
|
+
// order: 1,
|
65
|
+
// menu_id: undefined,
|
66
|
+
// };
|
67
|
+
// mockPrismaService.menu.create.mockResolvedValue(createMenuDto);
|
68
|
+
|
69
|
+
// const result = await menuService.create(createMenuDto);
|
70
|
+
|
71
|
+
// expect(result).toEqual(createMenuDto);
|
72
|
+
// expect(prismaService.menu.create).toHaveBeenCalledWith({
|
73
|
+
// data: createMenuDto,
|
74
|
+
// });
|
75
|
+
// });
|
76
|
+
// });
|
77
|
+
|
78
|
+
// describe('update', () => {
|
79
|
+
// it('should update a menu', async () => {
|
80
|
+
// const updateDto = { id: 1, data: { name: 'Updated Menu' } };
|
81
|
+
// mockPrismaService.menu.update.mockResolvedValue(updateDto.data);
|
82
|
+
|
83
|
+
// const result = await menuService.update(updateDto);
|
84
|
+
|
85
|
+
// expect(result).toEqual(updateDto.data);
|
86
|
+
// expect(prismaService.menu.update).toHaveBeenCalledWith({
|
87
|
+
// where: { id: updateDto.id },
|
88
|
+
// data: updateDto.data,
|
89
|
+
// });
|
90
|
+
// });
|
91
|
+
// });
|
92
|
+
|
93
|
+
// describe('delete', () => {
|
94
|
+
// it('should delete menu', async () => {
|
95
|
+
// const deleteDto = { ids: [1, 2, 3] };
|
96
|
+
// mockPrismaService.menu.deleteMany.mockResolvedValue({ count: 3 });
|
97
|
+
|
98
|
+
// const result = await menuService.delete(deleteDto);
|
99
|
+
|
100
|
+
// expect(result).toEqual({ count: 3 });
|
101
|
+
// expect(prismaService.menu.deleteMany).toHaveBeenCalledWith({
|
102
|
+
// where: { id: { in: deleteDto.ids } },
|
103
|
+
// });
|
104
|
+
// });
|
105
|
+
|
106
|
+
// it('should throw BadRequestException if no ids are provided', async () => {
|
107
|
+
// await expect(menuService.delete({ ids: null })).rejects.toThrow(
|
108
|
+
// BadRequestException,
|
109
|
+
// );
|
110
|
+
// });
|
111
|
+
// });
|
112
|
+
|
113
|
+
// describe('listScreens', () => {
|
114
|
+
// it('should paginate screens', async () => {
|
115
|
+
// const locale = 'en';
|
116
|
+
// const menuId = 1;
|
117
|
+
// const paginationParams: PaginationDTO = {
|
118
|
+
// page: 1,
|
119
|
+
// pageSize: 10,
|
120
|
+
// search: '',
|
121
|
+
// sortField: '',
|
122
|
+
// sortOrder: PageOrderDirection.Asc,
|
123
|
+
// fields: '',
|
124
|
+
// };
|
125
|
+
|
126
|
+
// const mockScreens = [{ id: 1, name: 'Screen 1' }];
|
127
|
+
// mockPaginationService.paginate.mockResolvedValue(mockScreens);
|
128
|
+
|
129
|
+
// const result = await menuService.listScreens(
|
130
|
+
// locale,
|
131
|
+
// menuId,
|
132
|
+
// paginationParams,
|
133
|
+
// );
|
134
|
+
|
135
|
+
// expect(result).toEqual(mockScreens);
|
136
|
+
// expect(paginationService.paginate).toHaveBeenCalledWith(
|
137
|
+
// prismaService.screens,
|
138
|
+
// paginationParams,
|
139
|
+
// expect.anything(),
|
140
|
+
// 'screen_locale',
|
141
|
+
// );
|
142
|
+
// });
|
143
|
+
// });
|
144
|
+
|
145
|
+
// describe('updateScreens', () => {
|
146
|
+
// it('should update screens associated with a menu', async () => {
|
147
|
+
// const menuId = 1;
|
148
|
+
// const updateData = { ids: [1, 2, 3] };
|
149
|
+
|
150
|
+
// jest
|
151
|
+
// .spyOn(prismaService.menu_screen, 'deleteMany')
|
152
|
+
// .mockResolvedValue(null);
|
153
|
+
// jest
|
154
|
+
// .spyOn(prismaService.menu_screen, 'createMany')
|
155
|
+
// .mockResolvedValue(null);
|
156
|
+
|
157
|
+
// await menuService.updateScreens(menuId, updateData);
|
158
|
+
|
159
|
+
// expect(prismaService.menu_screen.deleteMany).toHaveBeenCalledWith({
|
160
|
+
// where: { menu_id: menuId },
|
161
|
+
// });
|
162
|
+
|
163
|
+
// expect(prismaService.menu_screen.createMany).toHaveBeenCalledWith({
|
164
|
+
// data: updateData.ids.map((screenId) => ({
|
165
|
+
// menu_id: menuId,
|
166
|
+
// screen_id: screenId,
|
167
|
+
// })),
|
168
|
+
// skipDuplicates: true,
|
169
|
+
// });
|
170
|
+
// });
|
171
|
+
// });
|
172
|
+
|
173
|
+
// describe('updateRoles', () => {
|
174
|
+
// it('should update role associated with a menu', async () => {
|
175
|
+
// const menuId = 1;
|
176
|
+
// const updateData = { ids: [1, 2] };
|
177
|
+
|
178
|
+
// jest.spyOn(prismaService.role_menu, 'deleteMany').mockResolvedValue(null);
|
179
|
+
// jest.spyOn(prismaService.role_menu, 'createMany').mockResolvedValue(null);
|
180
|
+
|
181
|
+
// await menuService.updateRoles(menuId, updateData);
|
182
|
+
|
183
|
+
// expect(prismaService.role_menu.deleteMany).toHaveBeenCalledWith({
|
184
|
+
// where: { menu_id: menuId },
|
185
|
+
// });
|
186
|
+
|
187
|
+
// expect(prismaService.role_menu.createMany).toHaveBeenCalledWith({
|
188
|
+
// data: updateData.ids.map((roleId) => ({
|
189
|
+
// menu_id: menuId,
|
190
|
+
// role_id: roleId,
|
191
|
+
// })),
|
192
|
+
// skipDuplicates: true,
|
193
|
+
// });
|
194
|
+
// });
|
195
|
+
// });
|
196
|
+
|
197
|
+
// describe('updateOrder', () => {
|
198
|
+
// it('should update the order of menu', async () => {
|
199
|
+
// const orderData = { ids: [1, 2, 3] };
|
200
|
+
|
201
|
+
// jest.spyOn(prismaService.menu, 'count').mockResolvedValue(3);
|
202
|
+
// jest.spyOn(prismaService.menu, 'update').mockResolvedValue(null);
|
203
|
+
|
204
|
+
// await menuService.updateOrder(orderData);
|
205
|
+
|
206
|
+
// expect(prismaService.menu.count).toHaveBeenCalledWith({
|
207
|
+
// where: { id: { in: orderData.ids } },
|
208
|
+
// });
|
209
|
+
|
210
|
+
// expect(prismaService.menu.update).toHaveBeenCalledTimes(
|
211
|
+
// orderData.ids.length,
|
212
|
+
// );
|
213
|
+
|
214
|
+
// orderData.ids.forEach((id, index) => {
|
215
|
+
// expect(prismaService.menu.update).toHaveBeenCalledWith({
|
216
|
+
// where: { id },
|
217
|
+
// data: { order: index + 1 },
|
218
|
+
// });
|
219
|
+
// });
|
220
|
+
// });
|
221
|
+
|
222
|
+
// it('should throw BadRequestException if IDs are invalid', async () => {
|
223
|
+
// const orderData = { ids: [1, 2, 3] };
|
224
|
+
|
225
|
+
// jest.spyOn(prismaService.menu, 'count').mockResolvedValue(2); // IDs não batem com o número esperado
|
226
|
+
|
227
|
+
// await expect(menuService.updateOrder(orderData)).rejects.toThrow(
|
228
|
+
// BadRequestException,
|
229
|
+
// );
|
230
|
+
// });
|
231
|
+
// });
|
232
|
+
// /*
|
233
|
+
// describe('getMenus', () => {
|
234
|
+
// it('should get menu for a user', async () => {
|
235
|
+
// const locale = 'en';
|
236
|
+
// const userId = 1;
|
237
|
+
// const mockMenus = [{ id: 1, name: 'Menu 1' }];
|
238
|
+
// mockPrismaService.menu.findMany.mockResolvedValue(mockMenus);
|
239
|
+
|
240
|
+
// const result = await menuService.getMenus(locale, userId);
|
241
|
+
|
242
|
+
// expect(result).toEqual(mockMenus);
|
243
|
+
// expect(prismaService.menu.findMany).toHaveBeenCalled();
|
244
|
+
// });
|
245
|
+
// });
|
246
|
+
// */
|
247
|
+
// });
|
package/src/menu/menu.service.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { PaginationDTO, PaginationService } from '@hedhog/pagination';
|
2
2
|
import { PrismaService } from '@hedhog/prisma';
|
3
|
-
import { itemTranslations } from '@hedhog/
|
3
|
+
import { itemTranslations } from '@hedhog/core';
|
4
4
|
import {
|
5
5
|
BadRequestException,
|
6
6
|
Inject,
|
@@ -209,9 +209,9 @@ export class MenuService {
|
|
209
209
|
});
|
210
210
|
}
|
211
211
|
|
212
|
-
async create({
|
212
|
+
async create({ slug, url, icon, order, menuId }: CreateDTO) {
|
213
213
|
return this.prismaService.menu.create({
|
214
|
-
data: {
|
214
|
+
data: { slug, url, icon, order, menu_id: menuId },
|
215
215
|
});
|
216
216
|
}
|
217
217
|
|
@@ -11,7 +11,7 @@ import {
|
|
11
11
|
import { METHOD_METADATA } from '@nestjs/common/constants';
|
12
12
|
import { Reflector } from '@nestjs/core';
|
13
13
|
import { Request } from 'express';
|
14
|
-
import { IS_PUBLIC_KEY, WITH_ROLE } from '@hedhog/
|
14
|
+
import { IS_PUBLIC_KEY, WITH_ROLE } from '@hedhog/core';
|
15
15
|
|
16
16
|
@Injectable()
|
17
17
|
export class RoleGuard implements CanActivate {
|
@@ -14,7 +14,7 @@ import {
|
|
14
14
|
import { DeleteDTO } from '../dto/delete.dto';
|
15
15
|
import { UpdateIdsDTO } from '../dto/update-ids.dto';
|
16
16
|
import { Locale } from '@hedhog/locale';
|
17
|
-
import { Role } from '@hedhog/
|
17
|
+
import { Role } from '@hedhog/core';
|
18
18
|
import { CreateDTO } from './dto/create.dto';
|
19
19
|
import { UpdateDTO } from './dto/update.dto';
|
20
20
|
import { RoleService } from './role.service';
|
@@ -57,7 +57,7 @@ export class RoleController {
|
|
57
57
|
return this.roleService.listRoutes(roleId, paginationParams);
|
58
58
|
}
|
59
59
|
|
60
|
-
@Get(':roleId/
|
60
|
+
@Get(':roleId/screen')
|
61
61
|
async listScreens(
|
62
62
|
@Pagination() paginationParams,
|
63
63
|
@Param('roleId', ParseIntPipe) roleId: number,
|
@@ -90,7 +90,7 @@ export class RoleController {
|
|
90
90
|
return this.roleService.updateRoutes(roleId, data);
|
91
91
|
}
|
92
92
|
|
93
|
-
@Patch(':roleId/
|
93
|
+
@Patch(':roleId/screen')
|
94
94
|
async updateScreens(
|
95
95
|
@Param('roleId', ParseIntPipe) roleId: number,
|
96
96
|
@Body() data: UpdateIdsDTO,
|
package/src/role/role.service.ts
CHANGED
@@ -259,29 +259,16 @@ export class RoleService {
|
|
259
259
|
);
|
260
260
|
}
|
261
261
|
|
262
|
-
async create({ slug
|
263
|
-
return this.localeService.createModelWithLocale(
|
264
|
-
|
265
|
-
|
266
|
-
{ slug },
|
267
|
-
locale,
|
268
|
-
);
|
262
|
+
async create({ slug }: CreateDTO) {
|
263
|
+
return this.localeService.createModelWithLocale('role', 'role_id', {
|
264
|
+
slug,
|
265
|
+
});
|
269
266
|
}
|
270
267
|
|
271
|
-
async update({
|
272
|
-
id,
|
273
|
-
|
274
|
-
|
275
|
-
id: number;
|
276
|
-
data: UpdateDTO;
|
277
|
-
}) {
|
278
|
-
return this.localeService.updateModelWithLocale(
|
279
|
-
'role',
|
280
|
-
'role_id',
|
281
|
-
id,
|
282
|
-
{ slug },
|
283
|
-
locale,
|
284
|
-
);
|
268
|
+
async update({ id, data: { slug } }: { id: number; data: UpdateDTO }) {
|
269
|
+
return this.localeService.updateModelWithLocale('role', 'role_id', id, {
|
270
|
+
slug,
|
271
|
+
});
|
285
272
|
}
|
286
273
|
|
287
274
|
async delete({ ids }: DeleteDTO) {
|
@@ -14,7 +14,7 @@ import {
|
|
14
14
|
import { DeleteDTO } from '../dto/delete.dto';
|
15
15
|
import { UpdateIdsDTO } from '../dto/update-ids.dto';
|
16
16
|
import { Locale } from '@hedhog/locale';
|
17
|
-
import { Role } from '@hedhog/
|
17
|
+
import { Role } from '@hedhog/core';
|
18
18
|
import { CreateDTO } from './dto/create.dto';
|
19
19
|
import { UpdateDTO } from './dto/update.dto';
|
20
20
|
import { RouteService } from './route.service';
|