This commit is contained in:
2025-12-13 14:39:50 +03:00
commit b666cdcb95
79 changed files with 3081 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
from sqlalchemy import Column, String, Enum
from sqlalchemy.orm import relationship
import enum
from app.db.base import BaseModel
class UserRole(str, enum.Enum):
CHILD = "CHILD"
PARENT = "PARENT"
EDUCATOR = "EDUCATOR"
class User(BaseModel):
__tablename__ = "users"
email = Column(String(255), unique=True, nullable=False, index=True)
hashed_password = Column(String(255), nullable=False)
role = Column(Enum(UserRole), nullable=False, default=UserRole.CHILD)
full_name = Column(String(255), nullable=True)
# Relationships
schedules = relationship("Schedule", back_populates="user", cascade="all, delete-orphan")
rewards = relationship("Reward", back_populates="user", cascade="all, delete-orphan")
conversations = relationship("AIConversation", back_populates="user", cascade="all, delete-orphan")