Pass request as param to getIdsFromRequest not working

Hi team,

I take an example from here:

return new RecordsGetter(accounts).getIdsFromRequest(request)
        .then((ids) => {
            console.log(ids);
        })
        .catch(next);

And I could see this issue in the editor and on terminal:

What is the easiest way to use getIdsFromRequest or similar?

Hi :wave: @Bojan_Antonijevic, thank you for your feedback.
It seem to have bad type definition on our end.
Can you put this instruction // tslint:disable-next-line before the call of the function please :pray:.
We apologize for this inconvenient.
I transferred the problem to our development team.
I will you keep update when the issue was solved.
Thank you.

Hey @Arnaud_Moncel, thank you for your reply.

// tslint:disable-next-line - this one is not working but I could ignore the warning with
// @ts-ignore

And after that, we have the next issue in the terminal

Could you consult with the dev team and check is it actually possible to get ids from the request?

Which routes did you try to override ?
I try on my end and it’s work properly for the Delete a list of records route.

I am trying to Get a list of records route.

Is this means it’s possible only for Deleting?

Yes unfortunately, it’s only available for Delete a list of records route.

Thanks for the information

Why are you trying to use this function :thinking: ?

We need a list of ids to send on our API endpoint to reformat some fields.
A workflow should be:

  1. Get ids
  2. Send it via superagent on the endpoint and get proper responses for some fields.
  3. Replace field values on forest admin records and send them as a response.

We manage it like this:

const recordsGetter = new RecordsGetter(accounts);
const accounts = recordsGetter.getAll(request.query);
let ids = [];
for (let i = accounts.length - 1; i >= 0; i--) {
     ids.push(accounts[i].dataValues.id)
}

But when we see getIdsFromRequest we were wondering could we replace it with only one line.

Hello @Bojan_Antonijevic :wave:

Just a side note on this, a new version of the types have been released :tada:

You can install the latest version of the package @types/forest-express-sequelize to @latest and remove the typescript deactivation.

Tell me if it fixes the issue :raised_hands:

Do you still encounter the issue you explained at the end of the thread ?

Juste a little note on the getIdsFromRequest, it is only usable on the /delete route (to support mass deletion) and the smart-action routes. It will not work on other routes.

Thanks for your feedback :smile: on types, don’t hesitate if you encounter any other issue.

Steve.