selfprivacy-rest-api/selfprivacy_api/graphql/queries/jobs.py

26 lines
589 B
Python
Raw Normal View History

2022-08-12 21:29:18 +00:00
"""Jobs status"""
# pylint: disable=too-few-public-methods
import typing
import strawberry
2022-08-17 20:58:56 +00:00
from selfprivacy_api.graphql.common_types.jobs import (
ApiJob,
get_api_job_by_id,
job_to_api_job,
)
2022-08-12 21:29:18 +00:00
from selfprivacy_api.jobs import Jobs
@strawberry.type
class Job:
@strawberry.field
def get_jobs(self) -> typing.List[ApiJob]:
Jobs.get_instance().get_jobs()
2022-08-17 20:58:56 +00:00
return [job_to_api_job(job) for job in Jobs.get_instance().get_jobs()]
@strawberry.field
def get_job(self, job_id: str) -> typing.Optional[ApiJob]:
return get_api_job_by_id(job_id)