Skip to content

Commit

Permalink
feat: 시험 결과를 받아오는 엔드포인트 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
C7C4FF committed Aug 31, 2024
1 parent 68fdc0d commit fad2e06
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions Backend/test_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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])

1 comment on commit fad2e06

@C7C4FF
Copy link
Contributor Author

@C7C4FF C7C4FF commented on fad2e06 Aug 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#80

Please sign in to comment.