Brushed up the backend, added writing task 1 academic prompt gen and grading ENCOA-274
This commit is contained in:
19
ielts_be/controllers/impl/exam/writing.py
Normal file
19
ielts_be/controllers/impl/exam/writing.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from fastapi import UploadFile, HTTPException
|
||||
|
||||
from ielts_be.controllers import IWritingController
|
||||
from ielts_be.services import IWritingService
|
||||
|
||||
|
||||
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):
|
||||
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):
|
||||
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)
|
||||
Reference in New Issue
Block a user