forked from VinokurovVE/tests
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
872 B
21 lines
872 B
from .database import Model
|
|
from sqlalchemy.orm import mapped_column, Mapped, relationship
|
|
from sqlalchemy import String, Boolean, ForeignKey
|
|
|
|
class Role(Model):
|
|
__tablename__ = "roles"
|
|
|
|
id: Mapped[int] = mapped_column(primary_key=True)
|
|
name: Mapped[str] = mapped_column(String(255),nullable=False)
|
|
|
|
class User(Model):
|
|
__tablename__ = "users"
|
|
|
|
id: Mapped[int] = mapped_column( primary_key=True)
|
|
firstname: Mapped[str] = mapped_column(String(255),nullable=False)
|
|
lastname: Mapped[str] = mapped_column(String(255),nullable=False)
|
|
email: Mapped[str] = mapped_column(String(255),nullable=False)
|
|
hashed_password: Mapped[str] = mapped_column(String(255),nullable=False)
|
|
is_active: Mapped[bool] = mapped_column(Boolean,default=True)
|
|
role_id: Mapped[int] = mapped_column(ForeignKey("roles.id"))
|
|
role: Mapped["Role"] = relationship()
|