General clean up of everything.
This commit is contained in:
@@ -4,13 +4,15 @@ from fastapi import APIRouter, Body, Depends, Header, HTTPException, Query, stat
|
||||
from pydantic import BaseModel, EmailStr, Field
|
||||
from typing import Dict, List, Optional, Set, Union
|
||||
|
||||
from ..lib_general import *
|
||||
from ..log import *
|
||||
from ..lib_general import log, logging
|
||||
#from ..log import *
|
||||
from app.config import settings
|
||||
from app.db_sql import *
|
||||
|
||||
from .api_crud import delete_obj_template, get_obj_template, get_obj_li_template, patch_obj_template, post_obj_template
|
||||
|
||||
from ..methods.organization_methods import load_organization_obj
|
||||
|
||||
from ..models.organization_models import Organization_Base
|
||||
from ..models.response_models import *
|
||||
|
||||
@@ -43,8 +45,8 @@ async def post_organization_obj(
|
||||
|
||||
@router.patch('/{obj_id}', response_model=Resp_Body_Base)
|
||||
async def patch_organization_obj(
|
||||
obj: Organization_Base,
|
||||
obj_id: str = Query(..., min_length=1, max_length=22),
|
||||
obj: Organization_Base = None,
|
||||
x_account_id: Optional[str] = Header(..., ),
|
||||
return_obj: Optional[bool] = True,
|
||||
by_alias: Optional[bool] = True,
|
||||
@@ -90,24 +92,25 @@ async def get_organization_obj_li(
|
||||
return result
|
||||
|
||||
|
||||
@router.get('/{obj_id}', response_model=Resp_Body_Base)
|
||||
@router.get('/{organization_id}', response_model=Resp_Body_Base)
|
||||
async def get_organization_obj(
|
||||
obj_id: str = Query(..., min_length=1, max_length=22),
|
||||
organization_id: str = Query(..., min_length=1, max_length=22),
|
||||
inc_address: bool = False,
|
||||
inc_contact: bool = False,
|
||||
x_account_id: str = Header(...),
|
||||
by_alias: Optional[bool] = True,
|
||||
exclude_unset: Optional[bool] = True,
|
||||
by_alias: bool = True,
|
||||
exclude_unset: bool = True,
|
||||
):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
|
||||
obj_type = 'organization'
|
||||
result = get_obj_template(
|
||||
obj_type=obj_type,
|
||||
obj_id=obj_id,
|
||||
by_alias=True,
|
||||
exclude_unset=True,
|
||||
)
|
||||
return result
|
||||
organization_obj = load_organization_obj(
|
||||
organization_id=organization_id,
|
||||
inc_contact=inc_contact,
|
||||
inc_address=inc_address,
|
||||
).dict(by_alias=by_alias, exclude_unset=exclude_unset)
|
||||
data = organization_obj
|
||||
return mk_resp(data=organization_obj)
|
||||
|
||||
|
||||
@router.delete('/{obj_id}', response_model=Resp_Body_Base)
|
||||
|
||||
Reference in New Issue
Block a user