How should we structure resources to ensure a given allowed-method can be safely executed? For example, if our API was to provide for the creation of a new user in some database by means of a :put! function, but before beginning the transaction, we want to ensure that the given user does not already exist, is there a Liberator decision point we could use to check against the database to ensure the precondition and then return an appropriate response should the precondition fail? Or should that be handled as an exception on the database end of the code called by the :put! function?
Sorry, I mean to say the `exists?` condition, not the `existed?` condition.
On Thursday, July 2, 2015 at 11:29:18 AM UTC-5, Aleksander Eskilson wrote:Hi Philipp,Thanks, that sounds reasonable. Could you describe then any use cases for the `existed?` condition? `conflict?` sounds like a great way to check general preconditions. In the case where some object already resides in something like a database, and we don't want to insert duplicates, is that something the `existed?` condition was included to allow us to check?