Open zorun opened 1 year ago
The logging preference is set to 1 by default when creating a project:
$ curl -X POST http://localhost:5000/api/projects -d 'name=machin&id=machin&password=yay&contact_email=yay@example.com' "machine" $ curl -u 'machin:yay' http://localhost:5000/api/projects/machin { "id": "machin", "name": "machin", "contact_email": "yay@example.com", "logging_preference": 1, "members": [], "default_currency": "XXX" }
However, if you update the project with PUT and don't specify this field, it gets reset to 0:
$ curl -X PUT -u 'machin:yay' http://localhost:5000/api/projects/machin -d 'name=machinchose&id=machin¤t_password=yay&contact_email=yay@example.com' "UPDATED" $ curl -u 'machin:yay' http://localhost:5000/api/projects/machin { "id": "machin", "name": "machinchose", "contact_email": "yay@example.com", "logging_preference": 0, "members": [], "default_currency": "XXX" }
Same thing for the default_currency: if you don't specify it in a PUT, it gets reset to XXX.
XXX
Since older API clients won't know about new optional fields, we should not reset these fields when they are not specified.
I tried to solve this issue by editing the put function in the ProjectHandler Class.
The logging preference is set to 1 by default when creating a project:
However, if you update the project with PUT and don't specify this field, it gets reset to 0:
Same thing for the default_currency: if you don't specify it in a PUT, it gets reset to
XXX
.Since older API clients won't know about new optional fields, we should not reset these fields when they are not specified.