Patch fetch_room_categories and fetch_gl_accounts to use central NewBook creds
These two endpoints were missed in the central settings migration. They now try the Settings service first and fall back to app-local system_config. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
7c8ea1af15
commit
3c66e777e4
1 changed files with 18 additions and 8 deletions
|
|
@ -280,10 +280,15 @@ async def fetch_room_categories(
|
|||
"""Fetch room categories from Newbook API site_list endpoint"""
|
||||
import httpx
|
||||
|
||||
api_key = await _get_config_value(db, "newbook_api_key")
|
||||
username = await _get_config_value(db, "newbook_username")
|
||||
password = await _get_config_value(db, "newbook_password")
|
||||
region = await _get_config_value(db, "newbook_region")
|
||||
from services.central_settings import get_newbook_credentials
|
||||
central = await get_newbook_credentials()
|
||||
if central:
|
||||
api_key, username, password, region = central["api_key"], central["username"], central["password"], central["region"]
|
||||
else:
|
||||
api_key = await _get_config_value(db, "newbook_api_key")
|
||||
username = await _get_config_value(db, "newbook_username")
|
||||
password = await _get_config_value(db, "newbook_password")
|
||||
region = await _get_config_value(db, "newbook_region")
|
||||
|
||||
if not all([api_key, username, password, region]):
|
||||
raise HTTPException(status_code=400, detail="Newbook credentials not configured")
|
||||
|
|
@ -468,10 +473,15 @@ async def fetch_gl_accounts(
|
|||
"""Fetch GL accounts from Newbook API gl_account_list endpoint"""
|
||||
import httpx
|
||||
|
||||
api_key = await _get_config_value(db, "newbook_api_key")
|
||||
username = await _get_config_value(db, "newbook_username")
|
||||
password = await _get_config_value(db, "newbook_password")
|
||||
region = await _get_config_value(db, "newbook_region")
|
||||
from services.central_settings import get_newbook_credentials
|
||||
central = await get_newbook_credentials()
|
||||
if central:
|
||||
api_key, username, password, region = central["api_key"], central["username"], central["password"], central["region"]
|
||||
else:
|
||||
api_key = await _get_config_value(db, "newbook_api_key")
|
||||
username = await _get_config_value(db, "newbook_username")
|
||||
password = await _get_config_value(db, "newbook_password")
|
||||
region = await _get_config_value(db, "newbook_region")
|
||||
|
||||
if not all([api_key, username, password, region]):
|
||||
raise HTTPException(status_code=400, detail="Newbook credentials not configured")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue