12345678910111213141516171819202122232425 |
- from flask import jsonify
- from flask.views import View
- from pycs.database.Project import Project
- from pycs.interfaces.MediaStorage import MediaStorage
- class GetProjectResults(View):
- """
- get a list of all files and annotations for a project
- """
- # pylint: disable=arguments-differ
- methods = ['GET']
- def dispatch_request(self, project_id: int):
- # get project from database
- project = Project.get_or_404(project_id)
- # map media files to a dict
- storage = MediaStorage(project.id, None)
- files = list(map(lambda f: f.serialize(), storage.files().iter()))
- # return result
- return jsonify(files)
|