Working on all the routes, methods, and models.
This commit is contained in:
@@ -138,7 +138,9 @@ async def get_account_obj_new(
|
||||
inc_event_track_list: bool = False,
|
||||
inc_fundraising_cfg: bool = False,
|
||||
inc_hosted_file_list: bool = False,
|
||||
inc_hosted_file_link_list: bool = False,
|
||||
inc_journal_list: bool = False,
|
||||
inc_journal_entry_list: bool = False,
|
||||
# inc_membership: bool = False,
|
||||
inc_membership_cfg: bool = False,
|
||||
inc_membership_list: bool = False,
|
||||
@@ -158,24 +160,27 @@ async def get_account_obj_new(
|
||||
inc_product_list: bool = False,
|
||||
# inc_site: bool = False,
|
||||
inc_site_list: bool = False,
|
||||
inc_site_domain_list: bool = False,
|
||||
inc_user: bool = False,
|
||||
inc_user_list: bool = False,
|
||||
x_account_id: str = Header(...),
|
||||
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 account_id := redis_lookup_id_random(record_id_random=account_id, table_name='account'): pass
|
||||
else:
|
||||
return mk_resp(data=None, status_code=404)
|
||||
|
||||
if account_dict := load_account_obj(
|
||||
if account_result := load_account_obj(
|
||||
account_id = account_id,
|
||||
enabled = enabled,
|
||||
limit = limit,
|
||||
model_as_dict = True, # NOTE: returning model as a dict
|
||||
by_alias = by_alias,
|
||||
exclude_unset = exclude_unset,
|
||||
model_as_dict = False, # NOTE: returning model as a dict
|
||||
inc_account_cfg = inc_account_cfg,
|
||||
inc_address = inc_address,
|
||||
inc_address_list = inc_address_list,
|
||||
@@ -203,7 +208,9 @@ async def get_account_obj_new(
|
||||
inc_event_track_list = inc_event_track_list,
|
||||
inc_fundraising_cfg = inc_fundraising_cfg,
|
||||
inc_hosted_file_list = inc_hosted_file_list,
|
||||
inc_hosted_file_link_list = inc_hosted_file_link_list,
|
||||
inc_journal_list = inc_journal_list,
|
||||
inc_journal_entry_list = inc_journal_entry_list,
|
||||
# inc_membership = inc_membership,
|
||||
inc_membership_cfg = inc_membership_cfg,
|
||||
inc_membership_list = inc_membership_list,
|
||||
@@ -223,13 +230,33 @@ async def get_account_obj_new(
|
||||
inc_product_list = inc_product_list,
|
||||
# inc_site = inc_site,
|
||||
inc_site_list = inc_site_list,
|
||||
inc_site_domain_list = inc_site_domain_list,
|
||||
inc_user = inc_user,
|
||||
inc_user_list = inc_user_list,
|
||||
):
|
||||
if isinstance(account_dict, dict):
|
||||
response_data = account_dict
|
||||
if isinstance(account_result, dict):
|
||||
# log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.info('Result is a dict')
|
||||
response_data = account_result
|
||||
log.debug(response_data)
|
||||
else:
|
||||
response_data = account_dict
|
||||
# log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
# print('---------------------------')
|
||||
log.info('Result is probably an object model')
|
||||
response_data = account_result
|
||||
# print('---------------------------')
|
||||
log.debug(response_data)
|
||||
# log.debug(response_data.__fields_set__)
|
||||
# response_data.testing = 'this is a test'
|
||||
# log.debug(response_data.__fields_set__)
|
||||
# print('---------------------------')
|
||||
# log.debug(account_result.dict())
|
||||
# print('---------------------------')
|
||||
# # log.debug(account_result.dict(by_alias=False, exclude_unset=True)) # pylint: disable=no-member
|
||||
# log.debug(account_result.dict(by_alias=True, exclude_unset=False)) # pylint: disable=no-member
|
||||
# print('---------------------------')
|
||||
# log.debug(account_result.dict(by_alias=True, exclude_unset=True)) # pylint: disable=no-member
|
||||
# print('---------------------------')
|
||||
else:
|
||||
return mk_resp(data=False, status_code=400) # Bad Request
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ from app.models.event_registration_models import *
|
||||
from app.models.event_session_models import *
|
||||
from app.models.event_track_models import *
|
||||
from app.models.hosted_file_models import *
|
||||
from app.models.journal_models import *
|
||||
from app.models.journal_entry_models import *
|
||||
from app.models.membership_models import *
|
||||
from app.models.order_models import *
|
||||
@@ -77,7 +78,7 @@ obj_type_li['event_session'] = {'table_name': 'v_event_session', 'base_name': Ev
|
||||
obj_type_li['event_track'] = {'table_name': 'v_event_track', 'base_name': Event_Track_Base}
|
||||
obj_type_li['hosted_file'] = {'table_name': 'v_hosted_file', 'base_name': Hosted_File_Base}
|
||||
#obj_type_li['hosted_file_link'] = {'table_name': 'hosted_file_link', 'base_name': Hosted_File_Link_Base}
|
||||
#obj_type_li['journal'] = {'table_name': 'v_journal', 'base_name': Journal_Base}
|
||||
obj_type_li['journal'] = {'table_name': 'v_journal', 'base_name': Journal_Base}
|
||||
obj_type_li['journal_entry'] = {'table_name': 'v_journal_entry', 'base_name': Journal_Entry_Base}
|
||||
#obj_type_li['log'] = {'table_name': 'log', 'base_name': Log_Base} #'v_log'
|
||||
#obj_type_li['log_client_viewing'] = {'table_name': 'log_client_viewing', 'base_name': Log_Client_Viewing_Base}
|
||||
|
||||
@@ -5,9 +5,9 @@ from typing import Dict, List, Optional, Set, Union
|
||||
|
||||
from app.lib_general import log, logging
|
||||
from app.config import settings
|
||||
from app.db_sql import *
|
||||
from app.db_sql import sql_insert, sql_update, sql_insert_or_update, sql_select, sql_delete, redis_lookup_id_random
|
||||
|
||||
from .api_crud import delete_obj_template, get_obj_template, get_obj_li_template, patch_obj_template, post_obj_template
|
||||
from app.routers.api_crud import delete_obj_template, get_obj_template, get_obj_li_template, patch_obj_template, post_obj_template
|
||||
|
||||
from app.methods.contact_methods import load_contact_obj, update_contact_obj
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ 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 app.lib_general import *
|
||||
from app.lib_general import log, logging
|
||||
from app.config import settings
|
||||
from app.db_sql import sql_insert, sql_update, sql_insert_or_update, sql_select, sql_delete, redis_lookup_id_random
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ from typing import Dict, List, Optional, Set, Union
|
||||
|
||||
from app.lib_general import log, logging
|
||||
from app.config import settings
|
||||
from app.db_sql import *
|
||||
from app.db_sql import sql_insert, sql_update, sql_insert_or_update, sql_select, sql_delete, redis_lookup_id_random
|
||||
|
||||
from app.routers.api_crud import delete_obj_template, get_obj_template, get_obj_li_template, patch_obj_template, post_obj_template
|
||||
|
||||
|
||||
@@ -4,12 +4,11 @@ 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 app.lib_general import *
|
||||
from ..log import *
|
||||
from app.lib_general import log, logging
|
||||
from app.config import settings
|
||||
from app.db_sql import *
|
||||
from app.db_sql import sql_insert, sql_update, sql_insert_or_update, sql_select, sql_delete, redis_lookup_id_random
|
||||
|
||||
from .api_crud import delete_obj_template, get_obj_template, get_obj_li_template, patch_obj_template, post_obj_template
|
||||
from app.routers.api_crud import delete_obj_template, get_obj_template, get_obj_li_template, patch_obj_template, post_obj_template
|
||||
|
||||
from app.models.journal_models import Journal_Base
|
||||
from app.models.response_models import *
|
||||
|
||||
@@ -4,12 +4,11 @@ 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 app.lib_general import *
|
||||
from ..log import *
|
||||
from app.lib_general import log, logging
|
||||
from app.config import settings
|
||||
from app.db_sql import *
|
||||
from app.db_sql import sql_insert, sql_update, sql_insert_or_update, sql_select, sql_delete, redis_lookup_id_random
|
||||
|
||||
from .api_crud import delete_obj_template, get_obj_template, get_obj_li_template, patch_obj_template, post_obj_template
|
||||
from app.routers.api_crud import delete_obj_template, get_obj_template, get_obj_li_template, patch_obj_template, post_obj_template
|
||||
|
||||
from app.models.journal_entry_models import Journal_Entry_Base
|
||||
from app.models.response_models import *
|
||||
|
||||
Reference in New Issue
Block a user