PaperParser/app/models/user.py

19 lines
689 B
Python
Raw Normal View History

2024-01-31 19:37:01 +10:00
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)
2024-02-24 22:34:54 +10:00
collection_id = Column(Integer, ForeignKey("collection.id"))
collection: Mapped["UsersCollection"] = relationship("UsersCollection", back_populates="users")