@hedhog/admin 0.0.51 → 0.0.53

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hedhog/admin",
3
- "version": "0.0.51",
3
+ "version": "0.0.53",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -20,20 +20,6 @@ export class Migrate implements MigrationInterface {
20
20
  .execute();
21
21
  }
22
22
 
23
- const adminAccessRoutes = [88, 1, 3];
24
-
25
- for (const routeId of adminAccessRoutes) {
26
- await queryRunner.manager
27
- .createQueryBuilder()
28
- .insert()
29
- .into('role_routes', ['role_id', 'route_id'])
30
- .values({
31
- role_id: 3,
32
- route_id: routeId,
33
- })
34
- .execute();
35
- }
36
-
37
23
  await queryRunner.manager
38
24
  .createQueryBuilder()
39
25
  .insert()
@@ -252,6 +252,49 @@ export class Migrate implements MigrationInterface {
252
252
  .execute();
253
253
  }
254
254
  }
255
+
256
+ const routesGetRole3 = await queryRunner.manager
257
+ .createQueryBuilder()
258
+ .select('id')
259
+ .from('routes', 'r')
260
+ .where('r.url IN (:...urls)', {
261
+ urls: [
262
+ '/settings/groups',
263
+ '/settings/groups/:slug',
264
+ '/auth/verify',
265
+ '/menus/system',
266
+ ],
267
+ })
268
+ .where('r.method = :method', { method: 'GET' })
269
+ .execute();
270
+
271
+ const routesPutRole3 = await queryRunner.manager
272
+ .createQueryBuilder()
273
+ .select('id')
274
+ .from('routes', 'r')
275
+ .where('r.url IN (:...urls)', {
276
+ urls: ['/settings/:slug'],
277
+ })
278
+ .where('r.method = :method', { method: 'PUT' })
279
+ .execute();
280
+
281
+ const adminAccessRoutes = [];
282
+
283
+ for (const route of [...routesGetRole3, ...routesPutRole3]) {
284
+ adminAccessRoutes.push(route.id);
285
+ }
286
+
287
+ for (const routeId of adminAccessRoutes) {
288
+ await queryRunner.manager
289
+ .createQueryBuilder()
290
+ .insert()
291
+ .into('role_routes', ['role_id', 'route_id'])
292
+ .values({
293
+ role_id: 3,
294
+ route_id: routeId,
295
+ })
296
+ .execute();
297
+ }
255
298
  }
256
299
 
257
300
  public async down(queryRunner: QueryRunner): Promise<void> {