rubendelblanco / openrpg

Rolemaster manager
5 stars 3 forks source link

fix: cannot update campaign if I repeat the title #76

Closed danirod closed 4 years ago

danirod commented 4 years ago

When updating a campaign, I found that if the payload send as PUT includes an unmodified copy of the title, it will be marked as a validation error because there already exist a same record in the database with this title; which is the expected behaviour because it is the same record.

To be clear, if I create a campaign:

POST /api/campaigns => { title: "My title", description: "Desc" }
Location: /api/campaigns/1

And then update it this way:

PUT /api/campaigns/1 => { title: "My title", description: "New" }

It should not fail because I submit the same title in the payload due to "a campaign called 'My title' already exists", because of course it does.

sonirico commented 4 years ago

/lgtm