Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging preference is reset when using PUT API requests #1205

Open
zorun opened this issue Jul 29, 2023 · 1 comment
Open

Logging preference is reset when using PUT API requests #1205

zorun opened this issue Jul 29, 2023 · 1 comment
Labels

Comments

@zorun
Copy link
Collaborator

zorun commented Jul 29, 2023

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&[email protected]'
"machine"
$ curl -u 'machin:yay' http://localhost:5000/api/projects/machin
{
    "id": "machin",
    "name": "machin",
    "contact_email": "[email protected]",
    "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&current_password=yay&[email protected]'
"UPDATED"
$ curl -u 'machin:yay' http://localhost:5000/api/projects/machin
{
    "id": "machin",
    "name": "machinchose",
    "contact_email": "[email protected]",
    "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.

Since older API clients won't know about new optional fields, we should not reset these fields when they are not specified.

@ccczzz12345
Copy link

I tried to solve this issue by editing the put function in the ProjectHandler Class.
Screenshot 2023-12-05 at 11 40 53 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants