sanjar-notes / web_dev_fundamentals

The basics - HTML, CSS, Javascript and more
https://sanjar-notes.github.io/web_dev_fundamentals/
3 stars 0 forks source link

Serializer vs mutation keys expectation, sync issue #109

Open sanjarcode opened 8 months ago

sanjarcode commented 8 months ago

Supose I call a "user contacts" API in my app, the BE sends this. The keys here we decided by the frontend person for ease in frontend code.

{ id: 59, name: "John Doe", email: "abcdefgmail.com", phone: null }

but it expects the following for a PUT/POST. It expects this because it uses the keys (below) internally in BE

{ id: 59, name: "John Doe", email_address: "abcdefgmail.com", phone_number: null }

problem

Now whotf is going to manage this synching? This is bad design, and it's not complex bad either.

fix

whats the fix here?