From fad2e06c575793f6675e8f5e533132047b760992 Mon Sep 17 00:00:00 2001 From: c7c4ff Date: Sat, 31 Aug 2024 17:24:07 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=8B=9C=ED=97=98=20=EA=B2=B0=EA=B3=BC?= =?UTF-8?q?=EB=A5=BC=20=EB=B0=9B=EC=95=84=EC=98=A4=EB=8A=94=20=EC=97=94?= =?UTF-8?q?=EB=93=9C=ED=8F=AC=EC=9D=B8=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Backend/test_router.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Backend/test_router.py b/Backend/test_router.py index 80e1b7ad..cb27265d 100644 --- a/Backend/test_router.py +++ b/Backend/test_router.py @@ -14,10 +14,10 @@ from database.orm import Question, Score, Test, User from database.repository import (create_score, create_test, create_update_user, get_questions_by_date, get_result, - get_result_by_q_num) + get_result_by_q_num, get_personal_scores) from fastapi import APIRouter, Depends, File, HTTPException, UploadFile from schema.request import CreateScoreRequest, CreateTestRequest -from schema.response import QuestionSchema, ScoreSchema, TestSchema +from schema.response import QuestionSchema, ScoreSchema, TestSchema, ScoreListSchema from sqlalchemy.orm import Session router = APIRouter() @@ -176,3 +176,12 @@ async def get_result_by_question( test: Test = get_result_by_q_num(session=session, date=date, user=user, q_num=q_num) return TestSchema.from_orm(test) + +@router.get("/getResult") +def get_scores( + user: User = Depends(get_authorized_user), + session: Session = Depends(get_db), +): + scores: List[Score] = get_personal_scores(session=session, user=user) + + return ScoreListSchema(scores=[ScoreSchema.from_orm(score) for score in scores]) \ No newline at end of file