nestjsx / crud

NestJs CRUD for RESTful APIs
https://github.com/nestjsx/crud/wiki
MIT License
4.04k stars 534 forks source link

How to set an alias for column name? #640

Open aditibarbhai opened 3 years ago

aditibarbhai commented 3 years ago

I am using @nestjsx/crud-typeorm to create a CRUD REST API for react-admin. One of the requirements of react-admin is that every item in the response needs to have an id field. The database that I am working with uses item_id as the ID field instead.

How do I create an alias in my CRUD responses such as the item_id field is returned as id.

The SQL equivalent would be: SELECT item_id as id from TableName