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

This commit is contained in:
Houkime 2024-04-22 14:41:56 +00:00 committed by Inex Code
parent 5558577927
commit fff8a49992

View file

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