Problem :
Entity id decorated @PrimaryGeneratedColumn() is overwritable on put request.
Expected behaviour :
The id decorated with @PrimaryGeneratedColumn() shall not update.
Steps to reproduce :
- Create an entry with this post request :
curl --location --request POST 'https://q6zre.sse.codesandbox.io/tests' \
--header 'Content-Type: application/json' \
--data-raw '{"name": "acme"}'
- Copy the
idfrom the response, add it in the put request url, and add a randomwishedIdin the body :
curl --location --request PUT 'https://q6zre.sse.codesandbox.io/tests/{id}' \
--header 'Content-Type: application/json' \
--data-raw '{"id": "{wishedId}"}'
The entry is updated with the wishedId.
Working example : https://codesandbox.io/s/github/desirelabs/nest-typeorm
Is there any way to prevent this ? Thanks