Fix job uid generation

pull/15/head
Inex Code 2022-09-09 17:42:40 +03:00
parent 32278e9063
commit d7cba49c4a
2 changed files with 5 additions and 4 deletions

View File

@ -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,

View File

@ -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.
""" """