mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-15 01:05:42 +00:00
19 lines
479 B
Python
19 lines
479 B
Python
from flask_restx import Namespace, Resource
|
|
from .auth import token_auth
|
|
from ..models import Job
|
|
|
|
|
|
ns = Namespace('jobs', description='Job operations')
|
|
|
|
|
|
@ns.route('/')
|
|
class JobList(Resource):
|
|
'''Shows a list of all jobs, and lets you POST to add new job'''
|
|
|
|
@ns.doc(security='apiKey')
|
|
@token_auth.login_required
|
|
def get(self):
|
|
'''List all jobs'''
|
|
jobs = Job.query.all()
|
|
return [job.to_dict(include_relationships=False) for job in jobs]
|