@opengis/fastify-table 1.2.7 → 1.2.9
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
|
@@ -15,8 +15,13 @@ const defaultTitles = {
|
|
|
15
15
|
ext: 'Розширення файлу',
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
function getValue(val) {
|
|
18
|
+
function getValue(val, tableName) {
|
|
19
19
|
if (!val) return null;
|
|
20
|
+
if (['crm.files'].includes(tableName)) {
|
|
21
|
+
return typeof val === 'object'
|
|
22
|
+
? JSON.stringify(val)
|
|
23
|
+
: val;
|
|
24
|
+
}
|
|
20
25
|
return typeof val === 'object'
|
|
21
26
|
? JSON.stringify(val)?.substring?.(0, 30)
|
|
22
27
|
: val?.toString?.()?.substring?.(0, 30);
|
|
@@ -85,8 +90,8 @@ export default async function logChanges({
|
|
|
85
90
|
const changesData = Object.keys(newObj || {}).map(el => ({
|
|
86
91
|
change_id: changeId,
|
|
87
92
|
entity_key: el,
|
|
88
|
-
value_old: getValue(old?.[el]),
|
|
89
|
-
value_new: type === 'DELETE' ? null : getValue(newObj?.[el]),
|
|
93
|
+
value_old: getValue(old?.[el], table),
|
|
94
|
+
value_new: type === 'DELETE' ? null : getValue(newObj?.[el], table),
|
|
90
95
|
uid,
|
|
91
96
|
})).filter(el => el?.value_new !== el?.value_old);
|
|
92
97
|
|
|
@@ -12,7 +12,8 @@ export default async function getSelectMeta({ name, pg = pgClients.client, nocac
|
|
|
12
12
|
if (selectMeta[name] && !nocache) return selectMeta[name];
|
|
13
13
|
|
|
14
14
|
const cls = await getSelect(name, pg);
|
|
15
|
-
const
|
|
15
|
+
const db = typeof cls.db === 'string' ? { database: cls.db } : cls.db;
|
|
16
|
+
const pg1 = cls?.db ? getPG(db) : pg;
|
|
16
17
|
if (!pg1?.pk) await pg1.init();
|
|
17
18
|
|
|
18
19
|
if (!cls) return null;
|