Refactor code structure for improved readability and maintainability

This commit is contained in:
JSC
2025-07-22 13:21:44 +02:00
parent 11796b1012
commit fefb7f7bf4
26 changed files with 1424 additions and 7 deletions

21
app/models/plan.py Normal file
View File

@@ -0,0 +1,21 @@
from typing import TYPE_CHECKING
from sqlmodel import Field, Relationship
from app.models.base import BaseModel
if TYPE_CHECKING:
from app.models.user import User
class Plan(BaseModel, table=True):
"""Database model for a plan."""
code: str = Field(index=True, unique=True, nullable=False)
name: str = Field(nullable=False)
description: str | None = Field(default=None)
credits: int = Field(default=0, ge=0, nullable=False)
max_credits: int = Field(default=0, ge=0, nullable=False)
# relationships
users: list["User"] = Relationship(back_populates="plan")