초기 커밋

This commit is contained in:
2026-03-01 07:44:19 +09:00
commit 09359f30be
146 changed files with 6120 additions and 0 deletions

23
app/utils/file_utils.py Normal file
View File

@@ -0,0 +1,23 @@
from __future__ import annotations
import os
import uuid
from fastapi import UploadFile
UPLOAD_DIR = "uploads"
async def save_upload(file: UploadFile, subdir: str = "") -> str:
directory = os.path.join(UPLOAD_DIR, subdir) if subdir else UPLOAD_DIR
os.makedirs(directory, exist_ok=True)
ext = os.path.splitext(file.filename or "")[1]
filename = f"{uuid.uuid4().hex}{ext}"
filepath = os.path.join(directory, filename)
content = await file.read()
with open(filepath, "wb") as f:
f.write(content)
return filepath