Saving current progress with change from using Query() to Path()
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import datetime
|
||||
#from datetime import datetime, time, timedelta
|
||||
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
|
||||
|
||||
@@ -46,7 +46,7 @@ async def post_archive_obj(
|
||||
|
||||
@router.patch('/archive/{obj_id}', response_model=Resp_Body_Base)
|
||||
async def patch_archive_obj(
|
||||
obj_id: str = Query(..., min_length=1, max_length=22),
|
||||
obj_id: str = Path(min_length=11, max_length=22),
|
||||
obj: Archive_Base = None,
|
||||
x_account_id: Optional[str] = Header(..., ),
|
||||
return_obj: Optional[bool] = True,
|
||||
@@ -99,7 +99,7 @@ async def get_archive_obj_li(
|
||||
# Working well as of 2021-11-01. Using as a template for other routes.
|
||||
@router.get('/archive/{archive_id}', response_model=Resp_Body_Base)
|
||||
async def get_archive_obj(
|
||||
archive_id: str = Query(..., min_length=11, max_length=22),
|
||||
archive_id: str = Path(min_length=11, max_length=22),
|
||||
enabled: str = 'enabled', # enabled, disabled, all
|
||||
hidden: str = 'not_hidden', # hidden, not_hidden, all
|
||||
# inc_address: bool = False, # Under archive and under contact
|
||||
@@ -139,7 +139,7 @@ async def get_archive_obj(
|
||||
|
||||
# @router.get('/archive/{obj_id}', response_model=Resp_Body_Base)
|
||||
# async def get_archive_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(...),
|
||||
# by_alias: Optional[bool] = True,
|
||||
# exclude_unset: Optional[bool] = True,
|
||||
@@ -160,7 +160,7 @@ async def get_archive_obj(
|
||||
|
||||
@router.delete('/archive/{obj_id}', response_model=Resp_Body_Base)
|
||||
async def delete_archive_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,
|
||||
):
|
||||
|
||||
Reference in New Issue
Block a user