@hedhog/admin 0.12.1 → 0.12.3
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 → bkp.hedhog.yaml} +207 -9
- package/dist/auth/auth.controller.d.ts +1 -10
- package/dist/auth/auth.controller.d.ts.map +1 -1
- package/dist/auth/auth.service.d.ts +1 -10
- package/dist/auth/auth.service.d.ts.map +1 -1
- package/dist/auth/auth.service.js.map +1 -1
- package/dist/auth/auth.service.spec.d.ts +0 -1
- package/dist/auth/auth.service.spec.js +171 -161
- package/dist/auth/auth.service.spec.js.map +1 -1
- package/dist/menu/menu.controller.d.ts +6 -33
- package/dist/menu/menu.controller.d.ts.map +1 -1
- package/dist/menu/menu.service.d.ts +6 -33
- package/dist/menu/menu.service.d.ts.map +1 -1
- package/dist/menu/menu.service.js.map +1 -1
- package/dist/role/guards/role.guard.js.map +1 -1
- package/dist/role/role.controller.d.ts +5 -5
- package/dist/role/role.service.d.ts +5 -5
- package/dist/role/role.service.js.map +1 -1
- package/dist/route/route.controller.d.ts +6 -27
- package/dist/route/route.controller.d.ts.map +1 -1
- package/dist/route/route.service.d.ts +6 -27
- package/dist/route/route.service.d.ts.map +1 -1
- package/dist/route/route.service.js.map +1 -1
- package/dist/screen/screen.controller.d.ts +6 -24
- package/dist/screen/screen.controller.d.ts.map +1 -1
- package/dist/screen/screen.service.d.ts +6 -24
- package/dist/screen/screen.service.d.ts.map +1 -1
- package/dist/screen/screen.service.js.map +1 -1
- package/dist/user/user.controller.d.ts +5 -32
- package/dist/user/user.controller.d.ts.map +1 -1
- package/dist/user/user.service.d.ts +5 -32
- package/dist/user/user.service.d.ts.map +1 -1
- package/dist/user/user.service.js.map +1 -1
- package/dist/user/user.service.spec.d.ts +0 -1
- package/dist/user/user.service.spec.js +259 -250
- package/dist/user/user.service.spec.js.map +1 -1
- package/frontend/menu/components/create-panel.tsx.ejs +55 -0
- package/frontend/menu/components/update-panel.tsx.ejs +67 -0
- package/frontend/menu/locales/en/admin.menu.json +11 -0
- package/frontend/menu/locales/pt/admin.menu.json +11 -0
- package/frontend/menu/react-query/handlers.ts.ejs +28 -0
- package/frontend/menu/react-query/requests.ts.ejs +56 -0
- package/frontend/menu-locale/locales/en/admin.menu-locale.json +11 -0
- package/frontend/menu-locale/locales/pt/admin.menu-locale.json +11 -0
- package/frontend/menu-screen/locales/en/admin.menu-screen.json +11 -0
- package/frontend/menu-screen/locales/pt/admin.menu-screen.json +11 -0
- package/frontend/multifactor/components/create-panel.tsx.ejs +55 -0
- package/frontend/multifactor/components/update-panel.tsx.ejs +70 -0
- package/frontend/multifactor/locales/en/admin.multifactor.json +11 -0
- package/frontend/multifactor/locales/pt/admin.multifactor.json +11 -0
- package/frontend/multifactor/react-query/handlers.ts.ejs +28 -0
- package/frontend/multifactor/react-query/requests.ts.ejs +59 -0
- package/frontend/multifactor-locale/locales/en/admin.multifactor-locale.json +11 -0
- package/frontend/multifactor-locale/locales/pt/admin.multifactor-locale.json +11 -0
- package/frontend/screen/components/create-panel.tsx.ejs +55 -0
- package/frontend/screen/components/update-panel.tsx.ejs +67 -0
- package/frontend/screen/locales/en/admin.screen.json +11 -0
- package/frontend/screen/locales/pt/admin.screen.json +11 -0
- package/frontend/screen/react-query/handlers.ts.ejs +28 -0
- package/frontend/screen/react-query/requests.ts.ejs +56 -0
- package/frontend/screen-locale/locales/en/admin.screen-locale.json +11 -0
- package/frontend/screen-locale/locales/pt/admin.screen-locale.json +11 -0
- package/frontend/translation/components/create-panel.tsx.ejs +52 -0
- package/frontend/translation/components/update-panel.tsx.ejs +67 -0
- package/frontend/translation/fields/en.json +1 -0
- package/frontend/translation/fields/pt.json +1 -0
- package/frontend/translation/locales/en/admin.translation.json +11 -0
- package/frontend/translation/locales/pt/admin.translation.json +11 -0
- package/frontend/translation/modules/en.json +1 -0
- package/frontend/translation/modules/pt.json +1 -0
- package/frontend/translation/react-query/handlers.ts.ejs +28 -0
- package/frontend/translation/react-query/requests.ts.ejs +58 -0
- package/frontend/translation-namespace/components/create-panel.tsx.ejs +53 -0
- package/frontend/translation-namespace/components/update-panel.tsx.ejs +70 -0
- package/frontend/translation-namespace/locales/en/admin.translation-namespace.json +11 -0
- package/frontend/translation-namespace/locales/pt/admin.translation-namespace.json +11 -0
- package/frontend/translation-namespace/react-query/handlers.ts.ejs +28 -0
- package/frontend/translation-namespace/react-query/requests.ts.ejs +60 -0
- package/frontend/user/components/create-panel.tsx.ejs +52 -0
- package/frontend/user/components/update-panel.tsx.ejs +64 -0
- package/frontend/user/locales/en/admin.user.json +11 -0
- package/frontend/user/locales/pt/admin.user.json +11 -0
- package/frontend/user/react-query/handlers.ts.ejs +28 -0
- package/frontend/user/react-query/requests.ts.ejs +55 -0
- package/package.json +43 -43
- package/src/auth/auth.service.spec.ts +196 -196
- package/src/auth/auth.service.ts +10 -10
- package/src/menu/menu.service.ts +16 -16
- package/src/role/guards/role.guard.ts +2 -2
- package/src/role/role.service.ts +17 -17
- package/src/route/route.service.ts +13 -13
- package/src/screen/screen.service.ts +14 -14
- package/src/user/user.service.spec.ts +294 -294
- package/src/user/user.service.ts +10 -10
package/src/auth/auth.service.ts
CHANGED
@@ -26,7 +26,7 @@ export class AuthService {
|
|
26
26
|
private readonly jwt: JwtService,
|
27
27
|
@Inject(forwardRef(() => MailService))
|
28
28
|
private readonly mail: MailService,
|
29
|
-
) {}
|
29
|
+
) { }
|
30
30
|
|
31
31
|
async verifyToken(token: string) {
|
32
32
|
return this.jwt.verifyAsync(token, {
|
@@ -52,7 +52,7 @@ export class AuthService {
|
|
52
52
|
}
|
53
53
|
|
54
54
|
async loginWithEmailAndPassword(email: string, password: string) {
|
55
|
-
const user = await this.prisma.user.findFirst({
|
55
|
+
const user = await (this.prisma as any).user.findFirst({
|
56
56
|
where: {
|
57
57
|
email,
|
58
58
|
},
|
@@ -73,7 +73,7 @@ export class AuthService {
|
|
73
73
|
if (user.multifactor_id === MultifactorType.EMAIL) {
|
74
74
|
const code = this.generateRandomNumber();
|
75
75
|
|
76
|
-
await this.prisma.user.update({
|
76
|
+
await (this.prisma as any).user.update({
|
77
77
|
where: {
|
78
78
|
id: user.id,
|
79
79
|
},
|
@@ -117,7 +117,7 @@ export class AuthService {
|
|
117
117
|
subject?: string;
|
118
118
|
body?: string;
|
119
119
|
}) {
|
120
|
-
const user = await this.prisma.user.findFirst({
|
120
|
+
const user = await (this.prisma as any).user.findFirst({
|
121
121
|
where: {
|
122
122
|
email,
|
123
123
|
},
|
@@ -136,7 +136,7 @@ export class AuthService {
|
|
136
136
|
|
137
137
|
const code = this.jwt.sign(payload);
|
138
138
|
|
139
|
-
await this.prisma.user.update({
|
139
|
+
await (this.prisma as any).user.update({
|
140
140
|
where: {
|
141
141
|
id: user.id,
|
142
142
|
},
|
@@ -171,7 +171,7 @@ export class AuthService {
|
|
171
171
|
|
172
172
|
const { id } = this.jwt.decode(code) as User;
|
173
173
|
|
174
|
-
const user = await this.prisma.user.findFirst({
|
174
|
+
const user = await (this.prisma as any).user.findFirst({
|
175
175
|
where: {
|
176
176
|
id,
|
177
177
|
code,
|
@@ -182,7 +182,7 @@ export class AuthService {
|
|
182
182
|
const salt = await genSalt();
|
183
183
|
const password = await hash(confirmNewPassword, salt);
|
184
184
|
|
185
|
-
await this.prisma.user.update({
|
185
|
+
await (this.prisma as any).user.update({
|
186
186
|
where: {
|
187
187
|
id: user.id,
|
188
188
|
},
|
@@ -201,7 +201,7 @@ export class AuthService {
|
|
201
201
|
async otp({ token, code }: OtpDTO) {
|
202
202
|
const data = this.jwt.decode(token);
|
203
203
|
|
204
|
-
const user = await this.prisma.user.findFirst({
|
204
|
+
const user = await (this.prisma as any).user.findFirst({
|
205
205
|
where: {
|
206
206
|
id: data['id'],
|
207
207
|
code: String(code),
|
@@ -212,7 +212,7 @@ export class AuthService {
|
|
212
212
|
throw new NotFoundException('Invalid code');
|
213
213
|
}
|
214
214
|
|
215
|
-
await this.prisma.user.update({
|
215
|
+
await (this.prisma as any).user.update({
|
216
216
|
where: {
|
217
217
|
id: user.id,
|
218
218
|
},
|
@@ -229,6 +229,6 @@ export class AuthService {
|
|
229
229
|
}
|
230
230
|
|
231
231
|
verify(id: number) {
|
232
|
-
return this.prisma.user.findUnique({ where: { id } });
|
232
|
+
return (this.prisma as any).user.findUnique({ where: { id } });
|
233
233
|
}
|
234
234
|
}
|
package/src/menu/menu.service.ts
CHANGED
@@ -20,16 +20,16 @@ export class MenuService {
|
|
20
20
|
private readonly prismaService: PrismaService,
|
21
21
|
@Inject(forwardRef(() => PaginationService))
|
22
22
|
private readonly paginationService: PaginationService,
|
23
|
-
) {}
|
23
|
+
) { }
|
24
24
|
|
25
25
|
async updateScreens(menuId: number, data: UpdateIdsDTO) {
|
26
|
-
await this.prismaService.menu_screen.deleteMany({
|
26
|
+
await (this.prismaService as any).menu_screen.deleteMany({
|
27
27
|
where: {
|
28
28
|
menu_id: menuId,
|
29
29
|
},
|
30
30
|
});
|
31
31
|
|
32
|
-
return this.prismaService.menu_screen.createMany({
|
32
|
+
return (this.prismaService as any).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.role_menu.deleteMany({
|
41
|
+
await (this.prismaService as any).role_menu.deleteMany({
|
42
42
|
where: {
|
43
43
|
menu_id: menuId,
|
44
44
|
},
|
45
45
|
});
|
46
46
|
|
47
|
-
return this.prismaService.role_menu.createMany({
|
47
|
+
return (this.prismaService as any).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.screen,
|
61
|
+
(this.prismaService as any).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.role,
|
95
|
+
(this.prismaService as any).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.menu.findMany({
|
130
|
+
let menu = (await (this.prismaService as any).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.createInsensitiveSearch(
|
177
|
+
const OR = (this.prismaService as any).createInsensitiveSearch(
|
178
178
|
fields,
|
179
179
|
paginationParams,
|
180
180
|
);
|
181
181
|
|
182
182
|
return this.paginationService.paginate(
|
183
|
-
this.prismaService.menu,
|
183
|
+
(this.prismaService as any).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.menu.findUnique({
|
207
|
+
return (this.prismaService as any).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.menu.create({
|
213
|
+
return (this.prismaService as any).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.menu.update({
|
219
|
+
return (this.prismaService as any).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.menu.deleteMany({
|
232
|
+
return (this.prismaService as any).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.menu.count({
|
242
|
+
const count = await (this.prismaService as any).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.menu.update({
|
256
|
+
(this.prismaService as any).menu.update({
|
257
257
|
where: { id },
|
258
258
|
data: { order: index + 1 },
|
259
259
|
}),
|
@@ -19,7 +19,7 @@ export class RoleGuard implements CanActivate {
|
|
19
19
|
private reflector: Reflector,
|
20
20
|
@Inject(forwardRef(() => PrismaService))
|
21
21
|
private readonly prisma: PrismaService,
|
22
|
-
) {}
|
22
|
+
) { }
|
23
23
|
|
24
24
|
async canActivate(context: ExecutionContext): Promise<boolean> {
|
25
25
|
const isPublic = this.reflector.getAllAndOverride<boolean>(IS_PUBLIC_KEY, [
|
@@ -95,7 +95,7 @@ export class RoleGuard implements CanActivate {
|
|
95
95
|
|
96
96
|
console.log({ fullPath, httpMethod });
|
97
97
|
|
98
|
-
const route = await this.prisma.route.count({
|
98
|
+
const route = await (this.prisma as any).route.count({
|
99
99
|
where: {
|
100
100
|
method: httpMethod,
|
101
101
|
url: fullPath,
|
package/src/role/role.service.ts
CHANGED
@@ -22,16 +22,16 @@ export class RoleService {
|
|
22
22
|
private readonly paginationService: PaginationService,
|
23
23
|
@Inject(forwardRef(() => LocaleService))
|
24
24
|
private readonly localeService: LocaleService,
|
25
|
-
) {}
|
25
|
+
) { }
|
26
26
|
|
27
27
|
async updateUsers(roleId: number, { ids }: UpdateIdsDTO) {
|
28
|
-
await this.prismaService.role_user.deleteMany({
|
28
|
+
await (this.prismaService as any).role_user.deleteMany({
|
29
29
|
where: {
|
30
30
|
role_id: roleId,
|
31
31
|
},
|
32
32
|
});
|
33
33
|
|
34
|
-
return this.prismaService.role_user.createMany({
|
34
|
+
return (this.prismaService as any).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.role_screen.deleteMany({
|
44
|
+
await (this.prismaService as any).role_screen.deleteMany({
|
45
45
|
where: {
|
46
46
|
role_id: roleId,
|
47
47
|
},
|
48
48
|
});
|
49
49
|
|
50
|
-
return this.prismaService.role_screen.createMany({
|
50
|
+
return (this.prismaService as any).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.role_route.deleteMany({
|
60
|
+
await (this.prismaService as any).role_route.deleteMany({
|
61
61
|
where: {
|
62
62
|
role_id: roleId,
|
63
63
|
},
|
64
64
|
});
|
65
65
|
|
66
|
-
return this.prismaService.role_route.createMany({
|
66
|
+
return (this.prismaService as any).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.role_menu.deleteMany({
|
76
|
+
await (this.prismaService as any).role_menu.deleteMany({
|
77
77
|
where: {
|
78
78
|
role_id: roleId,
|
79
79
|
},
|
80
80
|
});
|
81
81
|
|
82
|
-
return this.prismaService.role_menu.createMany({
|
82
|
+
return (this.prismaService as any).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.user,
|
93
|
+
(this.prismaService as any).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.menu,
|
117
|
+
(this.prismaService as any).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.route,
|
148
|
+
(this.prismaService as any).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.screen,
|
172
|
+
(this.prismaService as any).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.createInsensitiveSearch(
|
204
|
+
const OR: any[] = (this.prismaService as any).createInsensitiveSearch(
|
205
205
|
fields,
|
206
206
|
paginationParams,
|
207
207
|
);
|
208
208
|
|
209
209
|
return this.paginationService.paginate(
|
210
|
-
this.prismaService.role,
|
210
|
+
(this.prismaService as any).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.role.findUnique({
|
238
|
+
await (this.prismaService as any).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.role.deleteMany({
|
281
|
+
return (this.prismaService as any).role.deleteMany({
|
282
282
|
where: {
|
283
283
|
id: {
|
284
284
|
in: ids,
|
@@ -13,18 +13,18 @@ export class RouteService {
|
|
13
13
|
private readonly prismaService: PrismaService,
|
14
14
|
@Inject(forwardRef(() => PaginationService))
|
15
15
|
private readonly paginationService: PaginationService,
|
16
|
-
) {}
|
16
|
+
) { }
|
17
17
|
|
18
18
|
async list(paginationParams: PaginationDTO) {
|
19
19
|
const fields = ['url', 'method'];
|
20
20
|
|
21
|
-
const OR: any[] = this.prismaService.createInsensitiveSearch(
|
21
|
+
const OR: any[] = (this.prismaService as any).createInsensitiveSearch(
|
22
22
|
fields,
|
23
23
|
paginationParams,
|
24
24
|
);
|
25
25
|
|
26
26
|
return this.paginationService.paginate(
|
27
|
-
this.prismaService.route,
|
27
|
+
(this.prismaService as any).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.route.findUnique({ where: { id: routeId } });
|
38
|
+
return (this.prismaService as any).route.findUnique({ where: { id: routeId } });
|
39
39
|
}
|
40
40
|
|
41
41
|
async create({ url, method }: CreateDTO) {
|
42
|
-
return this.prismaService.route.create({ data: { url, method } });
|
42
|
+
return (this.prismaService as any).route.create({ data: { url, method } });
|
43
43
|
}
|
44
44
|
|
45
45
|
async update({ id, data }: { id: number; data: UpdateDTO }) {
|
46
|
-
return this.prismaService.route.update({
|
46
|
+
return (this.prismaService as any).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.route.deleteMany({
|
53
|
+
return (this.prismaService as any).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.role,
|
68
|
+
(this.prismaService as any).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.role_route.deleteMany({
|
99
|
+
await (this.prismaService as any).role_route.deleteMany({
|
100
100
|
where: {
|
101
101
|
route_id: routeId,
|
102
102
|
},
|
103
103
|
});
|
104
104
|
|
105
|
-
return this.prismaService.role_route.createMany({
|
105
|
+
return (this.prismaService as any).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.screen,
|
120
|
+
(this.prismaService as any).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.route_screen.deleteMany({
|
150
|
+
await (this.prismaService as any).route_screen.deleteMany({
|
151
151
|
where: {
|
152
152
|
route_id: routeId,
|
153
153
|
},
|
154
154
|
});
|
155
155
|
|
156
|
-
return this.prismaService.route_screen.createMany({
|
156
|
+
return (this.prismaService as any).route_screen.createMany({
|
157
157
|
data: data.ids.map((screenId) => ({
|
158
158
|
screen_id: screenId,
|
159
159
|
route_id: routeId,
|
@@ -18,16 +18,16 @@ export class ScreenService {
|
|
18
18
|
private readonly prismaService: PrismaService,
|
19
19
|
@Inject(forwardRef(() => PaginationService))
|
20
20
|
private readonly paginationService: PaginationService,
|
21
|
-
) {}
|
21
|
+
) { }
|
22
22
|
|
23
23
|
async updateRoles(screenId: number, data: UpdateIdsDTO) {
|
24
|
-
await this.prismaService.role_screen.deleteMany({
|
24
|
+
await (this.prismaService as any).role_screen.deleteMany({
|
25
25
|
where: {
|
26
26
|
screen_id: screenId,
|
27
27
|
},
|
28
28
|
});
|
29
29
|
|
30
|
-
return this.prismaService.role_screen.createMany({
|
30
|
+
return (this.prismaService as any).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.route.findMany({
|
40
|
+
await (this.prismaService as any).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.route_screen.deleteMany({
|
52
|
+
await (this.prismaService as any).route_screen.deleteMany({
|
53
53
|
where: {
|
54
54
|
screen_id: screenId,
|
55
55
|
},
|
56
56
|
});
|
57
57
|
|
58
|
-
return this.prismaService.route_screen.createMany({
|
58
|
+
return (this.prismaService as any).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.route,
|
68
|
+
(this.prismaService as any).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.role,
|
92
|
+
(this.prismaService as any).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.createInsensitiveSearch(
|
112
|
+
const OR: any[] = (this.prismaService as any).createInsensitiveSearch(
|
113
113
|
fields,
|
114
114
|
paginationParams,
|
115
115
|
);
|
116
116
|
|
117
117
|
const result = await this.paginationService.paginate(
|
118
|
-
this.prismaService.screen,
|
118
|
+
(this.prismaService as any).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.screen.findUnique({ where: { id: screenId } });
|
145
|
+
return (this.prismaService as any).screen.findUnique({ where: { id: screenId } });
|
146
146
|
}
|
147
147
|
|
148
148
|
async create({ slug, icon }: CreateDTO) {
|
149
|
-
return this.prismaService.screen.create({
|
149
|
+
return (this.prismaService as any).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.screen.update({
|
158
|
+
return (this.prismaService as any).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.screen.deleteMany({
|
171
|
+
return (this.prismaService as any).screen.deleteMany({
|
172
172
|
where: {
|
173
173
|
id: {
|
174
174
|
in: ids,
|