You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
920 B
21 lines
920 B
from database import Model
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
from sqlalchemy import String, Integer, Boolean, ForeignKey
|
|
from typing import Optional, Sequence
|
|
|
|
class UserModel(Model):
|
|
__tablename__ ="users"
|
|
|
|
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
|
firstname: Mapped[str | None]= mapped_column(String(255), nullable=True)
|
|
lastname: Mapped[str | None]= mapped_column(String(255), nullable=True)
|
|
age: Mapped[int | None] = mapped_column(Integer, nullable=True)
|
|
email: Mapped[str | None] = mapped_column(String(255), nullable=True)
|
|
login_id: Mapped[int] = mapped_column(Integer, ForeignKey("logins.id"))
|
|
|
|
class LoginModel(Model):
|
|
__tablename__ ="logins"
|
|
|
|
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
|
login: Mapped[str]= mapped_column(String(255), nullable=False)
|
|
password: Mapped[str]= mapped_column(String(255), nullable=False)
|