mirror of
https://github.com/koloideal/Quizzi.git
synced 2026-06-10 18:35:28 +03:00
Initial commit
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
from trudex.domain.schemas import TestAttempt as DomainTestAttempt
|
||||
from trudex.infrastructure.database.models import TestAttempt as TestAttemptModel
|
||||
|
||||
|
||||
class TestAttemptDTO:
|
||||
def __init__(self, model: TestAttemptModel) -> None:
|
||||
self.model: TestAttemptModel = model
|
||||
|
||||
def to_domain(self) -> DomainTestAttempt:
|
||||
return DomainTestAttempt(
|
||||
id=self.model.id,
|
||||
user_id=self.model.user_id,
|
||||
test_id=self.model.test_id,
|
||||
started_at=self.model.started_at,
|
||||
finished_at=self.model.finished_at,
|
||||
score=self.model.score,
|
||||
is_passed=self.model.is_passed,
|
||||
)
|
||||
@@ -0,0 +1,17 @@
|
||||
from trudex.domain.schemas import UserAnswer as DomainUserAnswer
|
||||
from trudex.infrastructure.database.models import UserAnswer as UserAnswerModel
|
||||
|
||||
|
||||
class UserAnswerDTO:
|
||||
def __init__(self, model: UserAnswerModel) -> None:
|
||||
self.model: UserAnswerModel = model
|
||||
|
||||
def to_domain(self) -> DomainUserAnswer:
|
||||
return DomainUserAnswer(
|
||||
id=self.model.id,
|
||||
attempt_id=self.model.attempt_id,
|
||||
question_id=self.model.question_id,
|
||||
selected_option_id=self.model.selected_option_id,
|
||||
text_answer=self.model.text_answer,
|
||||
is_correct=self.model.is_correct,
|
||||
)
|
||||
Reference in New Issue
Block a user