Skip to content

Commit 5365ffe

Browse files
committed
chore: improve get_records API
1 parent 3fa094c commit 5365ffe

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,9 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
312312
handler: async ( body ) => {
313313
let records = [];
314314
const primaryKeyColumn = this.resourceConfig.columns.find((col) => col.primaryKey);
315-
for( const record of body.body.record ) {
316-
records.push(await this.adminforth.resource(this.resourceConfig.resourceId).get( [Filters.EQ(primaryKeyColumn.name, record)] ));
317-
records[records.length - 1]._label = this.resourceConfig.recordLabel(records[records.length - 1]);
315+
records = await this.adminforth.resource(this.resourceConfig.resourceId).list([Filters.IN(primaryKeyColumn.name, body.body.record)]);
316+
for( const [index, record] of records.entries() ) {
317+
records[index]._label = this.resourceConfig.recordLabel(records[index]);
318318
}
319319
return {
320320
records,

0 commit comments

Comments
 (0)