eksplicit mapping af envs
This commit is contained in:
0
backend/app/models/__init__.py
Normal file
0
backend/app/models/__init__.py
Normal file
20
backend/app/models/db_models.py
Normal file
20
backend/app/models/db_models.py
Normal file
@@ -0,0 +1,20 @@
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
||||
from app.core.database import Base
|
||||
|
||||
|
||||
class DailyStat(Base):
|
||||
__tablename__ = "daily_stats"
|
||||
|
||||
date: Mapped[sa.Date] = mapped_column(sa.Date, primary_key=True)
|
||||
total_sessions: Mapped[int] = mapped_column(sa.Integer, default=0)
|
||||
total_matches: Mapped[int] = mapped_column(sa.Integer, default=0)
|
||||
|
||||
|
||||
class InterestCategoryCount(Base):
|
||||
__tablename__ = "interest_category_counts"
|
||||
|
||||
date: Mapped[sa.Date] = mapped_column(sa.Date, primary_key=True)
|
||||
category: Mapped[str] = mapped_column(sa.String(64), primary_key=True)
|
||||
count: Mapped[int] = mapped_column(sa.Integer, default=0)
|
||||
12
backend/app/models/match.py
Normal file
12
backend/app/models/match.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class MatchRequest(BaseModel):
|
||||
own_token: str
|
||||
detected_token: str
|
||||
|
||||
|
||||
class MatchResult(BaseModel):
|
||||
match: bool
|
||||
shared_interests: list[str]
|
||||
nudge_sent: bool
|
||||
13
backend/app/models/session.py
Normal file
13
backend/app/models/session.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class SessionCreate(BaseModel):
|
||||
ble_token: str = Field(..., min_length=1, max_length=128)
|
||||
interests: list[str] = Field(..., min_length=1, max_length=20)
|
||||
|
||||
|
||||
class SessionResponse(BaseModel):
|
||||
session_id: str
|
||||
expires_at: datetime
|
||||
8
backend/app/models/stats.py
Normal file
8
backend/app/models/stats.py
Normal file
@@ -0,0 +1,8 @@
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class StatsResponse(BaseModel):
|
||||
total_sessions_today: int
|
||||
total_matches_today: int
|
||||
active_sessions_now: int
|
||||
top_interest_categories: list[str]
|
||||
Reference in New Issue
Block a user