45 lines
953 B
Bash
Executable File
45 lines
953 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
SCHEMA="services/profiles/src/app/schemas/profile.py"
|
|
mkdir -p "$(dirname "$SCHEMA")"
|
|
|
|
cat > "$SCHEMA" <<'PY'
|
|
from __future__ import annotations
|
|
from typing import List
|
|
from uuid import UUID
|
|
|
|
try:
|
|
# Pydantic v2
|
|
from pydantic import BaseModel, Field, ConfigDict
|
|
_V2 = True
|
|
except Exception:
|
|
# Pydantic v1 fallback
|
|
from pydantic import BaseModel, Field
|
|
ConfigDict = None
|
|
_V2 = False
|
|
|
|
class ProfileBase(BaseModel):
|
|
gender: str
|
|
city: str
|
|
languages: List[str] = Field(default_factory=list)
|
|
interests: List[str] = Field(default_factory=list)
|
|
|
|
class ProfileCreate(ProfileBase):
|
|
pass
|
|
|
|
class ProfileOut(ProfileBase):
|
|
id: UUID
|
|
user_id: UUID
|
|
|
|
if _V2:
|
|
model_config = ConfigDict(from_attributes=True)
|
|
else:
|
|
class Config:
|
|
orm_mode = True
|
|
PY
|
|
|
|
echo "[profiles] rebuilding..."
|
|
docker compose build profiles
|
|
docker compose restart profiles
|