diff --git a/lib/DboBuilder/TableHandler/DataValidator.ts b/lib/DboBuilder/TableHandler/DataValidator.ts index 9cca68b6..f7b7f7e9 100644 --- a/lib/DboBuilder/TableHandler/DataValidator.ts +++ b/lib/DboBuilder/TableHandler/DataValidator.ts @@ -332,8 +332,9 @@ const convertionFuncs: ConvertionFunc[] = [ onlyAllowedFor: "update", getQuery: ({ args, column }) => { if (!args.length) throw "merge function requires at least one argument"; - const argList = args.map(arg => asValue(arg)).join(" || "); - return `${asName(column.name)} || ${argList}`; + const argVals = args.map(arg => asValue(arg)) + const argList = argVals.join(" || "); + return `COALESCE(${asName(column.name)}, ${argVals.join(", ")}) || ${argList}`; } } ]; diff --git a/lib/FileManager/FileManager.ts b/lib/FileManager/FileManager.ts index 1f2e4123..329a32d0 100644 --- a/lib/FileManager/FileManager.ts +++ b/lib/FileManager/FileManager.ts @@ -264,11 +264,12 @@ export class FileManager { const { colName, tableName } = args; const tableConfig = this.prostgles?.opts.fileTable?.referencedTables?.[tableName]; const isReferencingFileTable = this.dbo[tableName]?.columns?.some(c => c.name === colName && c.references && c.references?.some(({ ftable }) => ftable === this.tableName )); + const allowAllFiles = { acceptedContent: "*" } as const; if(isReferencingFileTable){ if(tableConfig && typeof tableConfig !== "string"){ - return tableConfig.referenceColumns[colName]; + return tableConfig.referenceColumns[colName] ?? allowAllFiles; } - return { acceptedContent: "*" }; + return allowAllFiles; } return undefined; } diff --git a/package-lock.json b/package-lock.json index 61f50fd3..89ef17b6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "prostgles-server", - "version": "4.2.19", + "version": "4.2.20", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "prostgles-server", - "version": "4.2.19", + "version": "4.2.20", "license": "MIT", "dependencies": { "@types/express": "^4.17.13", diff --git a/package.json b/package.json index ac927949..f8eb948d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "prostgles-server", - "version": "4.2.19", + "version": "4.2.20", "description": "", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/tests/server/package-lock.json b/tests/server/package-lock.json index 84c46930..e0b4626b 100644 --- a/tests/server/package-lock.json +++ b/tests/server/package-lock.json @@ -21,7 +21,7 @@ }, "../..": { "name": "prostgles-server", - "version": "4.2.19", + "version": "4.2.20", "license": "MIT", "dependencies": { "@types/express": "^4.17.13",