PaperParser/app/models/user.py

19 lines
664 B
Python

from sqlalchemy import Integer
from sqlalchemy.schema import (
Column,
ForeignKey,
)
from sqlalchemy.orm import Mapped, mapped_column, relationship
from app.extensions import db
class User(db.Model):
id: Mapped[int] = mapped_column(primary_key=True)
first_name: Mapped[str] = mapped_column(nullable=True)
last_name: Mapped[str] = mapped_column(nullable=True)
phone: Mapped[str] = mapped_column(nullable=True, unique=True)
username: Mapped[str] = mapped_column(nullable=True, unique=True)
session_id = Column(Integer, ForeignKey("session.id"))
session: Mapped["Session"] = relationship("Session", back_populates="users")