feat:增加考试接口

This commit is contained in:
2026-08-03 22:43:09 +08:00
parent e84f4e7e18
commit 0760f53cc6
6 changed files with 68 additions and 12 deletions

18
service/exam_service.py Normal file
View File

@@ -0,0 +1,18 @@
from sqlalchemy.ext.asyncio import AsyncSession
from models.library import ExamRecord
from schemas.exam import ExamRecordRequest
async def add_record(db: AsyncSession, data: ExamRecordRequest) -> bool:
record = ExamRecord(
subject=data.subject,
total_count=data.totalCount,
correct_count=data.correctCount,
wrong_count=data.wrongCount,
)
db.add(record)
await db.commit()
return True