fix: rename the response schema for listing quiz
This commit is contained in:
parent
3c0d8e1e15
commit
57a75e5019
|
@ -3,7 +3,7 @@ from helpers import DatetimeUtil
|
|||
from models import QuizEntity, QuestionItemEntity, UserEntity
|
||||
from models.entities import SubjectEntity
|
||||
from schemas import QuizGetSchema, QuestionItemSchema
|
||||
from schemas.response import RecomendationResponse
|
||||
from schemas.response import ListingQuizResponse
|
||||
from schemas.requests import QuizCreateSchema
|
||||
|
||||
|
||||
|
@ -79,8 +79,8 @@ class QuizMapper:
|
|||
def quiz_to_recomendation_mapper(
|
||||
quiz_entity: QuizEntity,
|
||||
user_entity: UserEntity,
|
||||
) -> RecomendationResponse:
|
||||
return RecomendationResponse(
|
||||
) -> ListingQuizResponse:
|
||||
return ListingQuizResponse(
|
||||
quiz_id=str(quiz_entity.id),
|
||||
author_id=str(user_entity.id),
|
||||
author_name=user_entity.name,
|
||||
|
|
|
@ -4,7 +4,7 @@ from .quiz.question_item_schema import QuestionItemSchema
|
|||
from .quiz.quiz_data_rsp_schema import UserQuizListResponse
|
||||
from .history.history_response import HistoryResultSchema
|
||||
from .history.detail_history_response import QuizHistoryResponse, QuestionResult
|
||||
from .recomendation.recomendation_response_schema import RecomendationResponse
|
||||
from .recomendation.recomendation_response_schema import ListingQuizResponse
|
||||
from .subject.get_subject_schema import GetSubjectResponse
|
||||
|
||||
__all__ = [
|
||||
|
@ -15,6 +15,6 @@ __all__ = [
|
|||
"HistoryResultSchema",
|
||||
"QuizHistoryResponse",
|
||||
"QuestionResult",
|
||||
"RecomendationResponse",
|
||||
"ListingQuizResponse",
|
||||
"GetSubjectResponse",
|
||||
]
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
from typing import List
|
||||
from pydantic import BaseModel
|
||||
from schemas.response.recomendation.recomendation_response_schema import (
|
||||
RecomendationResponse,
|
||||
ListingQuizResponse,
|
||||
)
|
||||
|
||||
|
||||
class UserQuizListResponse(BaseModel):
|
||||
total: int
|
||||
quizzes: List[RecomendationResponse]
|
||||
quizzes: List[ListingQuizResponse]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class RecomendationResponse(BaseModel):
|
||||
class ListingQuizResponse(BaseModel):
|
||||
quiz_id: str
|
||||
author_id: str
|
||||
author_name: str
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from repositories import QuizRepository, UserRepository, SubjectRepository
|
||||
from schemas.requests import QuizCreateSchema
|
||||
from schemas.response import UserQuizListResponse, RecomendationResponse, QuizGetSchema
|
||||
from schemas.response import UserQuizListResponse, ListingQuizResponse, QuizGetSchema
|
||||
from exception import DataNotFoundException
|
||||
from mapper import QuizMapper
|
||||
from exception import ValidationException
|
||||
|
@ -28,7 +28,7 @@ class QuizService:
|
|||
|
||||
def search_quiz(
|
||||
self, keyword: str, page: int = 1, page_size: int = 10
|
||||
) -> tuple[list[RecomendationResponse], int]:
|
||||
) -> tuple[list[ListingQuizResponse], int]:
|
||||
|
||||
quizzes = self.quiz_repository.search_by_title_or_category(
|
||||
keyword, page, page_size
|
||||
|
|
Loading…
Reference in New Issue