Initial commit: Robot ökoszisztéma v2.0 - Stabilizált jármű és szerviz robotok
This commit is contained in:
26
code-server-config/data/User/History/-26d8d76b/70Kc.py
Executable file
26
code-server-config/data/User/History/-26d8d76b/70Kc.py
Executable file
@@ -0,0 +1,26 @@
|
||||
from fastapi import APIRouter, Depends, HTTPException, status
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from typing import List
|
||||
|
||||
# --- JAVÍTÁS ITT ---
|
||||
# Régi (hibás): from app.core.database import get_db
|
||||
# Új (helyes):
|
||||
from app.db.session import get_db
|
||||
# -------------------
|
||||
|
||||
from app.schemas.social import ServiceProviderCreate, ServiceProviderResponse
|
||||
from app.services.social_service import SocialService
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@router.post("/", response_model=ServiceProviderResponse, status_code=status.HTTP_201_CREATED)
|
||||
async def create_provider(
|
||||
provider: ServiceProviderCreate,
|
||||
db: AsyncSession = Depends(get_db),
|
||||
user_id: int = 1
|
||||
):
|
||||
return await SocialService.create_service_provider(db, provider, user_id)
|
||||
|
||||
@router.get("/", response_model=List[ServiceProviderResponse])
|
||||
async def list_providers(db: AsyncSession = Depends(get_db)):
|
||||
return await SocialService.get_all_providers(db)
|
||||
Reference in New Issue
Block a user