This commit is contained in:
2026-01-06 19:35:49 +03:00
parent ff92ab2b30
commit 7d2a734b7d
13 changed files with 162 additions and 9 deletions
@@ -24,6 +24,7 @@ class TestUpdateFields(TypedDict, total=False):
password: str | None
expires_at: datetime | None
attempts: int | None
time_limit: int | None
is_active: bool
are_results_viewable: bool
@@ -64,6 +65,7 @@ class TestDAO:
password: str | None = None,
expires_at: datetime | None = None,
attempts: int | None = None,
time_limit: int | None = None,
is_active: bool = True,
are_results_viewable: bool = False,
) -> DomainTest:
@@ -74,6 +76,7 @@ class TestDAO:
password=password,
expires_at=expires_at,
attempts=attempts,
time_limit=time_limit,
is_active=is_active,
are_results_viewable=are_results_viewable,
)
@@ -91,6 +94,7 @@ class TestDAO:
password: str | None | _UNSET = UNSET,
expires_at: datetime | None | _UNSET = UNSET,
attempts: int | None | _UNSET = UNSET,
time_limit: int | None | _UNSET = UNSET,
is_active: bool | _UNSET = UNSET,
are_results_viewable: bool | _UNSET = UNSET,
) -> DomainTest | None:
@@ -113,6 +117,8 @@ class TestDAO:
test.expires_at = expires_at
if not isinstance(attempts, _UNSET):
test.attempts = attempts
if not isinstance(time_limit, _UNSET):
test.time_limit = time_limit
if not isinstance(is_active, _UNSET):
test.is_active = is_active
if not isinstance(are_results_viewable, _UNSET):
@@ -15,6 +15,7 @@ class TestDTO:
password=self.model.password,
expires_at=self.model.expires_at,
attempts=self.model.attempts,
time_limit=self.model.time_limit,
is_active=self.model.is_active,
are_results_viewable=self.model.are_results_viewable,
created_at=self.model.created_at,
@@ -52,6 +52,7 @@ class Test(Base):
password: Mapped[str | None] = mapped_column(String(255), default=None)
expires_at: Mapped[datetime | None] = mapped_column(default=None)
attempts: Mapped[int | None] = mapped_column(Integer, default=None)
time_limit: Mapped[int | None] = mapped_column(Integer, default=None)
is_active: Mapped[bool] = mapped_column(default=True)
are_results_viewable: Mapped[bool] = mapped_column(default=False)
created_at: Mapped[datetime] = mapped_column(server_default=func.now())