From d4984a0269db06eb959352d41b2faa92825acde3 Mon Sep 17 00:00:00 2001 From: burnettk Date: Thu, 5 Oct 2023 09:30:02 -0400 Subject: [PATCH] do the joinedload so we actually eliminate the n plus 1 query --- .../keycloak/spifftheme/login/resources/css/styles.css | 3 --- .../src/spiffworkflow_backend/routes/process_api_blueprint.py | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/spiffworkflow-backend/keycloak/spifftheme/login/resources/css/styles.css b/spiffworkflow-backend/keycloak/spifftheme/login/resources/css/styles.css index 368628c7d..0a0d38b15 100644 --- a/spiffworkflow-backend/keycloak/spifftheme/login/resources/css/styles.css +++ b/spiffworkflow-backend/keycloak/spifftheme/login/resources/css/styles.css @@ -72,6 +72,3 @@ .pf-c-login__main-footer-links.kc-social-links { display: block; } - - - diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py index 9c5473eb0..1409903c8 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py @@ -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() )