mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-15 01:05:42 +00:00
26 lines
740 B
Python
26 lines
740 B
Python
from .models import Corpus, Job, User
|
|
|
|
|
|
def delete_corpus_(app, corpus_id):
|
|
with app.app_context():
|
|
corpus = Corpus.query.filter_by(id=corpus_id).first()
|
|
if corpus is None:
|
|
raise Exception('Corpus {} not found!'.format(corpus_id))
|
|
corpus.delete()
|
|
|
|
|
|
def delete_job_(app, job_id):
|
|
with app.app_context():
|
|
job = Job.query.filter_by(id=job_id).first()
|
|
if job is None:
|
|
raise Exception('Job {} not found!'.format(job_id))
|
|
job.delete()
|
|
|
|
|
|
def delete_user_(app, user_id):
|
|
with app.app_context():
|
|
user = User.query.filter_by(id=user_id).first()
|
|
if user is None:
|
|
raise Exception('User {} not found!'.format(user_id))
|
|
user.delete()
|