Files
Back_modulo_comercial/Back_comercial_iko/app/comercial/Main_comercial.py

18 lines
813 B
Python

from fastapi import APIRouter, Depends
from Back_comercial_iko.services.Comercial_service import ComercialService
from Back_comercial_iko.core.Response import ApiResponse
from Back_comercial_iko.core.HttpStatus import HttpStatus
from Back_comercial_iko.core.AuthTokenDoli import TokenDoliManager
from Back_comercial_iko.core.ExceptionHandler import db_error_response
router = APIRouter(prefix="/comercial", tags=["Comercial"])
@router.post("/create-project")
def create_project(data: dict, token_data: dict = Depends(TokenDoliManager.verify_header)):
try:
service = ComercialService()
result = service.create_project_commercial(data, token_data)
return ApiResponse.success(result, "Proyecto creado", HttpStatus.CREATED)
except Exception as e:
return db_error_response(e)