Browse Source

fix: fetch columns if required

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/6521/head
mertmit 1 year ago
parent
commit
2f86c2f5e7
  1. 13
      packages/nocodb/src/db/BaseModelSqlv2.ts

13
packages/nocodb/src/db/BaseModelSqlv2.ts

@ -4000,7 +4000,7 @@ class BaseModelSqlv2 {
: await this.dbDriver.raw(query); : await this.dbDriver.raw(query);
// update attachment fields // update attachment fields
data = this.convertAttachmentType(data, childTable); data = await this.convertAttachmentType(data, childTable);
// update date time fields // update date time fields
data = this.convertDateFormat(data, childTable); data = this.convertDateFormat(data, childTable);
@ -4024,7 +4024,16 @@ class BaseModelSqlv2 {
return d; return d;
} }
public convertAttachmentType(data: Record<string, any>, childTable?: Model) { public async convertAttachmentType(
data: Record<string, any>,
childTable?: Model,
) {
if (childTable && !childTable?.columns) {
await childTable.getColumns();
} else if (!this.model?.columns) {
await this.model.getColumns();
}
// attachment is stored in text and parse in UI // attachment is stored in text and parse in UI
// convertAttachmentType is used to convert the response in string to array of object in API response // convertAttachmentType is used to convert the response in string to array of object in API response
if (data) { if (data) {

Loading…
Cancel
Save