General clean up of everything.
This commit is contained in:
@@ -4,8 +4,8 @@ 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 *
|
||||
|
||||
@@ -45,8 +45,8 @@ async def post_account_obj(
|
||||
|
||||
@router.patch('/{obj_id}', response_model=Resp_Body_Base)
|
||||
async def patch_account_obj(
|
||||
obj: Account_Base,
|
||||
obj_id: str = Query(..., min_length=1, max_length=22),
|
||||
obj: Account_Base = None,
|
||||
x_account_id: Optional[str] = Header(..., ),
|
||||
return_obj: Optional[bool] = True,
|
||||
by_alias: Optional[bool] = True,
|
||||
@@ -136,7 +136,7 @@ async def get_account_cfg_obj(
|
||||
by_alias: Optional[bool] = True,
|
||||
exclude_unset: Optional[bool] = True,
|
||||
):
|
||||
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
|
||||
if sys_module:
|
||||
@@ -152,6 +152,6 @@ async def get_account_cfg_obj(
|
||||
by_alias=True,
|
||||
exclude_unset=True,
|
||||
)
|
||||
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
#log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(result)
|
||||
return result
|
||||
|
||||
@@ -4,7 +4,8 @@ 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 ..lib_general import log, logging
|
||||
#from ..log import *
|
||||
from app.config import settings
|
||||
from app.db_sql import *
|
||||
|
||||
@@ -45,8 +46,8 @@ async def post_address_obj(
|
||||
|
||||
@router.patch('/{obj_id}', response_model=Resp_Body_Base)
|
||||
async def patch_address_obj(
|
||||
obj: Address_Base,
|
||||
obj_id: str = Query(..., min_length=1, max_length=22),
|
||||
obj: Address_Base = None,
|
||||
x_account_id: Optional[str] = Header(..., ),
|
||||
return_obj: Optional[bool] = True,
|
||||
by_alias: Optional[bool] = True,
|
||||
|
||||
@@ -354,8 +354,8 @@ async def delete_obj(
|
||||
|
||||
|
||||
def post_obj_template(
|
||||
obj_type:str=None,
|
||||
data:dict=None,
|
||||
obj_type:str,
|
||||
data:dict,
|
||||
return_obj:bool=True,
|
||||
by_alias:bool=True,
|
||||
include: Optional[list] = [],
|
||||
@@ -393,9 +393,9 @@ def post_obj_template(
|
||||
|
||||
|
||||
def patch_obj_template(
|
||||
obj_type:str=None,
|
||||
data:dict=None,
|
||||
obj_id:str=None,
|
||||
obj_type:str,
|
||||
data:dict,
|
||||
obj_id:str,
|
||||
return_obj:bool=True,
|
||||
by_alias:bool=True,
|
||||
include: Optional[list] = [],
|
||||
@@ -478,8 +478,8 @@ def get_obj_li_template(
|
||||
|
||||
|
||||
def get_obj_template(
|
||||
obj_id: Union[int,str],
|
||||
obj_type: str = Query(None, max_length=50),
|
||||
obj_id: Optional[Union[int,str]] = None,
|
||||
by_alias: Optional[bool] = True,
|
||||
include: Optional[list] = [],
|
||||
exclude: Optional[list] = [],
|
||||
|
||||
@@ -4,7 +4,8 @@ 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 ..lib_general import log, logging
|
||||
#from ..log import *
|
||||
from app.config import settings
|
||||
from app.db_sql import *
|
||||
|
||||
@@ -42,8 +43,8 @@ async def post_contact_obj(
|
||||
|
||||
@router.patch('/{obj_id}', response_model=Resp_Body_Base)
|
||||
async def patch_contact_obj(
|
||||
obj: Contact_Base,
|
||||
obj_id: str = Query(..., min_length=1, max_length=22),
|
||||
obj: Contact_Base = None,
|
||||
x_account_id: Optional[str] = Header(..., ),
|
||||
return_obj: Optional[bool] = True,
|
||||
by_alias: Optional[bool] = True,
|
||||
@@ -69,12 +70,12 @@ async def patch_contact_obj(
|
||||
|
||||
@router.get('/list', response_model=Resp_Body_Base)
|
||||
async def get_contact_obj_li(
|
||||
for_obj_type: Optional[str] = Query(None, min_length=2, max_length=50),
|
||||
for_obj_id: Optional[str] = Query(None, min_length=1, max_length=22),
|
||||
group: Optional[str] = Query(None, min_length=2, max_length=50),
|
||||
for_obj_type: str = Query(None, min_length=2, max_length=50),
|
||||
for_obj_id: str = Query(None, min_length=1, max_length=22),
|
||||
group: str = Query(None, min_length=2, max_length=50),
|
||||
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.debug(locals())
|
||||
|
||||
@@ -4,8 +4,8 @@ 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 *
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ 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 *
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ 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 *
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -4,8 +4,8 @@ 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 *
|
||||
|
||||
@@ -45,8 +45,8 @@ async def post_person_obj(
|
||||
|
||||
@router.patch('/{obj_id}', response_model=Resp_Body_Base)
|
||||
async def patch_person_obj(
|
||||
obj: Person_Base,
|
||||
obj_id: str = Query(..., min_length=1, max_length=22),
|
||||
obj: Person_Base = None,
|
||||
x_account_id: Optional[str] = Header(..., ),
|
||||
return_obj: Optional[bool] = True,
|
||||
by_alias: Optional[bool] = True,
|
||||
@@ -92,12 +92,12 @@ async def get_person_obj_li(
|
||||
return result
|
||||
|
||||
|
||||
@router.get('/{obj_id}', response_model=Resp_Body_Base)
|
||||
@router.get('/{person_id}', response_model=Resp_Body_Base)
|
||||
async def get_person_obj(
|
||||
obj_id: str = Query(..., min_length=1, max_length=22),
|
||||
person_id: str = Query(..., min_length=1, max_length=22),
|
||||
x_account_id: str = Header(...),
|
||||
inc_contact: bool = False,
|
||||
inc_address: bool = False,
|
||||
inc_contact: bool = False,
|
||||
inc_organization: bool = False,
|
||||
by_alias: Optional[bool] = True,
|
||||
exclude_unset: Optional[bool] = True,
|
||||
@@ -105,23 +105,14 @@ async def get_person_obj(
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
|
||||
user_obj = load_person_obj(
|
||||
person_id=obj_id,
|
||||
person_obj = load_person_obj(
|
||||
person_id=person_id,
|
||||
inc_contact=inc_contact,
|
||||
inc_address=inc_address,
|
||||
inc_organization=inc_organization,
|
||||
).dict(by_alias=by_alias, exclude_unset=exclude_unset)
|
||||
data = user_obj
|
||||
return mk_resp(data=user_obj)
|
||||
|
||||
# obj_type = 'person'
|
||||
# result = get_obj_template(
|
||||
# obj_type=obj_type,
|
||||
# obj_id=obj_id,
|
||||
# by_alias=True,
|
||||
# exclude_unset=True,
|
||||
# )
|
||||
# return result
|
||||
data = person_obj
|
||||
return mk_resp(data=person_obj)
|
||||
|
||||
|
||||
@router.delete('/{obj_id}', response_model=Resp_Body_Base)
|
||||
|
||||
@@ -4,7 +4,8 @@ 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 ..lib_general import log, logging
|
||||
#from ..log import *
|
||||
from app.config import settings
|
||||
from app.db_sql import *
|
||||
|
||||
@@ -44,13 +45,13 @@ async def post_site_domain_obj(
|
||||
|
||||
@router.patch('/{obj_id}', response_model=Resp_Body_Base)
|
||||
async def patch_site_domain_obj(
|
||||
obj: Site_Domain_Base,
|
||||
obj_id: str = Query(..., min_length=1, max_length=22),
|
||||
obj: Site_Domain_Base = None,
|
||||
x_account_id: Optional[str] = Header(..., ),
|
||||
return_obj: Optional[bool] = True,
|
||||
by_alias: Optional[bool] = True,
|
||||
exclude_unset: Optional[bool] = True,
|
||||
exclude_none: Optional[bool] = True,
|
||||
x_account_id: str = Header(..., ),
|
||||
return_obj: bool = True,
|
||||
by_alias: bool = True,
|
||||
exclude_unset: bool = True,
|
||||
exclude_none: bool = True,
|
||||
):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
@@ -76,13 +77,13 @@ async def lookup_site_domain_obj(
|
||||
access_key: Optional[str] = None,
|
||||
referrer: Optional[str] = None,
|
||||
x_account_id: str = Header(...),
|
||||
by_alias: Optional[bool] = True,
|
||||
include: Optional[list] = [],
|
||||
exclude: Optional[list] = [],
|
||||
exclude_unset: Optional[bool] = True,
|
||||
exclude_none: Optional[bool] = True,
|
||||
by_alias: bool = True,
|
||||
#include: Optional[list] = [],
|
||||
#exclude: Optional[list] = [],
|
||||
exclude_unset: bool = True,
|
||||
exclude_none: bool = True,
|
||||
):
|
||||
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
|
||||
data = {}
|
||||
|
||||
@@ -4,8 +4,8 @@ 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, secure_hash_string, verify_secure_hash_string
|
||||
#from ..log import *
|
||||
from app.config import settings
|
||||
from app.db_sql import *
|
||||
|
||||
@@ -127,8 +127,8 @@ async def change_user_obj_password(
|
||||
|
||||
@router.patch('/{obj_id}', response_model=Resp_Body_Base)
|
||||
async def patch_user_obj(
|
||||
obj: User_Base,
|
||||
obj_id: str = Query(..., min_length=1, max_length=22),
|
||||
obj: User_Base = None,
|
||||
x_account_id: Optional[str] = Header(..., ),
|
||||
return_obj: Optional[bool] = True,
|
||||
by_alias: Optional[bool] = True,
|
||||
|
||||
@@ -4,8 +4,8 @@ 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 *
|
||||
|
||||
|
||||
Reference in New Issue
Block a user