ENCOA-311

This commit is contained in:
Carlos-Mesquita
2025-01-13 01:13:28 +00:00
parent 8550b520e1
commit b32e38156c
27 changed files with 126 additions and 62 deletions

View File

@@ -1,3 +1,5 @@
from typing import List
from fastapi import UploadFile, HTTPException
from ielts_be.controllers import IWritingController
@@ -9,10 +11,10 @@ class WritingController(IWritingController):
def __init__(self, writing_service: IWritingService):
self._service = writing_service
async def get_writing_task_general_question(self, task: int, topic: str, difficulty: str):
async def get_writing_task_general_question(self, task: int, topic: str, difficulty: List[str]):
return await self._service.get_writing_task_general_question(task, topic, difficulty)
async def get_writing_task_academic_question(self, task: int, attachment: UploadFile, difficulty: str):
async def get_writing_task_academic_question(self, task: int, attachment: UploadFile, difficulty: List[str]):
if attachment.content_type not in ['image/jpeg', 'image/png']:
raise HTTPException(status_code=400, detail="Invalid file type. Only JPEG and PNG allowed.")
return await self._service.get_writing_task_academic_question(task, attachment, difficulty)