From c56511f69fe99c01cf85ebdee17c73b520c82782 Mon Sep 17 00:00:00 2001 From: ZdenekSrotyr Date: Thu, 9 Apr 2026 07:05:50 +0200 Subject: [PATCH] refactor: replace local _get_data_dir() with shared app.utils.get_data_dir() Replace copy-pasted _get_data_dir() functions in catalog.py and upload.py with import from app.utils.get_data_dir(). sync.py and data.py already use the shared utility. --- app/api/catalog.py | 7 +------ app/api/upload.py | 7 +------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/app/api/catalog.py b/app/api/catalog.py index 0d8d582..82c1d87 100644 --- a/app/api/catalog.py +++ b/app/api/catalog.py @@ -1,25 +1,20 @@ """Catalog endpoints — table profiles, metrics.""" import json -import os import re -from pathlib import Path from fastapi import APIRouter, Depends, HTTPException import duckdb import yaml from app.auth.dependencies import get_current_user, _get_db +from app.utils import get_data_dir as _get_data_dir from src.repositories.profiles import ProfileRepository from src.rbac import can_access_table router = APIRouter(prefix="/api/catalog", tags=["catalog"]) -def _get_data_dir() -> Path: - return Path(os.environ.get("DATA_DIR", "./data")) - - @router.get("/profile/{table_name}") async def get_table_profile( table_name: str, diff --git a/app/api/upload.py b/app/api/upload.py index b927dbf..26003db 100644 --- a/app/api/upload.py +++ b/app/api/upload.py @@ -1,23 +1,18 @@ """Upload endpoints — sessions, artifacts, CLAUDE.local.md.""" -import os import uuid from datetime import datetime, timezone -from pathlib import Path from pathlib import Path as _Path from fastapi import APIRouter, Depends, HTTPException, UploadFile, File from pydantic import BaseModel from app.auth.dependencies import get_current_user +from app.utils import get_data_dir as _get_data_dir router = APIRouter(prefix="/api/upload", tags=["upload"]) -def _get_data_dir() -> Path: - return Path(os.environ.get("DATA_DIR", "./data")) - - @router.post("/sessions") async def upload_session( file: UploadFile = File(...),