Initial commit: VKUS vitrina MVP (frontend + backend).

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-29 23:13:06 +07:00
commit 862e6b7b25
113 changed files with 50949 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
import random
from datetime import datetime, timezone
from app.data.mock_data import seed_appeals
from app.models import Appeal, CreateAppealRequest
PRIORITY_MAP = {
"Критический": ("critical", "Критический"),
"Высокий": ("high", "Высокий"),
"Средний": ("medium", "Средний"),
"Низкий": ("low", "Низкий"),
}
class AppealStore:
def __init__(self) -> None:
self._appeals: list[Appeal] = seed_appeals()
def list_all(self) -> list[Appeal]:
return sorted(self._appeals, key=lambda a: a.updated_at, reverse=True)
def create(self, request: CreateAppealRequest) -> Appeal:
priority_key, priority_label = PRIORITY_MAP.get(request.priority, ("medium", "Средний"))
now = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%S")
number = f"INC-2026-{random.randint(1000, 9999)}"
appeal = Appeal(
id=f"new-{int(datetime.now(timezone.utc).timestamp() * 1000)}",
number=number,
title=request.title,
system=request.system,
status="new",
status_label="Новое обращение",
next_step="Обращение в очереди на назначение исполнителя",
priority=priority_key, # type: ignore[arg-type]
priority_label=priority_label,
created_at=now,
updated_at=now,
description=request.description,
comments=[],
)
self._appeals.insert(0, appeal)
return appeal
appeal_store = AppealStore()