Add endpoint to rename a project#124
Conversation
Task: https://github.com/MerginMaps/MerginMaps-Cloud-TEST/issues/1 URL: PATCH /v2/projects/<project_id> Body: { "name": "new_project_name" } - check the user have permission to update the project - check the new name uses allowed characters - check if a project with the new name already exists
| 400, | ||
| ) | ||
| new_name_exists = Project.query.filter_by( | ||
| workspace_id=project.workspace_id, name=new_name |
There was a problem hiding this comment.
@luxusko I think we should filter by name=new_name.strip(), right?
because if there is a trailing space in new_name, it is not catched by is_name_allowed and here we should check the name which we want to write to db (there could be already a different project without the whitespace)
I didn't notice you moved the .strip() to the end.
There was a problem hiding this comment.
yes, I did remove it and left it by mistake in the final update of project.name. Why should there be undocumented processing of the string - client sends you string X but we save and use different string Y without any notification. Confusing source of errors. Let validation method be fully responsible passed names. We can't have silent requirements hidden over the code base.
Let me create quick fix PR to remove this forgotten strip() and propose name regex update.
Task: https://github.com/MerginMaps/server-private/issues/2003
URL: PATCH /v2/projects/<project_id>
Body:
{ "name": "new_project_name"}