Slow but steady progress to update all end points...
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
|
||||
|
||||
@@ -50,7 +50,7 @@ async def post_account_obj(
|
||||
@router.patch('/account/{obj_id}', response_model=Resp_Body_Base)
|
||||
async def patch_account_obj(
|
||||
obj: Account_Base,
|
||||
obj_id: str = Query(..., min_length=11, max_length=22),
|
||||
obj_id: str = Path(..., min_length=11, max_length=22),
|
||||
|
||||
return_obj: Optional[bool] = True,
|
||||
|
||||
@@ -149,7 +149,7 @@ async def get_account_obj_li(
|
||||
# Working well as of 2021-06-11. Using as a template for other routes.
|
||||
@router.get('/account/{account_id}', response_model=Resp_Body_Base)
|
||||
async def get_account_obj(
|
||||
account_id: str = Query(..., min_length=11, max_length=22),
|
||||
account_id: str = Path(..., min_length=11, max_length=22),
|
||||
inc_account_cfg: bool = False, # Priority l1
|
||||
inc_address: bool = False, # Under contact
|
||||
inc_address_list: bool = False,
|
||||
@@ -324,7 +324,7 @@ async def get_account_obj(
|
||||
|
||||
@router.delete('/account/{obj_id}', response_model=Resp_Body_Base)
|
||||
async def delete_account_obj(
|
||||
obj_id: str = Query(..., min_length=11, max_length=22),
|
||||
obj_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
|
||||
@@ -340,7 +340,7 @@ async def delete_account_obj(
|
||||
|
||||
@router.get('/account/{account_id}/cfg', response_model=Resp_Body_Base)
|
||||
async def get_account_cfg_obj(
|
||||
account_id: str = Query(..., min_length=11, max_length=22),
|
||||
account_id: str = Path(..., min_length=11, max_length=22),
|
||||
sys_module: Optional[str] = None, # event, fundraising, membership
|
||||
|
||||
commons: Common_Route_Params = Depends(common_route_params),
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -47,7 +47,7 @@ async def post_activity_log_obj(
|
||||
@router.patch('/activity_log/{activity_log_id}', response_model=Resp_Body_Base)
|
||||
async def patch_activity_log_obj(
|
||||
activity_log_obj: Activity_Log_Base,
|
||||
activity_log_id: str = Query(..., min_length=1, max_length=22),
|
||||
activity_log_id: str = Path(..., min_length=1, max_length=22),
|
||||
x_account_id: Optional[str] = Header(..., ),
|
||||
return_obj: Optional[bool] = True,
|
||||
by_alias: Optional[bool] = True,
|
||||
|
||||
@@ -241,7 +241,7 @@ async def post_api_obj(
|
||||
|
||||
@router.patch('/{obj_id}', response_model=Resp_Body_Base)
|
||||
async def patch_api_obj(
|
||||
obj_id: str = Query(..., min_length=1, max_length=22),
|
||||
obj_id: str,
|
||||
obj: Api_Base = None,
|
||||
x_account_id: Optional[str] = Header(..., ),
|
||||
return_obj: Optional[bool] = True,
|
||||
@@ -292,7 +292,7 @@ async def get_api_obj_li(
|
||||
|
||||
@router.get('/{obj_id}', response_model=Resp_Body_Base)
|
||||
async def get_api_obj(
|
||||
obj_id: str = Query(..., min_length=1, max_length=22),
|
||||
obj_id: str,
|
||||
x_account_id: str = Header(...),
|
||||
by_alias: Optional[bool] = True,
|
||||
exclude_unset: Optional[bool] = True,
|
||||
@@ -313,7 +313,7 @@ async def get_api_obj(
|
||||
|
||||
@router.delete('/{obj_id}', response_model=Resp_Body_Base)
|
||||
async def delete_api_obj(
|
||||
obj_id: str = Query(..., min_length=11, max_length=22),
|
||||
obj_id: str,
|
||||
x_account_id: str = Header(...),
|
||||
response: Response = Response,
|
||||
):
|
||||
@@ -330,8 +330,8 @@ async def delete_api_obj(
|
||||
|
||||
@router.get('/get_id/{object_type}/{object_id_random}', response_model=Resp_Body_Base)
|
||||
async def get_api_object_id(
|
||||
object_type: str = Query(..., min_length=1, max_length=50),
|
||||
object_id_random: str = Query(..., min_length=1, max_length=22),
|
||||
object_type: str,
|
||||
object_id_random: str,
|
||||
x_account_id: str = Header(...),
|
||||
by_alias: Optional[bool] = True,
|
||||
exclude_unset: Optional[bool] = True,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import datetime, json, time
|
||||
#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 fastapi.responses import FileResponse
|
||||
from pydantic import BaseModel, EmailStr, Field
|
||||
from typing import Dict, List, Optional, Set, Union
|
||||
@@ -199,9 +199,9 @@ router = APIRouter()
|
||||
@router.get('/{obj_type_l1}/{obj_type_l2}/list')
|
||||
@router.get('/{obj_type_l1}/{obj_type_l2}/{obj_type_l3}/list')
|
||||
async def get_obj_li(
|
||||
obj_type_l1: str,
|
||||
obj_type_l2: str = None,
|
||||
obj_type_l3: str = None,
|
||||
obj_type_l1: str = Path(min_length=2, max_length=50),
|
||||
obj_type_l2: str = Path(min_length=2, max_length=50),
|
||||
obj_type_l3: str = Path(min_length=2, max_length=50),
|
||||
|
||||
for_obj_type: Optional[str] = Query(None, max_length=50),
|
||||
for_obj_id: Optional[str] = Query(None, max_length=22),
|
||||
@@ -621,8 +621,8 @@ async def get_obj(
|
||||
@router.patch('/{obj_type_l1}/{obj_type_l2}/{obj_type_l3}/{obj_id}')
|
||||
async def patch_obj(
|
||||
crud: Api_Crud_Base,
|
||||
obj_type_l1: str,
|
||||
obj_id: str,
|
||||
obj_type_l1: str = Path(min_length=2, max_length=50),
|
||||
obj_id: str = Path(min_length=11, max_length=22),
|
||||
obj_type_l2: str = None,
|
||||
obj_type_l3: str = None,
|
||||
|
||||
@@ -813,7 +813,7 @@ async def patch_obj(
|
||||
@router.post('/{obj_type_l1}/{obj_type_l2}/{obj_type_l3}')
|
||||
async def post_obj(
|
||||
crud: Api_Crud_Base,
|
||||
obj_type_l1: Optional[str] = Query(..., max_length=50),
|
||||
obj_type_l1: Optional[str] = Path(..., max_length=50),
|
||||
obj_type_l2: str = None,
|
||||
obj_type_l3: str = None,
|
||||
# obj_id: str = Query(..., min_length=11, max_length=22),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import datetime, json, time
|
||||
#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 fastapi.responses import FileResponse
|
||||
# from pydantic import BaseModel, EmailStr, Field
|
||||
from typing import Dict, List, Optional, Set, Union
|
||||
@@ -23,9 +23,9 @@ router = APIRouter()
|
||||
@router.get('/{obj_type_l1}/{obj_type_l2}/list')
|
||||
@router.get('/{obj_type_l1}/{obj_type_l2}/{obj_type_l3}/list')
|
||||
async def get_obj_li(
|
||||
obj_type_l1: str = Query(..., min_length=2, max_length=50),
|
||||
obj_type_l2: str = Query(None, min_length=2, max_length=50),
|
||||
obj_type_l3: str = Query(None, min_length=2, max_length=50),
|
||||
obj_type_l1: str = Path(min_length=2, max_length=50),
|
||||
obj_type_l2: str = Path(min_length=2, max_length=50),
|
||||
obj_type_l3: str = Path(min_length=2, max_length=50),
|
||||
|
||||
for_obj_type: Optional[str] = Query(None, max_length=50),
|
||||
for_obj_id: Optional[str] = Query(None, max_length=22),
|
||||
@@ -464,10 +464,10 @@ async def get_obj(
|
||||
@router.patch('/{obj_type_l1}/{obj_type_l2}/{obj_type_l3}/{obj_id}')
|
||||
async def patch_obj(
|
||||
crud: Api_Crud_Base,
|
||||
obj_type_l1: Optional[str] = Query(..., max_length=50),
|
||||
obj_type_l1: str = Path(min_length=2, max_length=50),
|
||||
obj_id: str = Path(min_length=11, max_length=22),
|
||||
obj_type_l2: str = None,
|
||||
obj_type_l3: str = None,
|
||||
obj_id: str = Query(..., min_length=11, max_length=22),
|
||||
|
||||
run_safety_check: bool = True,
|
||||
|
||||
@@ -656,7 +656,7 @@ async def patch_obj(
|
||||
@router.post('/{obj_type_l1}/{obj_type_l2}/{obj_type_l3}')
|
||||
async def post_obj(
|
||||
crud: Api_Crud_Base,
|
||||
obj_type_l1: Optional[str] = Query(..., max_length=50),
|
||||
obj_type_l1: Optional[str] = Path(..., max_length=50),
|
||||
obj_type_l2: str = None,
|
||||
obj_type_l3: str = None,
|
||||
# obj_id: str = Query(..., min_length=11, max_length=22),
|
||||
|
||||
Reference in New Issue
Block a user