I would like to explain my problem of the day.
I am currently making a request on postman (which works correctly)
My back
getPackIntegrations: {
rest: "GET /:id/integrations",
resource: {
name: "/packs/${id}",
scope: "webmessenger-integrations:get",
},
cache: false,
handler: async function (ctx) {
const res = await ctx.call("packs.get", {
id: ctx.params.id,
fields: "integrations",
query: {
...ctx.params.query,
},
});
return res;
},
},
postman's response
integrations : [{integration : xxx, entity : aaa}, {integration : yyy, entity : aaa},
{integration : zzz, entity : aaa}, {integration : 111, entity : bbb}, {integration : 222, entity : bbb}]
and I would rather receive the following format
[{entity: aaa, integrations : [xxx, yyy, zzz]}, {entity:bbb, integrations: [111,222]}]
How can I fix this issue?
thx for help