@opengis/fastify-table 2.0.53 → 2.0.54

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.
@@ -1 +1 @@
1
- {"version":3,"file":"access.group.post.d.ts","sourceRoot":"","sources":["../../../../../server/routes/access/controllers/access.group.post.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAKzD,wBAA8B,eAAe,CAC3C,EACE,EAAqB,EACrB,MAAM,EACN,IAAS,EACT,IAAS,EACT,QAAQ,GACT,EAAE;IACD,EAAE,EAAE,UAAU,CAAC;IACf,MAAM,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB,EACD,KAAK,EAAE,YAAY;;;GAiFpB"}
1
+ {"version":3,"file":"access.group.post.d.ts","sourceRoot":"","sources":["../../../../../server/routes/access/controllers/access.group.post.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAKzD,wBAA8B,eAAe,CAC3C,EACE,EAAqB,EACrB,MAAM,EACN,IAAS,EACT,IAAS,EACT,QAAQ,GACT,EAAE;IACD,EAAE,EAAE,UAAU,CAAC;IACf,MAAM,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB,EACD,KAAK,EAAE,YAAY;;;GA4FpB"}
@@ -21,12 +21,14 @@ export default async function accessGroupPost({ pg = pgClients.client, params, u
21
21
  if (routes?.length) {
22
22
  const routesDB = await pg
23
23
  .query('select array_agg(route_id) as "routesDB" from admin.routes where enabled')
24
- .then((res1) => res1.rows?.[0]?.routesDB || []);
24
+ .then((el) => el.rows?.[0]?.routesDB || []);
25
25
  await pg.query("delete from admin.role_access where role_id=$1;", [id]);
26
- const q = "insert into admin.role_access(role_id,route_id,actions) values ($1,$2,$3)";
27
26
  await Promise.all(routes
28
- .filter((el) => routesDB?.includes?.(el.path) && el.actions)
29
- .map((el) => pg.query(q, [id, el.path, el.actions])));
27
+ .filter((el) => !routesDB?.includes(el.path))
28
+ .map((el) => pg.query("insert into admin.routes(route_id) values($1)", [el.path])));
29
+ await Promise.all(routes
30
+ .filter((el) => /*routesDB?.includes?.(el.path) && */ el.actions)
31
+ .map((el) => pg.query("insert into admin.role_access(role_id,route_id,actions) values ($1,$2,$3)", [id, el.path, el.actions])));
30
32
  const { rows } = await pg.query(`select a.route_id as path, b.actions as actions from admin.routes a
31
33
  left join admin.role_access b on a.route_id=b.route_id
32
34
  where b.role_id=$1`, [id]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/fastify-table",
3
- "version": "2.0.53",
3
+ "version": "2.0.54",
4
4
  "type": "module",
5
5
  "description": "core-plugins",
6
6
  "keywords": [