Code clean up. Bug fixes for person, user, contact, and address methods. Fix bug for get_account_id_w_for_type_id()
This commit is contained in:
@@ -1218,10 +1218,12 @@ def lookup_id_random_pop(
|
||||
|
||||
|
||||
# ### BEGIN ### API DB SQL Methods ### get_account_id_w_for_type_id() ###
|
||||
# Updated 2021-08-24
|
||||
# NOTE: This is only useful for a few tables that have account_id as a field or views that have it included.
|
||||
# address, contact, event, people, user
|
||||
# Updated 2022-01-07
|
||||
@logger_reset
|
||||
def get_account_id_w_for_type_id(
|
||||
for_type: str,
|
||||
for_type: str, # This is the table name
|
||||
for_id: int|str,
|
||||
) -> bool|int|None:
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
@@ -1235,9 +1237,9 @@ def get_account_id_w_for_type_id(
|
||||
data['for_id'] = for_id
|
||||
|
||||
sql = f"""
|
||||
SELECT `for`.id AS 'for_id', `for`.id_random AS 'for_id_random', `for`.account_id AS account_id
|
||||
FROM :for_type AS `for`
|
||||
WHERE `for`.id = :for_id
|
||||
SELECT `tbl`.id AS 'for_id', `tbl`.id_random AS 'for_id_random', `tbl`.account_id AS account_id
|
||||
FROM `{for_type}` AS `tbl`
|
||||
WHERE `tbl`.id = :for_id
|
||||
LIMIT 1;
|
||||
"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user