File size: 823 Bytes
a3386d3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from fastapi import APIRouter, Request
from src.config.appConfig import ENV_VAR
from src.helpers.response import ResponseHandler
from src.helpers.send_request import sendRequest

router = APIRouter()
AUTH_API_END = ENV_VAR.AUTH_API_END


@router.post("/send-otp")
async def send_otp_controller(req: Request):
    try:
        # Make the request to the authentication API endpoint
        response = sendRequest(
            f"{AUTH_API_END}/api/v1/mail/send-otp",
            "post",
            req,
            None,
            {"Content-Type": "application/json"},
        )
        # Handle the response using the ResponseHandler
        return ResponseHandler.success_mediator(response)
    except Exception as e:
        # Log and handle any exceptions
        print(e)
        return ResponseHandler.error(9999, e)