Ajit Panday commited on
Commit
30d5632
·
1 Parent(s): 62d9331

Fix duplicate customer list endpoint and update response models

Browse files
Files changed (2) hide show
  1. app/auth.py +1 -1
  2. main.py +0 -26
app/auth.py CHANGED
@@ -12,7 +12,7 @@ from .settings import (
12
  )
13
  from .database import get_db
14
  from .models import Customer as CustomerModel
15
- from .schemas import Customer as CustomerSchema
16
 
17
  # Password hashing
18
  pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
 
12
  )
13
  from .database import get_db
14
  from .models import Customer as CustomerModel
15
+ from .schemas import Customer as CustomerSchema, CustomerCreate
16
 
17
  # Password hashing
18
  pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
main.py CHANGED
@@ -352,32 +352,6 @@ async def health_check(db: Session = Depends(get_db)):
352
  detail=f"Database connection error: {str(e)}"
353
  )
354
 
355
- @app.get("/api/v1/customers", response_model=List[Customer])
356
- async def list_customers(
357
- db: Session = Depends(get_db),
358
- current_admin: str = Depends(get_current_admin)
359
- ):
360
- """List all customers"""
361
- try:
362
- customers = db.query(CustomerModel).all()
363
- return [
364
- Customer(
365
- id=customer.id,
366
- name=customer.name,
367
- company_name=customer.company_name,
368
- email=customer.email,
369
- api_key=customer.api_key,
370
- is_active=customer.is_active,
371
- created_at=customer.created_at,
372
- updated_at=customer.updated_at
373
- ) for customer in customers
374
- ]
375
- except Exception as e:
376
- raise HTTPException(
377
- status_code=500,
378
- detail=f"Failed to list customers: {str(e)}"
379
- )
380
-
381
  if __name__ == "__main__":
382
  import uvicorn
383
  host = os.getenv("HOST", "0.0.0.0")
 
352
  detail=f"Database connection error: {str(e)}"
353
  )
354
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
355
  if __name__ == "__main__":
356
  import uvicorn
357
  host = os.getenv("HOST", "0.0.0.0")