I have went through 2 examples of using Lagom to develop Micro-Service Architecture system, namely the 'chirp' and 'cargotracker', but none of them show how to update to existing entity.
For instance, having following entity with REST URI
Sugguestion{ id content viewCount author }
api/suggestion with Http Post ----> add a new suggestion
api/suggestion/:id with Http Get, ---->read a suggestion
api/suggestion/:id with Http Delete, ---->remove a suggestion
How about update ?
1)api/suggestion/viewCount with Http Put?
2)api/suggestion/:id with Http Put ?
3)api/suggestion/:id with Http Post ?
There are some disadvantages of the above 3 approch
for 1), need to define a seperately data class for each fields, otherwise, update directly on the Suggestion entity would introduce 'mutable changes', which is aginst the principle of Lagom.
for 2)&3), need a deep copy of the old state and update with changed fields, otherwise, introduces 'mutable changes' as well.
Is there any other options ?
Thanks