Initial commit

This commit is contained in:
2026-01-03 16:38:00 +03:00
parent 94ca600d3a
commit 39c99c4165
3 changed files with 50 additions and 3 deletions
@@ -0,0 +1,17 @@
from datetime import datetime
from dishka import AsyncContainer
from trudex.infrastructure.database.dao.test import TestDAO
from trudex.infrastructure.database.models import Test
async def deactivate_expired_tests(container: AsyncContainer):
async with container() as request_container:
test_dao = await request_container.get(TestDAO)
tests = await test_dao.get_all()
for test in tests:
if test.expires_at and test.expires_at < datetime.utcnow() and test.is_active:
await test_dao.update(test.id, is_active=False)