mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-22 12:11:26 +00:00
refactoring(jobs): break out a function returning all jobs
This commit is contained in:
parent
5558577927
commit
fff8a49992
|
@ -11,13 +11,17 @@ from selfprivacy_api.graphql.common_types.jobs import (
|
||||||
from selfprivacy_api.jobs import Jobs
|
from selfprivacy_api.jobs import Jobs
|
||||||
|
|
||||||
|
|
||||||
|
def get_all_jobs() -> typing.List[ApiJob]:
|
||||||
|
Jobs.get_jobs()
|
||||||
|
|
||||||
|
return [job_to_api_job(job) for job in Jobs.get_jobs()]
|
||||||
|
|
||||||
|
|
||||||
@strawberry.type
|
@strawberry.type
|
||||||
class Job:
|
class Job:
|
||||||
@strawberry.field
|
@strawberry.field
|
||||||
def get_jobs(self) -> typing.List[ApiJob]:
|
def get_jobs(self) -> typing.List[ApiJob]:
|
||||||
Jobs.get_jobs()
|
return get_all_jobs()
|
||||||
|
|
||||||
return [job_to_api_job(job) for job in Jobs.get_jobs()]
|
|
||||||
|
|
||||||
@strawberry.field
|
@strawberry.field
|
||||||
def get_job(self, job_id: str) -> typing.Optional[ApiJob]:
|
def get_job(self, job_id: str) -> typing.Optional[ApiJob]:
|
||||||
|
|
Loading…
Reference in a new issue