mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-22 04:01:27 +00:00
chore(jobs): shorter typehints and import sorting
This commit is contained in:
parent
ed777e3ebf
commit
cbe5c56270
|
@ -1,17 +1,17 @@
|
||||||
"""Jobs status"""
|
"""Jobs status"""
|
||||||
# pylint: disable=too-few-public-methods
|
# pylint: disable=too-few-public-methods
|
||||||
import typing
|
|
||||||
import strawberry
|
import strawberry
|
||||||
|
from typing import List, Optional
|
||||||
|
|
||||||
|
from selfprivacy_api.jobs import Jobs
|
||||||
from selfprivacy_api.graphql.common_types.jobs import (
|
from selfprivacy_api.graphql.common_types.jobs import (
|
||||||
ApiJob,
|
ApiJob,
|
||||||
get_api_job_by_id,
|
get_api_job_by_id,
|
||||||
job_to_api_job,
|
job_to_api_job,
|
||||||
)
|
)
|
||||||
|
|
||||||
from selfprivacy_api.jobs import Jobs
|
|
||||||
|
|
||||||
|
def get_all_jobs() -> List[ApiJob]:
|
||||||
def get_all_jobs() -> typing.List[ApiJob]:
|
|
||||||
Jobs.get_jobs()
|
Jobs.get_jobs()
|
||||||
|
|
||||||
return [job_to_api_job(job) for job in Jobs.get_jobs()]
|
return [job_to_api_job(job) for job in Jobs.get_jobs()]
|
||||||
|
@ -20,9 +20,9 @@ def get_all_jobs() -> typing.List[ApiJob]:
|
||||||
@strawberry.type
|
@strawberry.type
|
||||||
class Job:
|
class Job:
|
||||||
@strawberry.field
|
@strawberry.field
|
||||||
def get_jobs(self) -> typing.List[ApiJob]:
|
def get_jobs(self) -> List[ApiJob]:
|
||||||
return get_all_jobs()
|
return get_all_jobs()
|
||||||
|
|
||||||
@strawberry.field
|
@strawberry.field
|
||||||
def get_job(self, job_id: str) -> typing.Optional[ApiJob]:
|
def get_job(self, job_id: str) -> Optional[ApiJob]:
|
||||||
return get_api_job_by_id(job_id)
|
return get_api_job_by_id(job_id)
|
||||||
|
|
Loading…
Reference in a new issue