sivarajbookmyservice commited on
Commit
19f03f8
·
1 Parent(s): 9e1c5c2

removed duplicate end point

Browse files
Files changed (1) hide show
  1. app/routers/appointment.py +0 -54
app/routers/appointment.py CHANGED
@@ -145,60 +145,6 @@ async def create_order(amount: float, currency: str = "INR", order_controller: O
145
  logger.error(f"❌ Failed to create Razorpay order: {e}")
146
  raise HTTPException(status_code=500, detail="Failed to create Razorpay order")
147
 
148
-
149
- @router.get(
150
- "/",
151
- response_model=dict,
152
- summary="Get customer appointments",
153
- description="Retrieve paginated list of appointments for the authenticated customer"
154
- )
155
- async def list_customer_appointments(
156
- limit: int = Query(10, ge=1, le=50),
157
- offset: int = Query(0, ge=0),
158
- status: Optional[str] = Query(None, description="Either 'active' or 'past'"),
159
- current_user: dict = Depends(get_current_user)
160
- ):
161
- # Extract customer_id from current_user token
162
-
163
- logger.info(f"Request received for list_customer_appointments with limit={limit}, offset={offset}, status={status}")
164
-
165
- customer_id = current_user.get("sub")
166
-
167
- logger.info(f"Fetching appointments for customer: {customer_id} with limit={limit}, offset={offset}, status={status}")
168
-
169
- if not customer_id:
170
- raise HTTPException(status_code=401, detail="Invalid token: missing customer ID")
171
-
172
- # ✅ Validate status input
173
- valid_statuses = {"active", "past"}
174
- if status and status.lower() not in valid_statuses:
175
- raise HTTPException(status_code=400, detail="Invalid status. Use 'active' or 'past'.")
176
-
177
- cache_key = settings.get_cache_key("appointments", customer_id, status, limit, offset)
178
-
179
- async def fetch_from_db():
180
- return await get_appointments_by_customer_id(
181
- customer_id=customer_id,
182
- limit=limit,
183
- offset=offset,
184
- status=status.lower() if status else None
185
- )
186
-
187
- try:
188
- response = await get_or_set_appointment_cache(
189
- cache_key,
190
- fetch_from_db,
191
- status=status.lower() if status else None
192
- )
193
- return {"data": response}
194
- except Exception as e:
195
- logger.error(f"Error in list_customer_appointments: {e}")
196
- raise HTTPException(
197
- status_code=500,
198
- detail={"message": "Failed to retrieve appointments", "error": str(e)}
199
- )
200
-
201
-
202
  @router.get(
203
  "",
204
  response_model=dict,
 
145
  logger.error(f"❌ Failed to create Razorpay order: {e}")
146
  raise HTTPException(status_code=500, detail="Failed to create Razorpay order")
147
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  @router.get(
149
  "",
150
  response_model=dict,