do the joinedload so we actually eliminate the n plus 1 query

This commit is contained in:
burnettk 2023-10-05 09:30:02 -04:00
parent e99ebd5424
commit d4984a0269
2 changed files with 2 additions and 5 deletions

View File

@ -72,6 +72,3 @@
.pf-c-login__main-footer-links.kc-social-links {
display: block;
}

View File

@ -12,8 +12,8 @@ from flask.wrappers import Response
from spiffworkflow_backend.exceptions.api_error import ApiError
from spiffworkflow_backend.exceptions.process_entity_not_found_error import ProcessEntityNotFoundError
from spiffworkflow_backend.models.db import db
from spiffworkflow_backend.models.permission_assignment import PermissionAssignmentModel
from spiffworkflow_backend.models.permission_target import PermissionTargetModel
from spiffworkflow_backend.models.principal import PrincipalModel
from spiffworkflow_backend.models.process_instance import ProcessInstanceModel
from spiffworkflow_backend.models.process_instance_file_data import ProcessInstanceFileDataModel
@ -49,7 +49,7 @@ def permissions_check(body: dict[str, dict[str, list[str]]]) -> flask.wrappers.R
permission_assignments = (
PermissionAssignmentModel.query.filter(PermissionAssignmentModel.principal_id.in_(principal_ids))
.join(PermissionTargetModel)
.options(db.joinedload(PermissionAssignmentModel.permission_target))
.all()
)