ifixkart-admin/Backend/app/storage/local_provider.py
Adithiyan bbd3a3e959 feat: initial commit — full platform snapshot
- Backend: FastAPI app with all models, services, schemas, routes
- Admin Panel: Next.js dashboard with all modules
  (CRM, POS, repairs, warranties, billing, notifications, etc.)
- Ecommerce: storefront (submodule) + product catalog
- AI Agents: .agents/ skill library for Antigravity IDE
- Docs: architecture, billing, notification gateway markdown
- Submodules: Backend/OpenWA, Ecommerce/File 2/storefront
2026-10-13 12:59:47 +05:30

28 lines
939 B
Python

import os
from pathlib import Path
from app.storage.storage_provider import StorageProvider
class LocalStorageProvider(StorageProvider):
def __init__(self, base_upload_dir: str = "uploads"):
self.base_dir = Path(base_upload_dir)
self.base_dir.mkdir(parents=True, exist_ok=True)
def save_file(self, file_bytes: bytes, filename: str, folder: str) -> str:
target_dir = self.base_dir / folder
target_dir.mkdir(parents=True, exist_ok=True)
target_file = target_dir / filename
target_file.write_bytes(file_bytes)
# Return path relative to project root
return str(target_file)
def delete_file(self, storage_path: str) -> bool:
p = Path(storage_path)
if p.exists() and p.is_file():
try:
os.remove(p)
return True
except OSError:
return False
return False