feat: otp table

This commit is contained in:
2025-05-20 18:20:36 +05:30
parent 727d979145
commit eaa7519303
11 changed files with 180 additions and 32 deletions
+28 -4
View File
@@ -1,8 +1,10 @@
from fastapi import APIRouter
from fastapi import APIRouter, BackgroundTasks
from services.authService import AuthService
from schemas.CreateSchemas import UserCreate
from schemas.ApiResponse import ApiResponse
from schemas.BaseSchemas import AuthBase
from schemas.BaseSchemas import AuthBase, AuthOTP
from services.clinicServices import ClinicServices
from http import HTTPStatus
router = APIRouter()
@@ -16,9 +18,31 @@ def login(data: AuthBase):
@router.post("/register")
def register(user_data: UserCreate):
token = AuthService().register(user_data)
def register(user_data: UserCreate, background_tasks: BackgroundTasks):
token = AuthService().register(user_data, background_tasks)
return ApiResponse(
data=token,
message="User registered successfully"
)
@router.get("/clinic/latest-id")
def get_latest_clinic_id():
clinic_id = ClinicServices().get_latest_clinic_id()
return ApiResponse(
data=clinic_id,
message="Latest clinic ID retrieved successfully"
)
@router.post("/send-otp")
def send_otp(email: str):
AuthService().send_otp(email)
return HTTPStatus.OK
@router.post("/verify-otp")
def verify_otp(data: AuthOTP):
AuthService().verify_otp(data)
return ApiResponse(
data="OK",
message="OTP verified successfully"
)
-6
View File
@@ -30,12 +30,6 @@ async def get_clinics(
clinics = ClinicServices().get_clinics(req.state.user, limit, offset, filter_type, search)
return ApiResponse(data=clinics, message="Clinics retrieved successfully" )
@router.get("/latest-id")
async def get_latest_clinic_id():
clinic_id = ClinicServices().get_latest_clinic_id()
return ApiResponse(data=clinic_id, message="Latest clinic ID retrieved successfully")
@router.get("/verified-files/{clinic_id}")
async def get_verified_files(clinic_id: int):
clinic = ClinicServices().get_clinic_by_id(clinic_id)