added data models

This commit is contained in:
Brian Bjarke Jensen
2025-11-06 21:33:13 +01:00
parent 28305eb36f
commit a22de7cef9
4 changed files with 47 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
"""Database models."""
from sqlalchemy import Column, Integer, String, DateTime
from datetime import datetime
from baby_monitor.repositories.dependencies.get_database import Base
class User(Base):
"""User database model."""
__tablename__ = "users"
id = Column(Integer, primary_key=True, index=True)
username = Column(String, unique=True, index=True, nullable=False)
hashed_password = Column(String, nullable=False)
created_at = Column(DateTime, default=datetime.utcnow, nullable=False)
def __repr__(self) -> str:
return f"<User(id={self.id}, username='{self.username}')>"