File tree Expand file tree Collapse file tree 1 file changed +11
-30
lines changed Expand file tree Collapse file tree 1 file changed +11
-30
lines changed Original file line number Diff line number Diff line change @@ -625,36 +625,17 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
625
625
}
626
626
}
627
627
}
628
- try {
629
- const AuditLogPlugin :any = this . adminforth . getPluginByClassName ( 'AuditLogPlugin' ) ;
630
- if ( AuditLogPlugin ) {
631
-
632
- for ( const [ key , value ] of Object . entries ( oldRecord ) ) {
633
- if ( ! ( key in fieldsToUpdate [ idx ] ) ) {
634
- delete oldRecord [ key ] ;
635
- }
636
- }
637
-
638
- const reorderedOldRecord = Object . keys ( fieldsToUpdate [ idx ] ) . reduce ( ( acc , key ) => {
639
- if ( key in oldRecord ) {
640
- acc [ key ] = oldRecord [ key ] ;
641
- }
642
- return acc ;
643
- } , { } as Record < string , unknown > ) ;
644
-
645
- AuditLogPlugin . logCustomAction ( {
646
- resourceId : this . resourceConfig . resourceId ,
647
- recordId : ID ,
648
- actionId : 'Bulk-ai-flow' ,
649
- oldData : reorderedOldRecord ,
650
- data : fieldsToUpdate [ idx ] ,
651
- user : adminUser ,
652
- headers : headers
653
- } ) ;
654
- }
655
- } catch ( error ) { }
656
-
657
- return this . adminforth . resource ( this . resourceConfig . resourceId ) . update ( ID , fieldsToUpdate [ idx ] )
628
+ const newRecord = {
629
+ ...oldRecord ,
630
+ ...fieldsToUpdate [ idx ]
631
+ } ;
632
+ return this . adminforth . updateResourceRecord ( {
633
+ resource : this . resourceConfig ,
634
+ recordId : ID ,
635
+ oldRecord : oldRecord ,
636
+ record : newRecord ,
637
+ adminUser : adminUser ,
638
+ } )
658
639
} ) ;
659
640
await Promise . all ( updates ) ;
660
641
return { ok : true } ;
You can’t perform that action at this time.
0 commit comments