from flask import jsonify
from flask.views import View

from pycs.database.File import File


class GetResults(View):
    """
    returns a list of a files results
    """
    # pylint: disable=arguments-differ
    methods = ['GET']


    def dispatch_request(self, file_id: int):
        # get file from database
        file = File.get_or_404(file_id)

        # return result
        return jsonify(file.results.all())
