refactor: code refactor
feat: added missing update and detele apis
This commit is contained in:
+24
-1
@@ -3,9 +3,10 @@ from fastapi import APIRouter, Request
|
||||
from services.clinicServices import ClinicServices
|
||||
from schemas.UpdateSchemas import ClinicStatusUpdate
|
||||
from schemas.ApiResponse import ApiResponse
|
||||
from schemas.BaseSchemas import CreateSuperAdmin, MasterAppointmentTypeBase, ClinicOffersBase
|
||||
from schemas.BaseSchemas import MasterAppointmentTypeBase, ClinicOffersBase
|
||||
from services.authService import AuthService
|
||||
from services.masterAppointmentServices import MasterAppointmentServices
|
||||
from schemas.CreateSchemas import CreateSuperAdmin, UpdateSuperAdmin
|
||||
from utils.constants import DEFAULT_LIMIT, DEFAULT_PAGE
|
||||
|
||||
router = APIRouter()
|
||||
@@ -22,6 +23,16 @@ def create_user(req:Request, user_data: CreateSuperAdmin):
|
||||
AuthService().create_super_admin(req.state.user, user_data)
|
||||
return ApiResponse(data="OK", message="User created successfully")
|
||||
|
||||
@router.put("/user/{user_id}")
|
||||
def update_user(req:Request, user_id: int, user_data: UpdateSuperAdmin):
|
||||
AuthService().update_super_admin(req.state.user, user_id, user_data)
|
||||
return ApiResponse(data="OK", message="User updated successfully")
|
||||
|
||||
@router.delete("/user/{user_id}")
|
||||
def delete_user(req:Request, user_id: int):
|
||||
AuthService().delete_super_admin(req.state.user, user_id)
|
||||
return ApiResponse(data="OK", message="User deleted successfully")
|
||||
|
||||
|
||||
@router.get("/")
|
||||
def get_users(req:Request, limit:int = DEFAULT_LIMIT, page:int = DEFAULT_PAGE, search:str = ""):
|
||||
@@ -37,6 +48,18 @@ def create_master_data(appointment_type: MasterAppointmentTypeBase):
|
||||
return ApiResponse(data="OK", message="Master data created successfully")
|
||||
|
||||
|
||||
@router.delete("/master-data/{master_appointment_type_id}")
|
||||
def delete_master_data(master_appointment_type_id: int):
|
||||
MasterAppointmentServices().delete_master_appointment_type(master_appointment_type_id)
|
||||
return ApiResponse(data="OK", message="Master data deleted successfully")
|
||||
|
||||
|
||||
@router.put("/master-data/{master_appointment_type_id}")
|
||||
def update_master_data(master_appointment_type_id: int, appointment_type: MasterAppointmentTypeBase):
|
||||
MasterAppointmentServices().update_master_appointment_type(master_appointment_type_id, appointment_type)
|
||||
return ApiResponse(data="OK", message="Master data updated successfully")
|
||||
|
||||
|
||||
@router.get("/master-data")
|
||||
def get_master_data():
|
||||
appointment_types = MasterAppointmentServices().get_master_appointment_types()
|
||||
|
||||
Reference in New Issue
Block a user