I would like to change my output on knex query. I have this output:
{
restaurant_uuid: '123',
name: 'Sea Bar',
country_code: 'FR',
locales: [ 'fr_FR' ]
}
I need to change it to:
{
restaurant_uuid: '123',
name: 'Sea Bar',
country: {
code: '123',
locales: ['fr_FR']
}
}
Could I do it on query? I know I do it at the end of flow on output with a "foreach" on array, but I would like to do it in a good way.