Raha-Project/raha-xray

using name instead of id to modify a client

Closed this issue · 4 comments

Currently, our /api/clients endpoint allows modification requests using a client's ID. While this approach is functional, it can be enhanced for better readability and user-friendliness, especially for administrators. This issue proposes transitioning to using the client's name for sending modification requests.

Based on best practices, it is not a good way to use a changable paramether for sending modifiaction request.
Instead, it is better to have find method to retrive an object (which containsid), then request for change with id.

For sure, the terms readablity and user-friendly is not applicable for backend services.
With this start-up which has separated objects, I assumed that each object suposed to have id everywhere.

If developers need to bind new object like sub/telegram/etc, in their frontends, it should be binded to client.id instead of name.

Thanks for your explanation.

You mean first should get all clients and then find id by name?

Yes.
Ideally, it would be nice to have another function for searching based on some parameters and return id or complete tuple. But not editing!
This feature is always a kind of well-known conflicts between operations and developers.
But basic rules of software engineering such as "Normalizing" and security, prevent creation of these functions due to possible problems.

Thank you for your input, alireza.
You bring up a valid point about the potential conflicts between operations and developers when it comes to designing functions for searching and editing data