@opengis/admin 0.3.84 → 0.3.86

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,4 +1,4 @@
1
- import { _ as n, g as m } from "./import-file-DoXCXa-Q.js";
1
+ import { _ as n, g as m } from "./import-file-CrENtq-3.js";
2
2
  import { u as p } from "./user-B_2kh6ic.js";
3
3
  import { resolveComponent as d, openBlock as u, createElementBlock as f, createElementVNode as o, createBlock as h, createCommentVNode as b } from "vue";
4
4
  const x = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/admin",
3
- "version": "0.3.84",
3
+ "version": "0.3.86",
4
4
  "description": "This project Softpro Admin",
5
5
  "main": "dist/admin.js",
6
6
  "type": "module",
@@ -88,35 +88,41 @@ export default async function widgetGet({
88
88
 
89
89
  };
90
90
 
91
- const sql = sqls[params.type];
91
+ const q = sqls[params.type];
92
92
 
93
- if (!sql) {
93
+ if (!q) {
94
94
  return reply.status(400).send('invalid widget type');
95
95
  }
96
96
 
97
97
 
98
98
  /* data */
99
99
  const time = [Date.now()];
100
- const { rows = [] } = await pg.query(sql, [objectid, params.type === 'gallery' ? galleryExtList : null].filter((el) => el));
100
+ const { rows = [] } = await pg.query(q, [objectid, params.type === 'gallery' ? galleryExtList : null].filter((el) => el));
101
101
  rows.forEach(row => Object.assign(row, { username: row.username?.trim?.() || row.login }));
102
102
  time.push(Date.now());
103
103
 
104
104
  /* Object info */
105
- const { tableName } = pg.pk['log.table_changes'] ? await pg.query('select entity_type as "tableName" from log.table_changes where entity_id=$1 limit 1', [objectid]).then(el => el.rows?.[0] || {}) : {};
106
- const { pk } = await getMeta({ pg, table: tableName });
105
+ const { tableName } = pg.pk['log.table_changes'] ? await pg.query(
106
+ 'select entity_type as "tableName" from log.table_changes where entity_id=$1 limit 1',
107
+ [objectid]
108
+ ).then(el => el.rows?.[0] || {}) : {};
109
+
110
+ const { pk, columns = [] } = await getMeta({ pg, table: tableName });
111
+
112
+ const authorIdColumn = columns.find(col => ['uid', 'created_by'].includes(col.name))?.name;
107
113
 
108
114
  if (!pk && params.type === 'history' && !unittest) {
109
115
  return reply.status(404).send('log table not found');
110
116
  }
111
117
 
112
- const q = tableName && pg.pk['admin.users'] ? `select ${username} as author, u.login, a.cdate, a.editor_date from ${tableName} a
113
- left join admin.users u on a.uid=u.uid where a.${pk}=$1 limit 1` : undefined;
118
+ const q1 = `select ${username} as author, u.login, a.cdate, a.editor_date from ${tableName} a
119
+ left join admin.users u on a.${authorIdColumn}=u.uid where a.${pk}=$1 limit 1`;
114
120
 
115
- const data = pk && q ? await pg.query(q, [objectid]).then(el => el.rows?.[0] || {}) : {};
121
+ const data = pg.pk['admin.users'] && pk && tableName ? await pg.query(q, [objectid]).then(el => el.rows?.[0] || {}) : {};
116
122
 
117
123
  if (query.debug && user?.user_type === 'admin') {
118
124
  return {
119
- sql, type: params.type, q, id: objectid, data,
125
+ q, type: params.type, q1, id: objectid, data,
120
126
  };
121
127
  }
122
128