Saving current progress with change from using Query() to Path()

This commit is contained in:
Scott Idem
2024-04-26 14:51:11 -04:00
parent b37f14d25c
commit f4eda34035
67 changed files with 236 additions and 236 deletions

View File

@@ -1,5 +1,5 @@
import datetime
from fastapi import APIRouter, Body, Depends, Header, HTTPException, Query, Response, status
from fastapi import APIRouter, Body, Depends, Header, HTTPException, Path, Query, Response, status
from pydantic import BaseModel, EmailStr, Field
from typing import Dict, List, Optional, Set, Union
@@ -47,7 +47,7 @@ async def post_order_obj(
# NOTE 2021-08-09: Use with rework of order_cart
@router.patch('/order/{obj_id}', response_model=Resp_Body_Base)
async def patch_order_obj(
obj_id: str = Query(..., min_length=1, max_length=22),
obj_id: str = Path(min_length=11, max_length=22),
obj: Order_Base = None,
x_account_id: Optional[str] = Header(..., ),
return_obj: Optional[bool] = True,
@@ -78,7 +78,7 @@ async def patch_order_obj(
# NOTE: The router needs to have the prefix (/order) removed.
@router.patch('/order/{order_id}/line/add', response_model=Resp_Body_Base)
async def patch_order_obj_line_add(
order_id: str = Query(..., min_length=1, max_length=22),
order_id: str = Path(min_length=11, max_length=22),
obj: Order_Base = None,
x_account_id: Optional[str] = Header(..., ),
return_obj: Optional[bool] = True,
@@ -215,7 +215,7 @@ async def get_order_obj(
@router.get('/{obj_type}/{obj_id}/order/list', response_model=Resp_Body_Base)
async def get_obj_id_order_list(
obj_type: str = Query(..., min_length=4, max_length=25), # Expects account or person
obj_id: str = Query(..., min_length=11, max_length=22),
obj_id: str = Path(min_length=11, max_length=22),
from_datetime: datetime.datetime = None,
to_datetime: datetime.datetime = None,
inc_order_cfg: bool = False,
@@ -416,7 +416,7 @@ async def get_person_id_order_cart(
@router.delete('/order/{obj_id}', response_model=Resp_Body_Base)
async def delete_order_obj(
obj_id: str = Query(..., min_length=1, max_length=22),
obj_id: str = Path(min_length=11, max_length=22),
x_account_id: str = Header(...),
response: Response = Response,
):