mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2025-01-23 17:26:46 +00:00
Fix job uid generation
This commit is contained in:
parent
32278e9063
commit
d7cba49c4a
|
@ -14,7 +14,7 @@ class JobMutations:
|
||||||
@strawberry.mutation(permission_classes=[IsAuthenticated])
|
@strawberry.mutation(permission_classes=[IsAuthenticated])
|
||||||
def remove_job(self, job_id: str) -> GenericMutationReturn:
|
def remove_job(self, job_id: str) -> GenericMutationReturn:
|
||||||
"""Remove a job from the queue"""
|
"""Remove a job from the queue"""
|
||||||
result = Jobs().remove_by_uuid(job_id)
|
result = Jobs().remove_by_uid(job_id)
|
||||||
if result:
|
if result:
|
||||||
return GenericMutationReturn(
|
return GenericMutationReturn(
|
||||||
success=True,
|
success=True,
|
||||||
|
|
|
@ -45,7 +45,7 @@ class Job(BaseModel):
|
||||||
Job class.
|
Job class.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
uid: UUID = uuid.uuid4()
|
uid: UUID
|
||||||
type_id: str
|
type_id: str
|
||||||
name: str
|
name: str
|
||||||
description: str
|
description: str
|
||||||
|
@ -108,6 +108,7 @@ class Jobs:
|
||||||
Add a job to the jobs list.
|
Add a job to the jobs list.
|
||||||
"""
|
"""
|
||||||
job = Job(
|
job = Job(
|
||||||
|
uid=uuid.uuid4(),
|
||||||
name=name,
|
name=name,
|
||||||
type_id=type_id,
|
type_id=type_id,
|
||||||
description=description,
|
description=description,
|
||||||
|
@ -133,9 +134,9 @@ class Jobs:
|
||||||
"""
|
"""
|
||||||
Remove a job from the jobs list.
|
Remove a job from the jobs list.
|
||||||
"""
|
"""
|
||||||
self.remove_by_uuid(str(job.uid))
|
self.remove_by_uid(str(job.uid))
|
||||||
|
|
||||||
def remove_by_uuid(self, job_uuid: str) -> bool:
|
def remove_by_uid(self, job_uuid: str) -> bool:
|
||||||
"""
|
"""
|
||||||
Remove a job from the jobs list.
|
Remove a job from the jobs list.
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue