Closed pbrozi closed 2 years ago
@pbrozi Looks good but for user edit we should use PUT
or PATCH
instead of POST
and please make sure that all gardens, permissions, etc. are deleted when we delete the company or a garden. 👍🏼
@pbrozi Can we move ../widgets
to /user/widgets
? It makes more sense for a user to have their own widgets.
Okay. I initially thought that the user can save the settings for each garden. Should this still be possible?
We should kept that in mind for the future but for now i think it's enough to have only user dependent widgets.
@dobro929 @pbrozi could this issue be closed?
I would suggest the following endpoints for user settings:
Method: GET; Path: user Returns all information from the requesting (authenticated) user as JSON.
Example output:
Method: PUT; Path: user Endpoint to edit user information. New values can be submitted by sending JSON with the request body. Allowed keys are: username, password, email, first_name and last_name. At least one key needs to be present. The user needs to be authenticated to access this endpoint.
Example input:
Output: HTTP-200 if changes were successful or HTTP-400 if not.
Method: GET; Path: companies/{company_id}/gardens/{garden_id}/widgets Returns settings for saved widgets as JSON.
Method: POST; Path: companies/{company_id}/gardens/{garden_id}/widgets Any JSON content can be send to the backend and will be saved in the database. It can be retrieved using a GET request.
Method: DELETE; Path: companies/{company_id}/gardens/{garden_id} Deletes the garden specified in the URL, if it exists and the requesting user has admin permissions on it.
Method: DELETE; Path: companies/{company_id} Deletes the company specified in the URL, if it exists and the requesting user has admin permissions on it.
The functionality to add users to a company or garden is provided by the permission system. Endpoints createPermission and removePermission exist for companies and gardens.
@dobro929 please tell me if this matches your requirements.