diff options
| author | jc0b <j@jc0b.computer> | 2020-08-03 16:41:23 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2020-08-24 19:48:49 +0200 |
| commit | c5f7d4c20a12d226fdae3cd6806b67c967bc3277 (patch) | |
| tree | 33bab9f95ec4cb8bdf9228a5bf30161fcdae147d /api/opendc | |
| parent | 78ac5e7254cf1549ec2bd75637c2301d98002063 (diff) | |
Removed query_all in prefabs/authorizations in favour of a direct fetch_all on DB
Diffstat (limited to 'api/opendc')
| -rw-r--r-- | api/opendc/api/v2/prefabs/authorizations/endpoint.py | 8 | ||||
| -rw-r--r-- | api/opendc/models/prefab.py | 9 |
2 files changed, 5 insertions, 12 deletions
diff --git a/api/opendc/api/v2/prefabs/authorizations/endpoint.py b/api/opendc/api/v2/prefabs/authorizations/endpoint.py index a6c1aead..b487b9cc 100644 --- a/api/opendc/api/v2/prefabs/authorizations/endpoint.py +++ b/api/opendc/api/v2/prefabs/authorizations/endpoint.py @@ -1,4 +1,5 @@ -from opendc.models.prefab import query_all +from opendc.models.prefab import Prefab +from opendc.util.database import DB from opendc.models.user import User from opendc.util.rest import Response @@ -10,8 +11,9 @@ def GET(request): user.check_exists() - own_prefabs = query_all({'authorId' : user.get_id()}) - public_prefabs = query_all({'visibility' : 'public'}) + + own_prefabs = DB.fetch_all({'authorId' : user.get_id()}, Prefab.collection_name) + public_prefabs = DB.fetch_all({'visibility' : 'public'}, Prefab.collection_name) authorizations = {"authorizations": []} diff --git a/api/opendc/models/prefab.py b/api/opendc/models/prefab.py index e1671dc1..edf1d4c4 100644 --- a/api/opendc/models/prefab.py +++ b/api/opendc/models/prefab.py @@ -1,6 +1,5 @@ from opendc.models.model import Model from opendc.models.user import User -from opendc.util.database import DB from opendc.util.exceptions import ClientError from opendc.util.rest import Response @@ -27,11 +26,3 @@ class Prefab(Model): #except KeyError: # OpenDC-authored objects don't necessarily have an authorId # return - - -def query_all(query): - """Returns a list of all prefabs matching the query. - - :param query: the query to execute on the db. - """ - return DB.fetch_all(query, Prefab.collection_name) |
