1
0
mirror of https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git synced 2025-08-14 00:25:46 +02:00

Добавления тестов бекенда1

This commit is contained in:
MoonTestUse1
2025-01-02 04:54:52 +06:00
parent 01677cf5df
commit a743fe8fe4
2 changed files with 16 additions and 3 deletions

14
backend/app/init_db.py Normal file
View File

@@ -0,0 +1,14 @@
"""Database initialization"""
from .database import Base, engine
from .models.employee import Employee
from .models.request import Request
def init_db():
"""Initialize database"""
# Удаляем все существующие таблицы
Base.metadata.drop_all(bind=engine)
# Создаем таблицы заново
Base.metadata.create_all(bind=engine)
if __name__ == "__main__":
init_db()

View File

@@ -1,5 +1,5 @@
"""Request model"""
from sqlalchemy import Column, Integer, String, Enum, ForeignKey, DateTime
from sqlalchemy import Column, Integer, String, ForeignKey, DateTime
from sqlalchemy.sql import func
from sqlalchemy.orm import relationship
from enum import Enum as PyEnum
@@ -9,7 +9,7 @@ class RequestStatus(str, PyEnum):
NEW = "new"
IN_PROGRESS = "in_progress"
COMPLETED = "completed"
CANCELLED = "cancelled"
REJECTED = "rejected"
class RequestPriority(str, PyEnum):
LOW = "low"
@@ -18,7 +18,6 @@ class RequestPriority(str, PyEnum):
class Request(Base):
__tablename__ = "requests"
__table_args__ = {'extend_existing': True}
id = Column(Integer, primary_key=True, index=True)
title = Column(String, nullable=False)