feat-(move2lab2, postgres settings, repo base and other)

This commit is contained in:
2026-11-03 04:24:22 +03:00
parent 65003b6119
commit 273519109e
34 changed files with 1396 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
from sqlalchemy.ext.asyncio import AsyncSession
import uuid
from datetime import datetime
from typing import Optional
from src.models.sessions import Session
from src.api.repositories.core import DatabaseManager
class SessionRepo(DatabaseManager):
def __init__(self, session: AsyncSession, model: Session):
super().__init__(session, model)
async def create(self, token_hash: str, user_id: uuid.UUID, expires_at: datetime) -> Optional[Session]:
result = await super().create(token_hash=token_hash, user_id=user_id, expires_at=expires_at)
return result
async def get_by_token_hash(self, token_hash: str) -> Optional[Session]:
result = await super().get_by_field("token_hash", token_hash)
return result
async def delete_by_token_hash(self, token_hash: str) -> bool:
result = await super().delete_by_field("token_hash", token_hash)
return result