made basetranscription be the base
Browse files
App/Transcription/TranscriptionRoutes.py
CHANGED
@@ -63,8 +63,8 @@ async def download_audio(
|
|
63 |
transcription_enrty = await Transcriptions.objects.create(
|
64 |
user=user, youtubeLink=url, **response
|
65 |
)
|
66 |
-
|
67 |
-
return
|
68 |
|
69 |
|
70 |
@transcription_router.get("/transcriptions")
|
@@ -83,7 +83,7 @@ async def delete_transcription(
|
|
83 |
task_id: str,
|
84 |
user: UserSchema = Depends(get_token_owner),
|
85 |
):
|
86 |
-
transcript = await Transcriptions.objects.filter(task_id=task_id).first()
|
87 |
await transcript.delete()
|
88 |
return {"code": 200, "message": f"deleted {task_id}", "payload": None}
|
89 |
|
@@ -132,7 +132,7 @@ async def create_file(
|
|
132 |
@transcription_router.get("/tasks/{task_id}")
|
133 |
async def get_status(task_id):
|
134 |
entry: Transcriptions = await Transcriptions.objects.filter(task_id=task_id).first()
|
135 |
-
result =
|
136 |
|
137 |
if result.status == "SUCCESS":
|
138 |
return result
|
@@ -145,11 +145,11 @@ async def get_status(task_id):
|
|
145 |
}
|
146 |
|
147 |
if task_result.status == "SUCCESS":
|
148 |
-
trans =
|
149 |
await entry.update(**trans.dict())
|
150 |
else:
|
151 |
_trans = TranscriptionMetadata(**task_result.result)
|
152 |
await entry.update(**_trans.dict())
|
153 |
|
154 |
-
result =
|
155 |
return result
|
|
|
63 |
transcription_enrty = await Transcriptions.objects.create(
|
64 |
user=user, youtubeLink=url, **response
|
65 |
)
|
66 |
+
entry=BaseTranscription(**transcription_enrty.__dict__)
|
67 |
+
return entry
|
68 |
|
69 |
|
70 |
@transcription_router.get("/transcriptions")
|
|
|
83 |
task_id: str,
|
84 |
user: UserSchema = Depends(get_token_owner),
|
85 |
):
|
86 |
+
transcript = await Transcriptions.objects.filter(user=user).filter(task_id=task_id).first()
|
87 |
await transcript.delete()
|
88 |
return {"code": 200, "message": f"deleted {task_id}", "payload": None}
|
89 |
|
|
|
132 |
@transcription_router.get("/tasks/{task_id}")
|
133 |
async def get_status(task_id):
|
134 |
entry: Transcriptions = await Transcriptions.objects.filter(task_id=task_id).first()
|
135 |
+
result = BaseTranscription(**entry.__dict__)
|
136 |
|
137 |
if result.status == "SUCCESS":
|
138 |
return result
|
|
|
145 |
}
|
146 |
|
147 |
if task_result.status == "SUCCESS":
|
148 |
+
trans = BaseTranscription(**task_result.result)
|
149 |
await entry.update(**trans.dict())
|
150 |
else:
|
151 |
_trans = TranscriptionMetadata(**task_result.result)
|
152 |
await entry.update(**_trans.dict())
|
153 |
|
154 |
+
result = BaseTranscription(**entry.__dict__)
|
155 |
return result
|