diff --git a/packs-lab/app/routes.py b/packs-lab/app/routes.py index 03c5669..0090620 100644 --- a/packs-lab/app/routes.py +++ b/packs-lab/app/routes.py @@ -129,9 +129,9 @@ async def upload( filename = _check_filename(payload["filename"]) expected_size = int(payload["size_bytes"]) - tier_dir = PACK_BASE_DIR / tier - tier_dir.mkdir(parents=True, exist_ok=True) - target = tier_dir / filename + # tier 디렉토리는 만들지 않고 PACK_BASE_DIR 평면 구조에 저장. tier 구분은 filename 규칙으로. + PACK_BASE_DIR.mkdir(parents=True, exist_ok=True) + target = PACK_BASE_DIR / filename if target.exists(): raise HTTPException(status_code=409, detail="이미 존재하는 파일명입니다. 다른 이름으로 업로드하거나 기존 파일을 먼저 삭제하세요") @@ -155,7 +155,7 @@ async def upload( # Supabase·DSM에 노출되는 file_path는 NAS 호스트 절대경로여야 한다. # 컨테이너 경로(target)는 마운트된 호스트경로의 다른 시점일 뿐이라, 같은 디렉토리 구조를 보유. - host_path = PACK_HOST_DIR / tier / filename + host_path = PACK_HOST_DIR / filename # supabase INSERT sb = _supabase() diff --git a/packs-lab/tests/test_routes.py b/packs-lab/tests/test_routes.py index 02ed84b..21084a5 100644 --- a/packs-lab/tests/test_routes.py +++ b/packs-lab/tests/test_routes.py @@ -160,8 +160,8 @@ def test_upload_size_mismatch(tmp_path, monkeypatch): ) assert resp.status_code == 400 assert "크기" in resp.json()["detail"] - # 파일이 정리되었는지 확인 - assert not (tmp_path / "pro" / "size_mismatch_test.zip").exists() + # 파일이 정리되었는지 확인 (평면 구조) + assert not (tmp_path / "size_mismatch_test.zip").exists() def test_upload_jti_replay(tmp_path, monkeypatch): @@ -292,7 +292,7 @@ def test_upload_stores_host_path_not_container_path(tmp_path, monkeypatch): assert resp.status_code == 200 # Supabase에 저장된 file_path는 호스트 경로 - expected_host = str(host_base / "pro" / "host_path_check.zip") + expected_host = str(host_base / "host_path_check.zip") assert captured_insert["file_path"] == expected_host # 응답의 file_path도 호스트 경로 assert resp.json()["file_path"] == expected_host diff --git a/scripts/deploy-nas.sh b/scripts/deploy-nas.sh index 12321b4..a37180e 100644 --- a/scripts/deploy-nas.sh +++ b/scripts/deploy-nas.sh @@ -2,7 +2,7 @@ set -euo pipefail # ── 서비스 목록 (한 곳에서만 관리) ── -SERVICES="lotto travel-proxy deployer stock-lab music-lab blog-lab realestate-lab agent-office personal nginx scripts" +SERVICES="lotto travel-proxy deployer stock-lab music-lab blog-lab realestate-lab agent-office personal packs-lab nginx scripts" # 1. 자동 감지: Docker 컨테이너 내부인가? if [ -d "/repo" ] && [ -d "/runtime" ]; then