api fixes. CHAT container NEEDS ATTENTION
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2025-08-08 22:51:21 +09:00
parent 32f7b5276f
commit 7ac2defcc0
18 changed files with 516 additions and 38 deletions

View File

@@ -0,0 +1,32 @@
set -euo pipefail
FILE="services/auth/src/app/schemas/user.py"
[ -f "$FILE" ] || { echo "Not found: $FILE"; exit 1; }
python3 - "$FILE" <<'PY'
from pathlib import Path
import re, sys
p = Path(sys.argv[1]); s = p.read_text()
if "from uuid import UUID" not in s:
s = "from uuid import UUID\n" + s
s = re.sub(r'(\bid\s*:\s*)str', r'\1UUID', s)
s = re.sub(r'(\buser_id\s*:\s*)str', r'\1UUID', s)
# Включаем from_attributes (pydantic v2) или orm_mode (v1) для моделей ответа
if "model_config" not in s and "orm_mode" not in s:
s = re.sub(
r"class\s+\w+Out\s*\((?:.|\n)*?\):",
lambda m: m.group(0) +
"\n try:\n from pydantic import ConfigDict\n model_config = ConfigDict(from_attributes=True)\n"
" except Exception:\n class Config:\n orm_mode = True\n",
s
)
p.write_text(s)
print("[auth] Patched:", p)
PY
echo "[auth] Rebuild & restart…"
docker compose build auth
docker compose restart auth