mirror of
https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git
synced 2025-08-14 00:25:46 +02:00
Починка админки полностью2222332
This commit is contained in:
@@ -1,20 +1,15 @@
|
||||
"""Employee models"""
|
||||
from pydantic import BaseModel, Field
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
"""Employee model"""
|
||||
from sqlalchemy import Column, Integer, String, DateTime
|
||||
from sqlalchemy.sql import func
|
||||
from ..database import Base
|
||||
|
||||
class EmployeeBase(BaseModel):
|
||||
first_name: str = Field(..., min_length=1)
|
||||
last_name: str = Field(..., min_length=1)
|
||||
department: str = Field(..., pattern="^(aho|gkh|general)$")
|
||||
office: str = Field(..., min_length=1)
|
||||
class Employee(Base):
|
||||
__tablename__ = "employees"
|
||||
|
||||
class EmployeeCreate(EmployeeBase):
|
||||
password: str = Field(..., min_length=6)
|
||||
|
||||
class Employee(EmployeeBase):
|
||||
id: int
|
||||
created_at: datetime
|
||||
|
||||
class Config:
|
||||
from_attributes = 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())
|
Reference in New Issue
Block a user