Skip to content

Commit fb604d7

Browse files
authored
Merge pull request #18 from bugout-dev/fix-resources-list
GET /resources should not 404 if no resources
2 parents 3f43b75 + 6e38acf commit fb604d7

2 files changed

Lines changed: 2 additions & 8 deletions

File tree

brood/resources/actions.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def get_list_of_resources(
137137
application_id: Optional[str] = None,
138138
) -> List[models.Resource]:
139139
"""
140-
Return list of available resource to user.
140+
Return list of available resource to user.
141141
"""
142142
query = (
143143
db_session.query(models.Resource)
@@ -158,10 +158,6 @@ def get_list_of_resources(
158158
query = query.filter(models.Resource.resource_data[key].astext == value)
159159

160160
resources = query.all()
161-
if len(resources) == 0:
162-
raise exceptions.ResourceNotFound(
163-
f"Did not found resources for user with id: {user_id}"
164-
)
165161

166162
return resources
167163

brood/resources/api.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ async def create_resource_handler(
105105
Create the resource.
106106
Current user will inherit all permissions to the resource.
107107
108-
- **data** (dict):
108+
- **data** (dict):
109109
- **application_id** (uuid)
110110
- **resource_data** (dict)
111111
"""
@@ -150,8 +150,6 @@ async def get_resources_list_handler(
150150
resources = actions.get_list_of_resources(
151151
db_session, current_user.id, user_groups_ids, params, application_id
152152
)
153-
except exceptions.ResourceNotFound:
154-
raise HTTPException(status_code=404, detail="Resources not found")
155153
except Exception as err:
156154
logger.error(f"Unhandled error in get_resources_list_handler: {str(err)}")
157155
raise HTTPException(status_code=500)

0 commit comments

Comments
 (0)