@cadenza.io/service 1.20.0 → 1.20.1
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/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2874,14 +2874,15 @@ var DatabaseController = class _DatabaseController {
|
|
|
2874
2874
|
try {
|
|
2875
2875
|
if (awaitExists) {
|
|
2876
2876
|
for (const fk of Object.keys(awaitExists)) {
|
|
2877
|
-
|
|
2877
|
+
const value = data[fk];
|
|
2878
|
+
if (value === void 0 || value === null) continue;
|
|
2878
2879
|
const { table, column } = awaitExists[fk];
|
|
2879
2880
|
let exists = false;
|
|
2880
2881
|
let retries = 0;
|
|
2881
2882
|
const maxRetries = 100;
|
|
2882
2883
|
while (!exists && retries < maxRetries) {
|
|
2883
2884
|
const result2 = await client.query(
|
|
2884
|
-
`SELECT EXISTS(SELECT 1 from ${table} where ${column}=${
|
|
2885
|
+
`SELECT EXISTS(SELECT 1 from ${table} where ${column}=${typeof value === "string" ? `"${value}"` : value}) AS "exists"`
|
|
2885
2886
|
);
|
|
2886
2887
|
console.log("Exists check", fk, result2);
|
|
2887
2888
|
exists = result2.rows[0].exists;
|