Add CP→CA→PI platform foundation on MapMil monorepo.

Unify parsing workers, analytics API with PostgreSQL, map UI, and PI distribution into centers/ with Docker Compose.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-30 11:43:27 +03:00
co-authored by Cursor
commit 9dfe713668
88 changed files with 6587 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
import os
import uuid
from pathlib import Path
UPLOAD_DIR = Path(os.getenv("UPLOAD_DIR", "/data/uploads"))
ALLOWED_CONTENT_TYPES = {
"image/jpeg",
"image/png",
"image/gif",
"image/webp",
"video/mp4",
"video/webm",
}
MAX_FILE_SIZE = 20 * 1024 * 1024
def ensure_upload_dir() -> None:
UPLOAD_DIR.mkdir(parents=True, exist_ok=True)
def is_allowed_content_type(content_type: str) -> bool:
return content_type in ALLOWED_CONTENT_TYPES
def build_stored_name(original_name: str) -> str:
suffix = Path(original_name).suffix.lower()
return f"{uuid.uuid4().hex}{suffix}"
def media_file_path(stored_name: str) -> Path:
return UPLOAD_DIR / stored_name
def remove_media_file(stored_name: str) -> None:
path = media_file_path(stored_name)
if path.exists():
path.unlink()