|
|
@ -9271,6 +9271,7 @@ class BaseModelSqlv2 { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (column.uidt === UITypes.Attachment) { |
|
|
|
if (column.uidt === UITypes.Attachment) { |
|
|
|
|
|
|
|
if (column.column_name in data) { |
|
|
|
if (data && data[column.column_name]) { |
|
|
|
if (data && data[column.column_name]) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
if (typeof data[column.column_name] === 'string') { |
|
|
|
if (typeof data[column.column_name] === 'string') { |
|
|
@ -9301,7 +9302,9 @@ class BaseModelSqlv2 { |
|
|
|
oldData && |
|
|
|
oldData && |
|
|
|
oldData[column.column_name] && |
|
|
|
oldData[column.column_name] && |
|
|
|
Array.isArray(oldData[column.column_name]) |
|
|
|
Array.isArray(oldData[column.column_name]) |
|
|
|
? oldData[column.column_name].filter((att) => att.id).map((att) => [att.id, att]) |
|
|
|
? oldData[column.column_name] |
|
|
|
|
|
|
|
.filter((att) => att.id) |
|
|
|
|
|
|
|
.map((att) => [att.id, att]) |
|
|
|
: [], |
|
|
|
: [], |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
@ -9309,8 +9312,11 @@ class BaseModelSqlv2 { |
|
|
|
string, |
|
|
|
string, |
|
|
|
{ url?: string; path?: string } |
|
|
|
{ url?: string; path?: string } |
|
|
|
>( |
|
|
|
>( |
|
|
|
data[column.column_name] && Array.isArray(data[column.column_name]) |
|
|
|
data[column.column_name] && |
|
|
|
? data[column.column_name].filter((att) => att.id).map((att) => [att.id, att]) |
|
|
|
Array.isArray(data[column.column_name]) |
|
|
|
|
|
|
|
? data[column.column_name] |
|
|
|
|
|
|
|
.filter((att) => att.id) |
|
|
|
|
|
|
|
.map((att) => [att.id, att]) |
|
|
|
: [], |
|
|
|
: [], |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
@ -9370,7 +9376,8 @@ class BaseModelSqlv2 { |
|
|
|
sanitizedAttachment.id = await FileReference.insert( |
|
|
|
sanitizedAttachment.id = await FileReference.insert( |
|
|
|
this.context, |
|
|
|
this.context, |
|
|
|
{ |
|
|
|
{ |
|
|
|
file_url: sanitizedAttachment.url ?? sanitizedAttachment.path, |
|
|
|
file_url: |
|
|
|
|
|
|
|
sanitizedAttachment.url ?? sanitizedAttachment.path, |
|
|
|
file_size: sanitizedAttachment.size, |
|
|
|
file_size: sanitizedAttachment.size, |
|
|
|
fk_user_id: cookie?.user?.id, |
|
|
|
fk_user_id: cookie?.user?.id, |
|
|
|
fk_model_id: this.model.id, |
|
|
|
fk_model_id: this.model.id, |
|
|
@ -9386,6 +9393,7 @@ class BaseModelSqlv2 { |
|
|
|
data[column.column_name] = sanitizedAttachments.length |
|
|
|
data[column.column_name] = sanitizedAttachments.length |
|
|
|
? JSON.stringify(sanitizedAttachments) |
|
|
|
? JSON.stringify(sanitizedAttachments) |
|
|
|
: null; |
|
|
|
: null; |
|
|
|
|
|
|
|
} |
|
|
|
} else if ( |
|
|
|
} else if ( |
|
|
|
[UITypes.User, UITypes.CreatedBy, UITypes.LastModifiedBy].includes( |
|
|
|
[UITypes.User, UITypes.CreatedBy, UITypes.LastModifiedBy].includes( |
|
|
|
column.uidt, |
|
|
|
column.uidt, |
|
|
|