Return project/area name and project_uuid/area_uuid
Closed this issue · 3 comments
Goal
- As a KanbanView developer
- I want to receive both project/area and their uuid
- so that I can reuse most of the old code when using things.py
Suggested approach
In order to achieve this goal I suggest to return "project": "test project", "project_uuid": "Uaxh5ytCho8CSTNsUCxtAv"
instead of "project": "Uaxh5ytCho8CSTNsUCxtAv"
Additional context
Some other approaches:
- Return
{
…
"project": {"uuid": "…", "title" "…"}
…
}
-
Setting
include_items
totrue
. -
Use
things.projects()
andthings.areas()
to create adict
that maps ids to names. You can reuse that dict for every request. That way you can easily lookup any area/project ID if needed.
The trade offs here involve lookup time and cleanliness of API.
Returning such a dict be a cleaner approach. Always enabling include_items
or always run a second query seems to be a bit too much (I think getting the context of a to-do in terms of a title is often needed anyways).
@AlexanderWillner To clarify, you wouldn't always run that second query (things.projects(), things.areas()). Rather, it's something you do once and then store in memory as a Python dict for all subsequent requests.