mirror of
https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git
synced 2025-08-14 00:25:46 +02:00
add websockets suppor92
This commit is contained in:
@@ -1,32 +1,35 @@
|
||||
"""Request model"""
|
||||
"""Request models"""
|
||||
from enum import Enum
|
||||
from sqlalchemy import Column, Integer, String, ForeignKey, DateTime
|
||||
from sqlalchemy import Column, Integer, String, ForeignKey, DateTime, Enum as SQLAlchemyEnum
|
||||
from sqlalchemy.sql import func
|
||||
from sqlalchemy.orm import relationship
|
||||
from app.db.base_class import Base
|
||||
from ..database import Base
|
||||
|
||||
|
||||
class RequestStatus(str, Enum):
|
||||
"""Request status enum"""
|
||||
NEW = "new"
|
||||
IN_PROGRESS = "in_progress"
|
||||
COMPLETED = "completed"
|
||||
REJECTED = "rejected"
|
||||
|
||||
|
||||
class RequestPriority(str, Enum):
|
||||
"""Request priority enum"""
|
||||
LOW = "low"
|
||||
MEDIUM = "medium"
|
||||
HIGH = "high"
|
||||
|
||||
|
||||
class Request(Base):
|
||||
"""Request model"""
|
||||
__tablename__ = "requests"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
department = Column(String, index=True)
|
||||
request_type = Column(String, index=True)
|
||||
description = Column(String)
|
||||
priority = Column(String)
|
||||
status = Column(String, default=RequestStatus.NEW)
|
||||
employee_id = Column(Integer, ForeignKey("employees.id"))
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
||||
|
||||
# Определяем отношение к Employee
|
||||
employee = relationship("Employee", back_populates="requests")
|
||||
description = Column(String, nullable=False)
|
||||
status = Column(SQLAlchemyEnum(RequestStatus), nullable=False, default=RequestStatus.NEW)
|
||||
priority = Column(SQLAlchemyEnum(RequestPriority), nullable=False)
|
||||
request_type = Column(String, nullable=False)
|
||||
department = Column(String, nullable=False)
|
||||
employee_id = Column(Integer, ForeignKey("employees.id", ondelete="CASCADE"), nullable=False)
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now(), nullable=False)
|
||||
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
|
||||
|
@@ -9,20 +9,18 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
const { priority } = defineProps<{
|
||||
priority: 'low' | 'medium' | 'high' | 'critical'
|
||||
priority: 'low' | 'medium' | 'high'
|
||||
}>();
|
||||
|
||||
const priorityClasses = {
|
||||
low: 'bg-green-100 text-green-800',
|
||||
medium: 'bg-yellow-100 text-yellow-800',
|
||||
high: 'bg-orange-100 text-orange-800',
|
||||
critical: 'bg-red-100 text-red-800'
|
||||
high: 'bg-red-100 text-red-800'
|
||||
};
|
||||
|
||||
const priorityLabels = {
|
||||
low: 'Низкий',
|
||||
medium: 'Средний',
|
||||
high: 'Высокий',
|
||||
critical: 'Критический'
|
||||
high: 'Высокий'
|
||||
};
|
||||
</script>
|
@@ -31,7 +31,6 @@
|
||||
<option value="low">Низкий</option>
|
||||
<option value="medium">Средний</option>
|
||||
<option value="high">Высокий</option>
|
||||
<option value="critical">Критический</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
@@ -48,7 +48,6 @@
|
||||
<option value="low">Низкий</option>
|
||||
<option value="medium">Средний</option>
|
||||
<option value="high">Высокий</option>
|
||||
<option value="critical">Критический</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
Reference in New Issue
Block a user