1
0
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:
MoonTestUse1
2025-01-05 02:41:15 +06:00
parent 33ba3f7811
commit c3c20f6e6f
4 changed files with 20 additions and 21 deletions

View File

@@ -1,32 +1,35 @@
"""Request model""" """Request models"""
from enum import Enum 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.sql import func
from sqlalchemy.orm import relationship from ..database import Base
from app.db.base_class import Base
class RequestStatus(str, Enum): class RequestStatus(str, Enum):
"""Request status enum"""
NEW = "new" NEW = "new"
IN_PROGRESS = "in_progress" IN_PROGRESS = "in_progress"
COMPLETED = "completed" COMPLETED = "completed"
REJECTED = "rejected" REJECTED = "rejected"
class RequestPriority(str, Enum): class RequestPriority(str, Enum):
"""Request priority enum"""
LOW = "low" LOW = "low"
MEDIUM = "medium" MEDIUM = "medium"
HIGH = "high" HIGH = "high"
class Request(Base): class Request(Base):
"""Request model"""
__tablename__ = "requests" __tablename__ = "requests"
id = Column(Integer, primary_key=True, index=True) id = Column(Integer, primary_key=True, index=True)
department = Column(String, index=True) description = Column(String, nullable=False)
request_type = Column(String, index=True) status = Column(SQLAlchemyEnum(RequestStatus), nullable=False, default=RequestStatus.NEW)
description = Column(String) priority = Column(SQLAlchemyEnum(RequestPriority), nullable=False)
priority = Column(String) request_type = Column(String, nullable=False)
status = Column(String, default=RequestStatus.NEW) department = Column(String, nullable=False)
employee_id = Column(Integer, ForeignKey("employees.id")) employee_id = Column(Integer, ForeignKey("employees.id", ondelete="CASCADE"), nullable=False)
created_at = Column(DateTime(timezone=True), server_default=func.now()) created_at = Column(DateTime(timezone=True), server_default=func.now(), nullable=False)
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
# Определяем отношение к Employee
employee = relationship("Employee", back_populates="requests")

View File

@@ -9,20 +9,18 @@
<script setup lang="ts"> <script setup lang="ts">
const { priority } = defineProps<{ const { priority } = defineProps<{
priority: 'low' | 'medium' | 'high' | 'critical' priority: 'low' | 'medium' | 'high'
}>(); }>();
const priorityClasses = { const priorityClasses = {
low: 'bg-green-100 text-green-800', low: 'bg-green-100 text-green-800',
medium: 'bg-yellow-100 text-yellow-800', medium: 'bg-yellow-100 text-yellow-800',
high: 'bg-orange-100 text-orange-800', high: 'bg-red-100 text-red-800'
critical: 'bg-red-100 text-red-800'
}; };
const priorityLabels = { const priorityLabels = {
low: 'Низкий', low: 'Низкий',
medium: 'Средний', medium: 'Средний',
high: 'Высокий', high: 'Высокий'
critical: 'Критический'
}; };
</script> </script>

View File

@@ -31,7 +31,6 @@
<option value="low">Низкий</option> <option value="low">Низкий</option>
<option value="medium">Средний</option> <option value="medium">Средний</option>
<option value="high">Высокий</option> <option value="high">Высокий</option>
<option value="critical">Критический</option>
</select> </select>
</div> </div>

View File

@@ -48,7 +48,6 @@
<option value="low">Низкий</option> <option value="low">Низкий</option>
<option value="medium">Средний</option> <option value="medium">Средний</option>
<option value="high">Высокий</option> <option value="high">Высокий</option>
<option value="critical">Критический</option>
</select> </select>
</div> </div>