New method for file datastore api endpoint
This commit is contained in:
parent
e9fe555e05
commit
1ed144536f
|
@ -5,7 +5,7 @@ from crc import session
|
||||||
from crc.api.common import ApiError
|
from crc.api.common import ApiError
|
||||||
from crc.models.data_store import DataStoreModel, DataStoreSchema
|
from crc.models.data_store import DataStoreModel, DataStoreSchema
|
||||||
from crc.scripts.data_store_base import DataStoreBase
|
from crc.scripts.data_store_base import DataStoreBase
|
||||||
|
from crc.models.file import FileModel
|
||||||
|
|
||||||
def study_multi_get(study_id):
|
def study_multi_get(study_id):
|
||||||
"""Get all data_store values for a given study_id study"""
|
"""Get all data_store values for a given study_id study"""
|
||||||
|
@ -30,6 +30,16 @@ def user_multi_get(user_id):
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
||||||
|
def file_multi_get(file_id):
|
||||||
|
"""Get all data values in the data store for a file_id"""
|
||||||
|
if file_id is None:
|
||||||
|
raise ApiError(code='unknown_file', message='Please provide a valid file id.')
|
||||||
|
dsb = DataStoreBase()
|
||||||
|
retval = dsb.get_multi_common(None, None, file_id=file_id)
|
||||||
|
results = DataStoreSchema(many=True).dump(retval)
|
||||||
|
return results
|
||||||
|
|
||||||
|
|
||||||
def datastore_del(id):
|
def datastore_del(id):
|
||||||
"""Delete a data store item for a key"""
|
"""Delete a data store item for a key"""
|
||||||
session.query(DataStoreModel).filter_by(id=id).delete()
|
session.query(DataStoreModel).filter_by(id=id).delete()
|
||||||
|
|
Loading…
Reference in New Issue