Saving current progress with change from using Query() to Path()
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -26,7 +26,7 @@ router = APIRouter()
|
||||
@router.post('/v3/person/{person_id}/order', response_model=Resp_Body_Base)
|
||||
async def post_order_obj(
|
||||
order_obj: Order_Base,
|
||||
person_id: str = Query(..., min_length=11, max_length=22),
|
||||
person_id: str = Path(min_length=11, max_length=22),
|
||||
|
||||
inc_address: bool = False,
|
||||
inc_contact: bool = False,
|
||||
@@ -84,7 +84,7 @@ async def post_order_obj(
|
||||
# @router.patch('/v3/person/{person_id}/order/{order_id}', response_model=Resp_Body_Base)
|
||||
async def patch_order_obj(
|
||||
order_obj: Order_Base,
|
||||
order_id: str = Query(..., min_length=11, max_length=22),
|
||||
order_id: str = Path(min_length=11, max_length=22),
|
||||
# person_id: str = Query(None, min_length=11, max_length=22),
|
||||
|
||||
inc_address: bool = False,
|
||||
@@ -147,7 +147,7 @@ async def patch_order_obj(
|
||||
@router.patch('/v3/order/{order_id}/line/add', response_model=Resp_Body_Base)
|
||||
async def patch_order_obj_add_line(
|
||||
order_line_obj: Order_Line_Base,
|
||||
order_id: str = Query(..., min_length=11, max_length=22),
|
||||
order_id: str = Path(min_length=11, max_length=22),
|
||||
|
||||
# inc_order: bool = False,
|
||||
inc_order_line_list: bool = True,
|
||||
@@ -205,8 +205,8 @@ async def patch_order_obj_add_line(
|
||||
@router.patch('/v3/order/{order_id}/line/{order_line_id}/update', response_model=Resp_Body_Base)
|
||||
async def patch_order_obj_update_line(
|
||||
order_obj: Order_Line_Base,
|
||||
order_id: str = Query(..., min_length=11, max_length=22),
|
||||
order_line_id: str = Query(..., min_length=11, max_length=22),
|
||||
order_id: str = Path(min_length=11, max_length=22),
|
||||
order_line_id: str = Path(min_length=11, max_length=22),
|
||||
|
||||
# inc_order: bool = False,
|
||||
inc_order_line_list: bool = True,
|
||||
@@ -266,8 +266,8 @@ async def patch_order_obj_update_line(
|
||||
@router.patch('/v3/order/{order_id}/line/{order_line_id}/remove', response_model=Resp_Body_Base)
|
||||
async def patch_order_obj_remove_line(
|
||||
order_obj: Order_Line_Base,
|
||||
order_id: str = Query(..., min_length=11, max_length=22),
|
||||
order_line_id: str = Query(..., min_length=11, max_length=22),
|
||||
order_id: str = Path(min_length=11, max_length=22),
|
||||
order_line_id: str = Path(min_length=11, max_length=22),
|
||||
|
||||
# inc_order: bool = False,
|
||||
inc_order_line_list: bool = True,
|
||||
@@ -326,7 +326,7 @@ async def patch_order_obj_remove_line(
|
||||
@router.get('/v3/{for_obj_type}/{for_obj_id}/order/list', response_model=Resp_Body_Base)
|
||||
async def get_order_obj_li(
|
||||
for_obj_type: str = Query(..., min_length=2, max_length=50),
|
||||
for_obj_id: str = Query(..., min_length=11, max_length=22),
|
||||
for_obj_id: str = Path(min_length=11, max_length=22),
|
||||
order_status: str = 'complete',
|
||||
order_checkout_status: str = 'complete',
|
||||
from_datetime: datetime.datetime = None,
|
||||
@@ -394,7 +394,7 @@ async def get_order_obj_li(
|
||||
# Updated 2022-12-18
|
||||
@router.get('/v3/order/{order_id}', response_model=Resp_Body_Base)
|
||||
async def get_order_obj(
|
||||
order_id: str = Query(..., min_length=11, max_length=22),
|
||||
order_id: str = Path(min_length=11, max_length=22),
|
||||
|
||||
inc_address: bool = False,
|
||||
inc_contact: bool = False,
|
||||
@@ -439,7 +439,7 @@ async def get_order_obj(
|
||||
# Updated 2022-12-18
|
||||
@router.get('/v3/person/{person_id}/order/cart', response_model=Resp_Body_Base)
|
||||
async def get_person_id_order_cart(
|
||||
person_id: str = Query(..., min_length=11, max_length=22),
|
||||
person_id: str = Path(min_length=11, max_length=22),
|
||||
enabled: str = 'enabled',
|
||||
inc_order_line_list: bool = False,
|
||||
inc_order_cfg: bool = False,
|
||||
@@ -462,7 +462,7 @@ async def get_person_id_order_cart(
|
||||
# Updated 2022-01-18
|
||||
@router.delete('/v3/order/{order_id}', response_model=Resp_Body_Base)
|
||||
async def delete_order_obj(
|
||||
order_id: str = Query(..., min_length=11, max_length=22),
|
||||
order_id: str = Path(min_length=11, max_length=22),
|
||||
commons: Common_Route_Params = Depends(common_route_params),
|
||||
):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
|
||||
Reference in New Issue
Block a user