Skip to content

Commit d0ade73

Browse files
committed
fix: add support of the decimal data type
1 parent c053719 commit d0ade73

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,7 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
803803
}
804804
}
805805
const primaryKeyColumn = this.resourceConfig.columns.find((col) => col.primaryKey);
806+
const decimalFieldsArray = this.resourceConfig.columns.filter(c => c.type === 'decimal').map(c => c.name);
806807
const updates = selectedIds.map(async (ID, idx) => {
807808
const oldRecord = await this.adminforth.resource(this.resourceConfig.resourceId).get( [Filters.EQ(primaryKeyColumn.name, ID)] );
808809
for (const [key, value] of Object.entries(outputImageFields)) {
@@ -837,6 +838,15 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
837838
}
838839
}
839840
}
841+
842+
// Convert decimal fields to numbers
843+
if (decimalFieldsArray.length > 0) {
844+
for (const fieldName of decimalFieldsArray) {
845+
if (fieldsToUpdate[idx].hasOwnProperty(fieldName)) {
846+
fieldsToUpdate[idx][fieldName] = `${fieldsToUpdate[idx][fieldName]}`;
847+
}
848+
}
849+
}
840850
const newRecord = {
841851
...oldRecord,
842852
...fieldsToUpdate[idx]

0 commit comments

Comments
 (0)