Here is the flow:
- User#1 hits a Get endpoint to retrieve a DTO object (let’s call this object “Company”)
- User#1 updates the address information in the Company object.
- While User# 1 was editing the address information, a different user (User #2) was changing the telephone number and saved this information before User#1 saved his information.
- User #1 DTO object still contains the old telephone number.
The problem: when user 1 submits his changes, comparing Dto values to database values gives impression to update the telephone in User 1 object.
So here is a real world scenario. If I simply compare the current database fields when saving User #1 object, it could give the impression that User#1 telephone Was changed and needs to be saved to the database, but really it’s the old telephone number.
So how does this problem get solved? Does the PUT endpoint need two parameters, the original DTO and changed DTO? I can’t compare DTO to Entity objects due to changes made possibly someone else.
Aucun commentaire:
Enregistrer un commentaire