mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-29 23:41:28 +00:00
28 lines
765 B
Python
28 lines
765 B
Python
|
"""Manipulate jobs"""
|
||
|
# pylint: disable=too-few-public-methods
|
||
|
import strawberry
|
||
|
|
||
|
from selfprivacy_api.graphql.mutations.mutation_interface import GenericMutationReturn
|
||
|
from selfprivacy_api.jobs import Jobs
|
||
|
|
||
|
|
||
|
@strawberry.type
|
||
|
class JobMutations:
|
||
|
"""Mutations related to jobs"""
|
||
|
|
||
|
@strawberry.mutation
|
||
|
def remove_job(self, job_id: str) -> GenericMutationReturn:
|
||
|
"""Remove a job from the queue"""
|
||
|
result = Jobs().remove_by_uuid(job_id)
|
||
|
if result:
|
||
|
return GenericMutationReturn(
|
||
|
success=True,
|
||
|
code=200,
|
||
|
message="Job removed",
|
||
|
)
|
||
|
return GenericMutationReturn(
|
||
|
success=False,
|
||
|
code=404,
|
||
|
message="Job not found",
|
||
|
)
|