Skip to content

[server] Simplify update mechanism of access-fields. Fixes #957.

Antoine requested to merge ZeHiro/kresus:update-access-fields into master

This MR aims at simplifying the update of the AccessFields when updating an access.

Several things had to be taken into account :

  • it is necessary to use the .save method, and not .update method, because .update can only update and access, and not the fields attached to it.
  • the ORM does not delete an access_field from the database, if we omit it in the fields property of an access, it tries to set the accessId of the access_field to null, which is not allowed by the DB (this would anyway lead to orphans), so we need to manually delete the appropriate fields.
  • the AccessField entity could be 'cleaned' a bit more (removing all the unused methods), but I chose not to, as I thought it could be useful to keep them, but in the mean time, the code is not used. I have no strong opinion, so tell me which option you prefer :)
  • I changed the client so that we do not transmit a field which has value nullor '' to the server (meaning the field is empty, and is omitted by the user). This could be filtered server side (or both sides). This part is clearly to be discussed.

Merge request reports

Loading