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:
jtricerolph 2026-07-05 09:26:49 +00:00
parent 7c8ea1af15
commit 3c66e777e4

View file

@ -280,6 +280,11 @@ async def fetch_room_categories(
"""Fetch room categories from Newbook API site_list endpoint""" """Fetch room categories from Newbook API site_list endpoint"""
import httpx import httpx
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") api_key = await _get_config_value(db, "newbook_api_key")
username = await _get_config_value(db, "newbook_username") username = await _get_config_value(db, "newbook_username")
password = await _get_config_value(db, "newbook_password") password = await _get_config_value(db, "newbook_password")
@ -468,6 +473,11 @@ async def fetch_gl_accounts(
"""Fetch GL accounts from Newbook API gl_account_list endpoint""" """Fetch GL accounts from Newbook API gl_account_list endpoint"""
import httpx import httpx
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") api_key = await _get_config_value(db, "newbook_api_key")
username = await _get_config_value(db, "newbook_username") username = await _get_config_value(db, "newbook_username")
password = await _get_config_value(db, "newbook_password") password = await _get_config_value(db, "newbook_password")