@opengis/fastify-table 1.2.7 → 1.2.8
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
|
|