✨(backend) add document path and depth to accesses endpoint
The frontend requires this information about the ancestor document to which each access is related. We make sure it does not generate more db queries and does not fetch useless and heavy fields from the document like "excerpt".
This commit is contained in:
committed by
Anthony LC
parent
433cead0ac
commit
50faf766c8
@@ -1530,11 +1530,7 @@ class DocumentAccessViewSet(
|
||||
if role not in choices.PRIVILEGED_ROLES:
|
||||
queryset = queryset.filter(role__in=choices.PRIVILEGED_ROLES)
|
||||
|
||||
accesses = list(
|
||||
queryset.annotate(document_path=db.F("document__path")).order_by(
|
||||
"document_path"
|
||||
)
|
||||
)
|
||||
accesses = list(queryset.order_by("document__path"))
|
||||
|
||||
# Annotate more information on roles
|
||||
path_to_key_to_max_ancestors_role = defaultdict(
|
||||
|
||||
Reference in New Issue
Block a user