@opengis/admin 0.1.79 → 0.1.80

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/admin",
3
- "version": "0.1.79",
3
+ "version": "0.1.80",
4
4
  "description": "This project Softpro Admin",
5
5
  "main": "dist/admin.js",
6
6
  "type": "module",
@@ -32,7 +32,7 @@ export default async function plugin(fastify) {
32
32
 
33
33
  const menus = rows.reduce((acc, curr) => Object.assign(acc, { [curr.menu_id]: menuList.find((item) => (item?.ua || item?.en || item?.name) === curr.name) }), {});
34
34
  const values = Object.entries(menus).reduce((acc, curr) => {
35
- if (curr[1].table) { acc.push({ ...curr[1], menuId: curr[0] }); }
35
+ if (curr[1]?.table) { acc.push({ ...curr[1], menuId: curr[0] }); }
36
36
  curr[1]?.menu?.forEach((el) => acc.push({ ...el, menuId: curr[0] }));
37
37
  return acc;
38
38
  }, []);
@@ -31,14 +31,12 @@ export default async function userNotifications({
31
31
  const limit = Math.min(maxLimit, +(query.limit || 5));
32
32
  const offset = query.page && query.page > 0 ? (query.page - 1) * limit : 0;
33
33
 
34
-
35
-
36
- const q = `select notification_id as id, subject, body, cdate,
37
- author_id, read, link, entity_id, (select avatar from admin.users where uid=a.author_id limit 1) as avatar from crm.notifications a where addressee_id=$1 order by cdate desc limit $2 offset $3`;
34
+ const q = `select notification_id as id, subject, body, cdate,
35
+ author_id, read, link, entity_id, (select avatar from admin.users where uid=a.author_id limit 1) as avatar from crm.notifications a where addressee_id=$1 order by cdate desc limit $2 offset $3`;
38
36
 
39
37
  if (query.sql) return q;
40
38
 
41
- const { rows = [] } = await pg.query(q, [userId, limit, offset]);
39
+ const { rows = [] } = await pg.query(q, [uid, limit, offset]);
42
40
 
43
41
  const values = rows.map((el) => el.author_id)
44
42
  ?.filter((el, idx, arr) => el && arr.indexOf(el) === idx);