refactoring(jobs): break out a function returning all jobs

This commit is contained in:
Houkime 2024-04-22 14:41:56 +00:00
parent 5bf5e7462f
commit 8d099c9a22

View file

@ -11,13 +11,17 @@ from selfprivacy_api.graphql.common_types.jobs import (
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
class Job:
@strawberry.field
def get_jobs(self) -> typing.List[ApiJob]:
Jobs.get_jobs()
return [job_to_api_job(job) for job in Jobs.get_jobs()]
return get_all_jobs()
@strawberry.field
def get_job(self, job_id: str) -> typing.Optional[ApiJob]: