Update routes/account_management.py
Browse files
routes/account_management.py
CHANGED
@@ -6,9 +6,9 @@ router = APIRouter()
|
|
6 |
|
7 |
|
8 |
@router.post("/sign-in-up")
|
9 |
-
def handle_sign_in_up(
|
10 |
customer_id = next(
|
11 |
-
(entity['value'] for entity in
|
12 |
if customer_id:
|
13 |
customer = get_customer(customer_id)
|
14 |
if not customer:
|
@@ -21,13 +21,13 @@ def handle_sign_in_up(query: Query):
|
|
21 |
|
22 |
|
23 |
@router.post("/update-account")
|
24 |
-
def handle_update_account(
|
25 |
customer_id = next(
|
26 |
-
(entity['value'] for entity in
|
27 |
-
updates = {entity['entity']: entity['value'] for entity in
|
28 |
if customer_id:
|
29 |
update_customer(customer_id, updates)
|
30 |
return {"message": "Account information updated successfully"}
|
31 |
else:
|
32 |
raise HTTPException(
|
33 |
-
status_code=status.HTTP_404_NOT_FOUND, detail="Customer ID not provided.")
|
|
|
6 |
|
7 |
|
8 |
@router.post("/sign-in-up")
|
9 |
+
def handle_sign_in_up(input: Input):
|
10 |
customer_id = next(
|
11 |
+
(entity['value'] for entity in input.entities if entity['entity'] == 'customer_id'), None)
|
12 |
if customer_id:
|
13 |
customer = get_customer(customer_id)
|
14 |
if not customer:
|
|
|
21 |
|
22 |
|
23 |
@router.post("/update-account")
|
24 |
+
def handle_update_account(input: Input):
|
25 |
customer_id = next(
|
26 |
+
(entity['value'] for entity in input.entities if entity['entity'] == 'customer_id'), None)
|
27 |
+
updates = {entity['entity']: entity['value'] for entity in input.entities}
|
28 |
if customer_id:
|
29 |
update_customer(customer_id, updates)
|
30 |
return {"message": "Account information updated successfully"}
|
31 |
else:
|
32 |
raise HTTPException(
|
33 |
+
status_code=status.HTTP_404_NOT_FOUND, detail="Customer ID not provided.")
|