@hedhog/admin 0.0.104 → 0.0.105
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +141 -141
- package/dist/admin.module.js +7 -7
- package/dist/admin.module.js.map +1 -1
- package/dist/auth/auth.service.d.ts +1 -1
- package/dist/auth/auth.service.d.ts.map +1 -1
- package/dist/auth/auth.service.js +8 -8
- package/dist/auth/auth.service.js.map +1 -1
- package/dist/auth/auth.service.spec.js +16 -16
- package/dist/auth/auth.service.spec.js.map +1 -1
- package/dist/dto/with-locale.dto.d.ts +4 -0
- package/dist/dto/with-locale.dto.d.ts.map +1 -0
- package/dist/dto/{with-locales.dto.js → with-locale.dto.js} +5 -5
- package/dist/dto/with-locale.dto.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/locale/locale.controller.js +1 -1
- package/dist/locale/locale.controller.js.map +1 -1
- package/dist/locale/locale.middleware.d.ts +1 -1
- package/dist/locale/locale.middleware.d.ts.map +1 -1
- package/dist/locale/locale.middleware.js +2 -2
- package/dist/locale/locale.middleware.js.map +1 -1
- package/dist/locale/locale.service.d.ts +6 -6
- package/dist/locale/locale.service.d.ts.map +1 -1
- package/dist/locale/locale.service.js +40 -40
- package/dist/locale/locale.service.js.map +1 -1
- package/dist/locale/locale.service.spec.js +14 -14
- package/dist/locale/locale.service.spec.js.map +1 -1
- package/dist/menu/menu.controller.js +3 -3
- package/dist/menu/menu.controller.js.map +1 -1
- package/dist/menu/menu.service.d.ts +3 -3
- package/dist/menu/menu.service.d.ts.map +1 -1
- package/dist/menu/menu.service.js +35 -35
- package/dist/menu/menu.service.js.map +1 -1
- package/dist/menu/menu.service.spec.js +33 -37
- package/dist/menu/menu.service.spec.js.map +1 -1
- package/dist/role/dto/create.dto.d.ts +2 -2
- package/dist/role/dto/create.dto.d.ts.map +1 -1
- package/dist/role/dto/create.dto.js +2 -2
- package/dist/role/dto/create.dto.js.map +1 -1
- package/dist/role/guards/role.guard.js +4 -4
- package/dist/role/guards/role.guard.js.map +1 -1
- package/dist/role/role.controller.js +7 -7
- package/dist/role/role.controller.js.map +1 -1
- package/dist/role/role.service.d.ts +2 -2
- package/dist/role/role.service.d.ts.map +1 -1
- package/dist/role/role.service.js +35 -35
- package/dist/role/role.service.js.map +1 -1
- package/dist/role/role.service.spec.d.ts +0 -1
- package/dist/role/role.service.spec.js +400 -340
- package/dist/role/role.service.spec.js.map +1 -1
- package/dist/route/route.controller.js +3 -3
- package/dist/route/route.controller.js.map +1 -1
- package/dist/route/route.service.d.ts +2 -2
- package/dist/route/route.service.d.ts.map +1 -1
- package/dist/route/route.service.js +18 -18
- package/dist/route/route.service.js.map +1 -1
- package/dist/route/route.service.spec.js +27 -27
- package/dist/route/route.service.spec.js.map +1 -1
- package/dist/screen/screen.controller.js +4 -4
- package/dist/screen/screen.controller.js.map +1 -1
- package/dist/screen/screen.service.d.ts +2 -2
- package/dist/screen/screen.service.d.ts.map +1 -1
- package/dist/screen/screen.service.js +16 -16
- package/dist/screen/screen.service.js.map +1 -1
- package/dist/screen/screen.service.spec.js +16 -16
- package/dist/screen/screen.service.spec.js.map +1 -1
- package/dist/setting/dto/setting.dto.d.ts +9 -0
- package/dist/setting/dto/setting.dto.d.ts.map +1 -0
- package/dist/setting/dto/{settings.dto.js → setting.dto.js} +6 -6
- package/dist/setting/dto/setting.dto.js.map +1 -0
- package/dist/setting/{settings.controller.d.ts → setting.controller.d.ts} +6 -6
- package/dist/setting/setting.controller.d.ts.map +1 -0
- package/dist/setting/{settings.controller.js → setting.controller.js} +20 -20
- package/dist/setting/setting.controller.js.map +1 -0
- package/dist/setting/setting.module.d.ts +3 -0
- package/dist/setting/setting.module.d.ts.map +1 -0
- package/dist/setting/{settings.module.js → setting.module.js} +6 -6
- package/dist/setting/setting.module.js.map +1 -0
- package/dist/setting/{settings.service.d.ts → setting.service.d.ts} +4 -4
- package/dist/setting/setting.service.d.ts.map +1 -0
- package/dist/setting/{settings.service.js → setting.service.js} +42 -42
- package/dist/setting/setting.service.js.map +1 -0
- package/dist/setting/setting.service.spec.d.ts +2 -0
- package/dist/setting/setting.service.spec.d.ts.map +1 -0
- package/dist/setting/{settings.service.spec.js → setting.service.spec.js} +17 -17
- package/dist/setting/setting.service.spec.js.map +1 -0
- package/dist/user/user.controller.js +3 -3
- package/dist/user/user.controller.js.map +1 -1
- package/dist/user/user.service.d.ts +2 -2
- package/dist/user/user.service.d.ts.map +1 -1
- package/dist/user/user.service.js +9 -9
- package/dist/user/user.service.js.map +1 -1
- package/dist/user/user.service.spec.js +24 -24
- package/dist/user/user.service.spec.js.map +1 -1
- package/package.json +2 -2
- package/src/admin.module.ts +36 -0
- package/src/auth/auth.controller.ts +48 -0
- package/src/auth/auth.module.ts +39 -0
- package/src/auth/auth.service.spec.ts +196 -0
- package/src/auth/auth.service.ts +175 -0
- package/src/auth/decorators/public.decorator.ts +4 -0
- package/src/auth/decorators/user.decorator.ts +17 -0
- package/src/auth/dto/forget.dto.ts +6 -0
- package/src/auth/dto/login.dto.ts +15 -0
- package/src/auth/dto/otp.dto.ts +11 -0
- package/src/auth/enums/multifactor-type.enum.ts +4 -0
- package/src/auth/guards/auth.guard.ts +50 -0
- package/src/auth/types/user.type.ts +8 -0
- package/src/dto/delete.dto.ts +8 -0
- package/src/dto/update-ids.dto.ts +9 -0
- package/src/dto/with-locale.dto.ts +8 -0
- package/src/index.ts +34 -0
- package/src/locale/dto/create.dto.ts +12 -0
- package/src/locale/dto/delete.dto.ts +8 -0
- package/src/locale/dto/set-enabled.dto.ts +9 -0
- package/src/locale/dto/update.dto.ts +15 -0
- package/src/locale/index.ts +4 -0
- package/src/locale/locale.controller.ts +79 -0
- package/src/locale/locale.decorator.ts +8 -0
- package/src/locale/locale.middleware.ts +34 -0
- package/src/locale/locale.module.ts +23 -0
- package/src/locale/locale.service.spec.ts +193 -0
- package/src/locale/locale.service.ts +366 -0
- package/src/menu/dto/create.dto.ts +25 -0
- package/src/menu/dto/order.dto.ts +8 -0
- package/src/menu/dto/update.dto.ts +19 -0
- package/src/menu/menu.controller.ts +106 -0
- package/src/menu/menu.module.ts +18 -0
- package/src/menu/menu.service.spec.ts +247 -0
- package/src/menu/menu.service.ts +263 -0
- package/src/role/decorators/role.decorator.ts +4 -0
- package/src/role/dto/create.dto.ts +7 -0
- package/src/role/dto/update.dto.ts +4 -0
- package/src/role/guards/role.guard.ts +122 -0
- package/src/role/role.controller.ts +126 -0
- package/src/role/role.module.ts +28 -0
- package/src/role/role.service.spec.ts +417 -0
- package/src/role/role.service.ts +302 -0
- package/src/route/dto/create.dto.ts +13 -0
- package/src/route/dto/update.dto.ts +15 -0
- package/src/route/route.controller.ts +91 -0
- package/src/route/route.module.ts +18 -0
- package/src/route/route.service.spec.ts +299 -0
- package/src/route/route.service.ts +164 -0
- package/src/screen/dto/create.dto.ts +19 -0
- package/src/screen/dto/update.dto.ts +19 -0
- package/src/screen/screen.controller.ts +93 -0
- package/src/screen/screen.module.ts +18 -0
- package/src/screen/screen.service.spec.ts +298 -0
- package/src/screen/screen.service.ts +181 -0
- package/src/setting/dto/create.dto.ts +1 -0
- package/src/setting/dto/setting-user.dto.ts +6 -0
- package/src/setting/dto/setting.dto.ts +17 -0
- package/src/setting/dto/update.dto.ts +3 -0
- package/src/setting/setting.controller.ts +100 -0
- package/src/setting/setting.module.ts +18 -0
- package/src/setting/setting.service.spec.ts +183 -0
- package/src/setting/setting.service.ts +346 -0
- package/src/types/http-method.ts +8 -0
- package/src/user/constants/user.constants.ts +1 -0
- package/src/user/dto/create.dto.ts +24 -0
- package/src/user/dto/update.dto.ts +41 -0
- package/src/user/user.controller.ts +75 -0
- package/src/user/user.module.ts +18 -0
- package/src/user/user.service.spec.ts +294 -0
- package/src/user/user.service.ts +129 -0
- package/tsconfig.lib.json +9 -0
- package/tsconfig.production.json +20 -0
- package/dist/dto/with-locales.dto.d.ts +0 -4
- package/dist/dto/with-locales.dto.d.ts.map +0 -1
- package/dist/dto/with-locales.dto.js.map +0 -1
- package/dist/setting/dto/settings.dto.d.ts +0 -9
- package/dist/setting/dto/settings.dto.d.ts.map +0 -1
- package/dist/setting/dto/settings.dto.js.map +0 -1
- package/dist/setting/settings.controller.d.ts.map +0 -1
- package/dist/setting/settings.controller.js.map +0 -1
- package/dist/setting/settings.module.d.ts +0 -3
- package/dist/setting/settings.module.d.ts.map +0 -1
- package/dist/setting/settings.module.js.map +0 -1
- package/dist/setting/settings.service.d.ts.map +0 -1
- package/dist/setting/settings.service.js.map +0 -1
- package/dist/setting/settings.service.spec.d.ts +0 -2
- package/dist/setting/settings.service.spec.d.ts.map +0 -1
- package/dist/setting/settings.service.spec.js.map +0 -1
@@ -15,20 +15,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.MenuService = void 0;
|
16
16
|
const pagination_1 = require("@hedhog/pagination");
|
17
17
|
const prisma_1 = require("@hedhog/prisma");
|
18
|
-
const common_1 = require("@nestjs/common");
|
19
18
|
const utils_1 = require("@hedhog/utils");
|
19
|
+
const common_1 = require("@nestjs/common");
|
20
20
|
let MenuService = class MenuService {
|
21
21
|
constructor(prismaService, paginationService) {
|
22
22
|
this.prismaService = prismaService;
|
23
23
|
this.paginationService = paginationService;
|
24
24
|
}
|
25
25
|
async updateScreens(menuId, data) {
|
26
|
-
await this.prismaService.
|
26
|
+
await this.prismaService.menu_screen.deleteMany({
|
27
27
|
where: {
|
28
28
|
menu_id: menuId,
|
29
29
|
},
|
30
30
|
});
|
31
|
-
return this.prismaService.
|
31
|
+
return this.prismaService.menu_screen.createMany({
|
32
32
|
data: data.ids.map((screenId) => ({
|
33
33
|
menu_id: menuId,
|
34
34
|
screen_id: screenId,
|
@@ -37,12 +37,12 @@ let MenuService = class MenuService {
|
|
37
37
|
});
|
38
38
|
}
|
39
39
|
async updateRoles(menuId, data) {
|
40
|
-
await this.prismaService.
|
40
|
+
await this.prismaService.role_menu.deleteMany({
|
41
41
|
where: {
|
42
42
|
menu_id: menuId,
|
43
43
|
},
|
44
44
|
});
|
45
|
-
return this.prismaService.
|
45
|
+
return this.prismaService.role_menu.createMany({
|
46
46
|
data: data.ids.map((roleId) => ({
|
47
47
|
menu_id: menuId,
|
48
48
|
role_id: roleId,
|
@@ -51,11 +51,11 @@ let MenuService = class MenuService {
|
|
51
51
|
});
|
52
52
|
}
|
53
53
|
async listScreens(locale, menuId, paginationParams) {
|
54
|
-
return this.paginationService.paginate(this.prismaService.
|
54
|
+
return this.paginationService.paginate(this.prismaService.screen, paginationParams, {
|
55
55
|
include: {
|
56
|
-
|
56
|
+
screen_locale: {
|
57
57
|
where: {
|
58
|
-
|
58
|
+
locale: {
|
59
59
|
code: locale,
|
60
60
|
},
|
61
61
|
},
|
@@ -63,7 +63,7 @@ let MenuService = class MenuService {
|
|
63
63
|
name: true,
|
64
64
|
},
|
65
65
|
},
|
66
|
-
|
66
|
+
menu_screen: {
|
67
67
|
where: {
|
68
68
|
menu_id: menuId,
|
69
69
|
},
|
@@ -73,14 +73,14 @@ let MenuService = class MenuService {
|
|
73
73
|
},
|
74
74
|
},
|
75
75
|
},
|
76
|
-
}, '
|
76
|
+
}, 'screen_locale');
|
77
77
|
}
|
78
78
|
async listRoles(locale, menuId, paginationParams) {
|
79
|
-
return this.paginationService.paginate(this.prismaService.
|
79
|
+
return this.paginationService.paginate(this.prismaService.role, paginationParams, {
|
80
80
|
include: {
|
81
|
-
|
81
|
+
role_locale: {
|
82
82
|
where: {
|
83
|
-
|
83
|
+
locale: {
|
84
84
|
code: locale,
|
85
85
|
},
|
86
86
|
},
|
@@ -89,7 +89,7 @@ let MenuService = class MenuService {
|
|
89
89
|
description: true,
|
90
90
|
},
|
91
91
|
},
|
92
|
-
|
92
|
+
role_menu: {
|
93
93
|
where: {
|
94
94
|
menu_id: menuId,
|
95
95
|
},
|
@@ -99,19 +99,19 @@ let MenuService = class MenuService {
|
|
99
99
|
},
|
100
100
|
},
|
101
101
|
},
|
102
|
-
}, '
|
102
|
+
}, 'role_locale');
|
103
103
|
}
|
104
104
|
async getMenus(locale, userId, menuId = 0) {
|
105
105
|
if (menuId === 0) {
|
106
106
|
menuId = null;
|
107
107
|
}
|
108
|
-
let
|
108
|
+
let menu = (await this.prismaService.menu.findMany({
|
109
109
|
where: {
|
110
110
|
menu_id: menuId,
|
111
|
-
|
111
|
+
role_menu: {
|
112
112
|
some: {
|
113
|
-
|
114
|
-
|
113
|
+
role: {
|
114
|
+
role_user: {
|
115
115
|
some: {
|
116
116
|
user_id: userId,
|
117
117
|
},
|
@@ -124,9 +124,9 @@ let MenuService = class MenuService {
|
|
124
124
|
order: 'asc',
|
125
125
|
},
|
126
126
|
include: {
|
127
|
-
|
127
|
+
menu_locale: {
|
128
128
|
where: {
|
129
|
-
|
129
|
+
locale: {
|
130
130
|
code: locale,
|
131
131
|
},
|
132
132
|
},
|
@@ -136,11 +136,11 @@ let MenuService = class MenuService {
|
|
136
136
|
},
|
137
137
|
},
|
138
138
|
}));
|
139
|
-
|
140
|
-
for (let i = 0; i <
|
141
|
-
|
139
|
+
menu = menu.map((m) => (0, utils_1.itemTranslations)('menu_locale', m));
|
140
|
+
for (let i = 0; i < menu.length; i++) {
|
141
|
+
menu[i].menu = await this.getMenus(locale, userId, menu[i].id);
|
142
142
|
}
|
143
|
-
return
|
143
|
+
return menu;
|
144
144
|
}
|
145
145
|
async getSystemMenu(locale, userId) {
|
146
146
|
return this.getMenus(locale, userId);
|
@@ -148,14 +148,14 @@ let MenuService = class MenuService {
|
|
148
148
|
async getMenu(locale, paginationParams) {
|
149
149
|
const fields = ['url', 'icon'];
|
150
150
|
const OR = this.prismaService.createInsensitiveSearch(fields, paginationParams);
|
151
|
-
return this.paginationService.paginate(this.prismaService.
|
151
|
+
return this.paginationService.paginate(this.prismaService.menu, paginationParams, {
|
152
152
|
where: {
|
153
153
|
OR,
|
154
154
|
},
|
155
155
|
include: {
|
156
|
-
|
156
|
+
menu_locale: {
|
157
157
|
where: {
|
158
|
-
|
158
|
+
locale: {
|
159
159
|
code: locale,
|
160
160
|
},
|
161
161
|
},
|
@@ -164,20 +164,20 @@ let MenuService = class MenuService {
|
|
164
164
|
},
|
165
165
|
},
|
166
166
|
},
|
167
|
-
}, '
|
167
|
+
}, 'menu_locale');
|
168
168
|
}
|
169
169
|
async get(menuId) {
|
170
|
-
return this.prismaService.
|
170
|
+
return this.prismaService.menu.findUnique({
|
171
171
|
where: { id: menuId },
|
172
172
|
});
|
173
173
|
}
|
174
174
|
async create({ name, url, icon, order, menuId }) {
|
175
|
-
return this.prismaService.
|
175
|
+
return this.prismaService.menu.create({
|
176
176
|
data: { name, url, icon, order, menu_id: menuId },
|
177
177
|
});
|
178
178
|
}
|
179
179
|
async update({ id, data }) {
|
180
|
-
return this.prismaService.
|
180
|
+
return this.prismaService.menu.update({
|
181
181
|
where: { id },
|
182
182
|
data,
|
183
183
|
});
|
@@ -186,7 +186,7 @@ let MenuService = class MenuService {
|
|
186
186
|
if (ids == undefined || ids == null) {
|
187
187
|
throw new common_1.BadRequestException(`You must select at least one menu to delete.`);
|
188
188
|
}
|
189
|
-
return this.prismaService.
|
189
|
+
return this.prismaService.menu.deleteMany({
|
190
190
|
where: {
|
191
191
|
id: {
|
192
192
|
in: ids,
|
@@ -195,7 +195,7 @@ let MenuService = class MenuService {
|
|
195
195
|
});
|
196
196
|
}
|
197
197
|
async updateOrder({ ids }) {
|
198
|
-
const count = await this.prismaService.
|
198
|
+
const count = await this.prismaService.menu.count({
|
199
199
|
where: {
|
200
200
|
id: {
|
201
201
|
in: ids,
|
@@ -205,7 +205,7 @@ let MenuService = class MenuService {
|
|
205
205
|
if (count !== ids.length) {
|
206
206
|
throw new common_1.BadRequestException('IDs inválidos.');
|
207
207
|
}
|
208
|
-
await Promise.all(ids.map((id, index) => this.prismaService.
|
208
|
+
await Promise.all(ids.map((id, index) => this.prismaService.menu.update({
|
209
209
|
where: { id },
|
210
210
|
data: { order: index + 1 },
|
211
211
|
})));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"menu.service.js","sourceRoot":"","sources":["../../src/menu/menu.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDAAsE;AACtE,2CAA+C;AAC/C,
|
1
|
+
{"version":3,"file":"menu.service.js","sourceRoot":"","sources":["../../src/menu/menu.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDAAsE;AACtE,2CAA+C;AAC/C,yCAAiD;AACjD,2CAKwB;AAQjB,IAAM,WAAW,GAAjB,MAAM,WAAW;IACtB,YAEmB,aAA4B,EAE5B,iBAAoC;QAFpC,kBAAa,GAAb,aAAa,CAAe;QAE5B,sBAAiB,GAAjB,iBAAiB,CAAmB;IACpD,CAAC;IAEJ,KAAK,CAAC,aAAa,CAAC,MAAc,EAAE,IAAkB;QACpD,MAAM,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,UAAU,CAAC;YAC9C,KAAK,EAAE;gBACL,OAAO,EAAE,MAAM;aAChB;SACF,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,UAAU,CAAC;YAC/C,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;gBAChC,OAAO,EAAE,MAAM;gBACf,SAAS,EAAE,QAAQ;aACpB,CAAC,CAAC;YACH,cAAc,EAAE,IAAI;SACrB,CAAC,CAAC;IACL,CAAC;IACD,KAAK,CAAC,WAAW,CAAC,MAAc,EAAE,IAAkB;QAClD,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,UAAU,CAAC;YAC5C,KAAK,EAAE;gBACL,OAAO,EAAE,MAAM;aAChB;SACF,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,UAAU,CAAC;YAC7C,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;gBAC9B,OAAO,EAAE,MAAM;gBACf,O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");
|
4
|
-
const menu_service_1 = require("./menu.service");
|
5
|
-
const prisma_1 = require("@hedhog/prisma");
|
6
3
|
const pagination_1 = require("@hedhog/pagination");
|
4
|
+
const prisma_1 = require("@hedhog/prisma");
|
7
5
|
const common_1 = require("@nestjs/common");
|
6
|
+
const testing_1 = require("@nestjs/testing");
|
7
|
+
const menu_service_1 = require("./menu.service");
|
8
8
|
describe('MenuService', () => {
|
9
9
|
let menuService;
|
10
10
|
let prismaService;
|
11
11
|
let paginationService;
|
12
12
|
const mockPrismaService = {
|
13
|
-
|
13
|
+
menu: {
|
14
14
|
create: jest.fn(),
|
15
15
|
update: jest.fn(),
|
16
16
|
deleteMany: jest.fn(),
|
@@ -18,11 +18,11 @@ describe('MenuService', () => {
|
|
18
18
|
findMany: jest.fn(),
|
19
19
|
count: jest.fn(),
|
20
20
|
},
|
21
|
-
|
21
|
+
role_menu: {
|
22
22
|
deleteMany: jest.fn(),
|
23
23
|
createMany: jest.fn(),
|
24
24
|
},
|
25
|
-
|
25
|
+
menu_screen: {
|
26
26
|
deleteMany: jest.fn(),
|
27
27
|
createMany: jest.fn(),
|
28
28
|
},
|
@@ -55,10 +55,10 @@ describe('MenuService', () => {
|
|
55
55
|
order: 1,
|
56
56
|
menu_id: undefined,
|
57
57
|
};
|
58
|
-
mockPrismaService.
|
58
|
+
mockPrismaService.menu.create.mockResolvedValue(createMenuDto);
|
59
59
|
const result = await menuService.create(createMenuDto);
|
60
60
|
expect(result).toEqual(createMenuDto);
|
61
|
-
expect(prismaService.
|
61
|
+
expect(prismaService.menu.create).toHaveBeenCalledWith({
|
62
62
|
data: createMenuDto,
|
63
63
|
});
|
64
64
|
});
|
@@ -66,22 +66,22 @@ describe('MenuService', () => {
|
|
66
66
|
describe('update', () => {
|
67
67
|
it('should update a menu', async () => {
|
68
68
|
const updateDto = { id: 1, data: { name: 'Updated Menu' } };
|
69
|
-
mockPrismaService.
|
69
|
+
mockPrismaService.menu.update.mockResolvedValue(updateDto.data);
|
70
70
|
const result = await menuService.update(updateDto);
|
71
71
|
expect(result).toEqual(updateDto.data);
|
72
|
-
expect(prismaService.
|
72
|
+
expect(prismaService.menu.update).toHaveBeenCalledWith({
|
73
73
|
where: { id: updateDto.id },
|
74
74
|
data: updateDto.data,
|
75
75
|
});
|
76
76
|
});
|
77
77
|
});
|
78
78
|
describe('delete', () => {
|
79
|
-
it('should delete
|
79
|
+
it('should delete menu', async () => {
|
80
80
|
const deleteDto = { ids: [1, 2, 3] };
|
81
|
-
mockPrismaService.
|
81
|
+
mockPrismaService.menu.deleteMany.mockResolvedValue({ count: 3 });
|
82
82
|
const result = await menuService.delete(deleteDto);
|
83
83
|
expect(result).toEqual({ count: 3 });
|
84
|
-
expect(prismaService.
|
84
|
+
expect(prismaService.menu.deleteMany).toHaveBeenCalledWith({
|
85
85
|
where: { id: { in: deleteDto.ids } },
|
86
86
|
});
|
87
87
|
});
|
@@ -105,7 +105,7 @@ describe('MenuService', () => {
|
|
105
105
|
mockPaginationService.paginate.mockResolvedValue(mockScreens);
|
106
106
|
const result = await menuService.listScreens(locale, menuId, paginationParams);
|
107
107
|
expect(result).toEqual(mockScreens);
|
108
|
-
expect(paginationService.paginate).toHaveBeenCalledWith(prismaService.screens, paginationParams, expect.anything(), '
|
108
|
+
expect(paginationService.paginate).toHaveBeenCalledWith(prismaService.screens, paginationParams, expect.anything(), 'screen_locale');
|
109
109
|
});
|
110
110
|
});
|
111
111
|
describe('updateScreens', () => {
|
@@ -113,16 +113,16 @@ describe('MenuService', () => {
|
|
113
113
|
const menuId = 1;
|
114
114
|
const updateData = { ids: [1, 2, 3] };
|
115
115
|
jest
|
116
|
-
.spyOn(prismaService.
|
116
|
+
.spyOn(prismaService.menu_screen, 'deleteMany')
|
117
117
|
.mockResolvedValue(null);
|
118
118
|
jest
|
119
|
-
.spyOn(prismaService.
|
119
|
+
.spyOn(prismaService.menu_screen, 'createMany')
|
120
120
|
.mockResolvedValue(null);
|
121
121
|
await menuService.updateScreens(menuId, updateData);
|
122
|
-
expect(prismaService.
|
122
|
+
expect(prismaService.menu_screen.deleteMany).toHaveBeenCalledWith({
|
123
123
|
where: { menu_id: menuId },
|
124
124
|
});
|
125
|
-
expect(prismaService.
|
125
|
+
expect(prismaService.menu_screen.createMany).toHaveBeenCalledWith({
|
126
126
|
data: updateData.ids.map((screenId) => ({
|
127
127
|
menu_id: menuId,
|
128
128
|
screen_id: screenId,
|
@@ -132,20 +132,16 @@ describe('MenuService', () => {
|
|
132
132
|
});
|
133
133
|
});
|
134
134
|
describe('updateRoles', () => {
|
135
|
-
it('should update
|
135
|
+
it('should update role associated with a menu', async () => {
|
136
136
|
const menuId = 1;
|
137
137
|
const updateData = { ids: [1, 2] };
|
138
|
-
jest
|
139
|
-
|
140
|
-
.mockResolvedValue(null);
|
141
|
-
jest
|
142
|
-
.spyOn(prismaService.role_menus, 'createMany')
|
143
|
-
.mockResolvedValue(null);
|
138
|
+
jest.spyOn(prismaService.role_menu, 'deleteMany').mockResolvedValue(null);
|
139
|
+
jest.spyOn(prismaService.role_menu, 'createMany').mockResolvedValue(null);
|
144
140
|
await menuService.updateRoles(menuId, updateData);
|
145
|
-
expect(prismaService.
|
141
|
+
expect(prismaService.role_menu.deleteMany).toHaveBeenCalledWith({
|
146
142
|
where: { menu_id: menuId },
|
147
143
|
});
|
148
|
-
expect(prismaService.
|
144
|
+
expect(prismaService.role_menu.createMany).toHaveBeenCalledWith({
|
149
145
|
data: updateData.ids.map((roleId) => ({
|
150
146
|
menu_id: menuId,
|
151
147
|
role_id: roleId,
|
@@ -155,17 +151,17 @@ describe('MenuService', () => {
|
|
155
151
|
});
|
156
152
|
});
|
157
153
|
describe('updateOrder', () => {
|
158
|
-
it('should update the order of
|
154
|
+
it('should update the order of menu', async () => {
|
159
155
|
const orderData = { ids: [1, 2, 3] };
|
160
|
-
jest.spyOn(prismaService.
|
161
|
-
jest.spyOn(prismaService.
|
156
|
+
jest.spyOn(prismaService.menu, 'count').mockResolvedValue(3);
|
157
|
+
jest.spyOn(prismaService.menu, 'update').mockResolvedValue(null);
|
162
158
|
await menuService.updateOrder(orderData);
|
163
|
-
expect(prismaService.
|
159
|
+
expect(prismaService.menu.count).toHaveBeenCalledWith({
|
164
160
|
where: { id: { in: orderData.ids } },
|
165
161
|
});
|
166
|
-
expect(prismaService.
|
162
|
+
expect(prismaService.menu.update).toHaveBeenCalledTimes(orderData.ids.length);
|
167
163
|
orderData.ids.forEach((id, index) => {
|
168
|
-
expect(prismaService.
|
164
|
+
expect(prismaService.menu.update).toHaveBeenCalledWith({
|
169
165
|
where: { id },
|
170
166
|
data: { order: index + 1 },
|
171
167
|
});
|
@@ -173,22 +169,22 @@ describe('MenuService', () => {
|
|
173
169
|
});
|
174
170
|
it('should throw BadRequestException if IDs are invalid', async () => {
|
175
171
|
const orderData = { ids: [1, 2, 3] };
|
176
|
-
jest.spyOn(prismaService.
|
172
|
+
jest.spyOn(prismaService.menu, 'count').mockResolvedValue(2); // IDs não batem com o número esperado
|
177
173
|
await expect(menuService.updateOrder(orderData)).rejects.toThrow(common_1.BadRequestException);
|
178
174
|
});
|
179
175
|
});
|
180
176
|
/*
|
181
177
|
describe('getMenus', () => {
|
182
|
-
it('should get
|
178
|
+
it('should get menu for a user', async () => {
|
183
179
|
const locale = 'en';
|
184
180
|
const userId = 1;
|
185
181
|
const mockMenus = [{ id: 1, name: 'Menu 1' }];
|
186
|
-
mockPrismaService.
|
182
|
+
mockPrismaService.menu.findMany.mockResolvedValue(mockMenus);
|
187
183
|
|
188
184
|
const result = await menuService.getMenus(locale, userId);
|
189
185
|
|
190
186
|
expect(result).toEqual(mockMenus);
|
191
|
-
expect(prismaService.
|
187
|
+
expect(prismaService.menu.findMany).toHaveBeenCalled();
|
192
188
|
});
|
193
189
|
});
|
194
190
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"menu.service.spec.js","sourceRoot":"","sources":["../../src/menu/menu.service.spec.ts"],"names":[],"mappings":";;AAAA,
|
1
|
+
{"version":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EAAE,EAAE,KAAK,EAAE,EAAE;gBAClC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,oBAAoB,CAAC;oBACrD,KAAK,EAAE,EAAE,EAAE,EAAE;oBACb,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,GAAG,CAAC,EAAE;iBAC3B,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,qDAAqD,EAAE,KAAK,IAAI,EAAE;YACnE,MAAM,SAAS,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;YAErC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,sCAAsC;YAEpG,MAAM,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAC9D,4BAAmB,CACpB,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH;;;;;;;;;;;;;;MAcE;AACJ,CAAC,CAAC,CAAC"}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import {
|
2
|
-
export declare class CreateDTO extends
|
1
|
+
import { WithLocaleDTO } from '../../dto/with-locale.dto';
|
2
|
+
export declare class CreateDTO extends WithLocaleDTO {
|
3
3
|
slug: string;
|
4
4
|
}
|
5
5
|
//# sourceMappingURL=create.dto.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"create.dto.d.ts","sourceRoot":"","sources":["../../../src/role/dto/create.dto.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"create.dto.d.ts","sourceRoot":"","sources":["../../../src/role/dto/create.dto.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1D,qBAAa,SAAU,SAAQ,aAAa;IAE1C,IAAI,EAAE,MAAM,CAAC;CACd"}
|
@@ -11,8 +11,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
exports.CreateDTO = void 0;
|
13
13
|
const class_validator_1 = require("class-validator");
|
14
|
-
const
|
15
|
-
class CreateDTO extends
|
14
|
+
const with_locale_dto_1 = require("../../dto/with-locale.dto");
|
15
|
+
class CreateDTO extends with_locale_dto_1.WithLocaleDTO {
|
16
16
|
}
|
17
17
|
exports.CreateDTO = CreateDTO;
|
18
18
|
__decorate([
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"create.dto.js","sourceRoot":"","sources":["../../../src/role/dto/create.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA2C;AAC3C
|
1
|
+
{"version":3,"file":"create.dto.js","sourceRoot":"","sources":["../../../src/role/dto/create.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA2C;AAC3C,+DAA0D;AAE1D,MAAa,SAAU,SAAQ,+BAAa;CAG3C;AAHD,8BAGC;AADC;IADC,IAAA,0BAAQ,GAAE;;uCACE"}
|
@@ -82,14 +82,14 @@ let RoleGuard = class RoleGuard {
|
|
82
82
|
httpMethod = 'ALL';
|
83
83
|
break;
|
84
84
|
}
|
85
|
-
const route = await this.prisma.
|
85
|
+
const route = await this.prisma.route.count({
|
86
86
|
where: {
|
87
87
|
method: httpMethod,
|
88
88
|
url: fullPath,
|
89
|
-
|
89
|
+
role_route: {
|
90
90
|
some: {
|
91
|
-
|
92
|
-
|
91
|
+
role: {
|
92
|
+
role_user: {
|
93
93
|
some: {
|
94
94
|
user_id: Number(userId),
|
95
95
|
},
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"role.guard.js","sourceRoot":"","sources":["../../../src/role/guards/role.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA+C;AAC/C,2C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MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;YAC1C,KAAK,EAAE;gBACL,MAAM,EAAE,UAAU;gBAClB,GAAG,EAAE,QAAQ;gBACb,UAAU,EAAE;oBACV,IAAI,EAAE;wBACJ,IAAI,EAAE;4BACJ,SAAS,EAAE;gCACT,IAAI,EAAE;oCACJ,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC;iCACxB;6BACF;yBACF;qBACF;iBACF;aACF;SACF,CAAC,CAAC;QAEH,OAAO,KAAK,KAAK,CAAC,CAAC;IACrB,CAAC;IAEO,sBAAsB,CAAC,OAAgB;;QAC7C,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,MAAA,MAAA,OAAO,CAAC,OAAO,CAAC,aAAa,0CAAE,KAAK,CAAC,GAAG,CAAC,mCAAI,EAAE,CAAC;QACtE,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IAC/C,CAAC;CACF,CAAA;AAxGY,8BAAS;oBAAT,SAAS;IADrB,IAAA,mBAAU,GAAE;IAIR,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,sBAAa,CAAC,CAAC,CAAA;qCADrB,gBAAS;QAEH,sBAAa;GAJ7B,SAAS,CAwGrB"}
|
@@ -79,7 +79,7 @@ __decorate([
|
|
79
79
|
__metadata("design:returntype", Promise)
|
80
80
|
], RoleController.prototype, "getRoles", null);
|
81
81
|
__decorate([
|
82
|
-
(0, common_1.Get)(':roleId/
|
82
|
+
(0, common_1.Get)(':roleId/user'),
|
83
83
|
__param(0, (0, pagination_1.Pagination)()),
|
84
84
|
__param(1, (0, common_1.Param)('roleId', common_1.ParseIntPipe)),
|
85
85
|
__metadata("design:type", Function),
|
@@ -87,7 +87,7 @@ __decorate([
|
|
87
87
|
__metadata("design:returntype", Promise)
|
88
88
|
], RoleController.prototype, "listUsers", null);
|
89
89
|
__decorate([
|
90
|
-
(0, common_1.Get)(':roleId/
|
90
|
+
(0, common_1.Get)(':roleId/menu'),
|
91
91
|
__param(0, (0, pagination_1.Pagination)()),
|
92
92
|
__param(1, (0, common_1.Param)('roleId', common_1.ParseIntPipe)),
|
93
93
|
__param(2, (0, locale_1.Locale)()),
|
@@ -96,7 +96,7 @@ __decorate([
|
|
96
96
|
__metadata("design:returntype", Promise)
|
97
97
|
], RoleController.prototype, "listMenus", null);
|
98
98
|
__decorate([
|
99
|
-
(0, common_1.Get)(':roleId/
|
99
|
+
(0, common_1.Get)(':roleId/route'),
|
100
100
|
__param(0, (0, pagination_1.Pagination)()),
|
101
101
|
__param(1, (0, common_1.Param)('roleId', common_1.ParseIntPipe)),
|
102
102
|
__metadata("design:type", Function),
|
@@ -113,7 +113,7 @@ __decorate([
|
|
113
113
|
__metadata("design:returntype", Promise)
|
114
114
|
], RoleController.prototype, "listScreens", null);
|
115
115
|
__decorate([
|
116
|
-
(0, common_1.Patch)(':roleId/
|
116
|
+
(0, common_1.Patch)(':roleId/user'),
|
117
117
|
__param(0, (0, common_1.Param)('roleId', common_1.ParseIntPipe)),
|
118
118
|
__param(1, (0, common_1.Body)()),
|
119
119
|
__metadata("design:type", Function),
|
@@ -121,7 +121,7 @@ __decorate([
|
|
121
121
|
__metadata("design:returntype", Promise)
|
122
122
|
], RoleController.prototype, "updateUsers", null);
|
123
123
|
__decorate([
|
124
|
-
(0, common_1.Patch)(':roleId/
|
124
|
+
(0, common_1.Patch)(':roleId/menu'),
|
125
125
|
__param(0, (0, common_1.Param)('roleId', common_1.ParseIntPipe)),
|
126
126
|
__param(1, (0, common_1.Body)()),
|
127
127
|
__metadata("design:type", Function),
|
@@ -129,7 +129,7 @@ __decorate([
|
|
129
129
|
__metadata("design:returntype", Promise)
|
130
130
|
], RoleController.prototype, "updateMenus", null);
|
131
131
|
__decorate([
|
132
|
-
(0, common_1.Patch)(':roleId/
|
132
|
+
(0, common_1.Patch)(':roleId/route'),
|
133
133
|
__param(0, (0, common_1.Param)('roleId', common_1.ParseIntPipe)),
|
134
134
|
__param(1, (0, common_1.Body)()),
|
135
135
|
__metadata("design:type", Function),
|
@@ -176,7 +176,7 @@ __decorate([
|
|
176
176
|
], RoleController.prototype, "delete", null);
|
177
177
|
exports.RoleController = RoleController = __decorate([
|
178
178
|
(0, role_decorator_1.Role)(),
|
179
|
-
(0, common_1.Controller)('
|
179
|
+
(0, common_1.Controller)('role'),
|
180
180
|
__param(0, (0, common_1.Inject)((0, common_1.forwardRef)(() => role_service_1.RoleService))),
|
181
181
|
__metadata("design:paramtypes", [role_service_1.RoleService])
|
182
182
|
], RoleController);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"role.controller.js","sourceRoot":"","sources":["../../src/role/role.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDAAgD;AAChD,2CAWwB;AACxB,kDAA8C;AAC9C,0DAAqD;AACrD,sCAAmC;AACnC,sEAAyD;AACzD,iDAA6C;AAC7C,iDAA6C;AAC7C,iDAA6C;AAItC,IAAM,cAAc,GAApB,MAAM,cAAc;IACzB,YAEmB,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IACxC,CAAC;IAGE,AAAN,KAAK,CAAC,QAAQ,CAAe,gBAAgB,EAAY,MAAM;QAC7D,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC7D,CAAC;IAGK,AAAN,KAAK,CAAC,SAAS,CACC,gBAAgB,EACC,MAAc;QAE7C,OAAO,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC9D,CAAC;IAGK,AAAN,KAAK,CAAC,SAAS,CACC,gBAAgB,EACC,MAAc,EACnC,MAAM;QAEhB,OAAO,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC;IACtE,CAAC;IAGK,AA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,EAAE,qBAAY,CAAC,CAAA;IAC7B,WAAA,IAAA,aAAI,GAAE,CAAA;;6CAAO,6BAAY;;iDAG3B;AAGK;IADL,IAAA,cAAK,EAAC,eAAe,CAAC;IAEpB,WAAA,IAAA,cAAK,EAAC,QAAQ,EAAE,qBAAY,CAAC,CAAA;IAC7B,WAAA,IAAA,aAAI,GAAE,CAAA;;6CAAO,6BAAY;;kDAG3B;AAGK;IADL,IAAA,cAAK,EAAC,iBAAiB,CAAC;IAEtB,WAAA,IAAA,cAAK,EAAC,QAAQ,EAAE,qBAAY,CAAC,CAAA;IAC7B,WAAA,IAAA,aAAI,GAAE,CAAA;;6CAAO,6BAAY;;mDAG3B;AAGK;IADL,IAAA,YAAG,EAAC,SAAS,CAAC;IACH,WAAA,IAAA,cAAK,EAAC,QAAQ,EAAE,qBAAY,CAAC,CAAA;IAAkB,WAAA,IAAA,eAAM,GAAE,CAAA;;;;0CAElE;AAGD;IADC,IAAA,aAAI,GAAE;IACC,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAO,sBAAS;;4CAE7B;AAGK;IADL,IAAA,cAAK,EAAC,SAAS,CAAC;IAEd,WAAA,IAAA,cAAK,EAAC,QAAQ,EAAE,qBAAY,CAAC,CAAA;IAC7B,WAAA,IAAA,aAAI,GAAE,CAAA;;6CAAO,sBAAS;;4CAMxB;AAGK;IADL,IAAA,eAAM,GAAE;IACK,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAO,sBAAS;;4CAEnC;yBArGU,cAAc;IAF1B,IAAA,qBAAI,GAAE;IACN,IAAA,mBAAU,EAAC,MAAM,CAAC;IAGd,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,0BAAW,CAAC,CAAC,CAAA;qCACR,0BAAW;GAHhC,cAAc,CAsG1B"}
|
@@ -20,8 +20,8 @@ export declare class RoleService {
|
|
20
20
|
listScreens(locale: string, roleId: number, paginationParams: PaginationDTO): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
|
21
21
|
getRoles(locale: string, paginationParams: PaginationDTO): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
|
22
22
|
get(locale: string, roleId: number): Promise<any>;
|
23
|
-
create({ slug,
|
24
|
-
update({ id, data: {
|
23
|
+
create({ slug, locale }: CreateDTO): Promise<any>;
|
24
|
+
update({ id, data: { locale, slug }, }: {
|
25
25
|
id: number;
|
26
26
|
data: UpdateDTO;
|
27
27
|
}): Promise<any>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"role.service.d.ts","sourceRoot":"","sources":["../../src/role/role.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAQ/C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,qBACa,WAAW;IAGpB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAE9B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAElC,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAJb,aAAa,EAAE,aAAa,EAE5B,iBAAiB,EAAE,iBAAiB,EAEpC,aAAa,EAAE,aAAa;IAGzC,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,EAAE,YAAY;IAgBjD,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY;IAgBhD,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY;IAgB/C,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,E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