17 lines
485 B
Python

from typing import Optional, TYPE_CHECKING
from uuid import UUID, uuid4
from sqlmodel import Field, Relationship, SQLModel
if TYPE_CHECKING:
from backend.app.models.owner import Owner
class User(SQLModel, table=True):
id: UUID = Field(default_factory=lambda: uuid4(), primary_key=True)
email: str = Field(unique=True, nullable=False)
password_hash: str = Field(nullable=False)
# Relationships
owner: Optional["Owner"] = Relationship(back_populates="user")