mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-28 23:11:29 +00:00
refactoring(jobs): break out a function returning all jobs
This commit is contained in:
parent
5bf5e7462f
commit
8d099c9a22
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue