Skip to content

Commit

Permalink
HJ-97 - Missing QA from HJ-97 (#5559)
Browse files Browse the repository at this point in the history
Co-authored-by: Adam Sachs <[email protected]>
  • Loading branch information
andres-torres-marroquin and adamsachs committed Dec 5, 2024
1 parent 62a7067 commit cd95a92
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions src/fides/api/api/v1/endpoints/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@

from fides.api.api import deps
from fides.api.api.v1.endpoints.saas_config_endpoints import instantiate_connection
from fides.api.db.crud import get_resource, get_resource_with_custom_fields
from fides.api.db.crud import (
get_resource,
get_resource_with_custom_fields,
list_resource,
)
from fides.api.db.ctl_session import get_async_db
from fides.api.db.system import (
create_system,
Expand Down Expand Up @@ -396,6 +400,20 @@ async def ls( # pylint: disable=invalid-name
Otherwise all Systems will be returned (this may be a slow operation if there are many systems,
so using the pagination parameters is recommended).
"""
if not (
size
or page
or search
or data_uses
or data_categories
or data_subjects
or dnd_relevant
or show_hidden
):
# if no advanced parameters are passed, we return a very basic list of all System resources
# to maintain backward compatibility of the original API, which backs some important client usages, e.g. the fides CLI

return await list_resource(System, db)

Check warning on line 416 in src/fides/api/api/v1/endpoints/system.py

View check run for this annotation

Codecov / codecov/patch

src/fides/api/api/v1/endpoints/system.py#L416

Added line #L416 was not covered by tests

query = select(System)

Expand Down Expand Up @@ -447,19 +465,6 @@ async def ls( # pylint: disable=invalid-name
# Add a distinct so we only get one row per system
duplicates_removed = filtered_query.distinct(System.id)

if not (
size
or page
or search
or data_uses
or data_categories
or data_subjects
or dnd_relevant
or show_hidden
):
result = await db.execute(duplicates_removed)
return result.scalars().all()

return await async_paginate(db, duplicates_removed, pagination_params)


Expand Down

0 comments on commit cd95a92

Please sign in to comment.