1
0
mirror of https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git synced 2025-08-14 00:25:46 +02:00
Files
AdministrationItDepartmens/backend/app/models/employee.py
2025-01-02 01:15:03 +06:00

25 lines
871 B
Python

"""Employee model"""
from sqlalchemy import Column, Integer, String, DateTime
from sqlalchemy.sql import func
from sqlalchemy.orm import relationship
from ..database import Base
class Employee(Base):
__tablename__ = "employees"
__table_args__ = {'extend_existing': True}
id = Column(Integer, primary_key=True, index=True)
first_name = Column(String, nullable=False)
last_name = Column(String, nullable=False)
department = Column(String, nullable=False)
office = Column(String, nullable=False)
password = Column(String, nullable=False)
created_at = Column(DateTime(timezone=True), server_default=func.now())
# Определяем отношение к Request
requests = relationship(
"app.models.request.Request",
back_populates="employee",
lazy="dynamic",
cascade="all, delete-orphan"
)