Add 'use main stack settings' toggle for third-party integration credentials
Each of Newbook, Resos, SambaPOS, SMTP, and Nextcloud now has a checkbox at the top of its credentials block. When enabled, the app reads auth credentials from the central stack settings service (SETTINGS_URL + STACK_INTERNAL_SECRET) and the local auth fields are grayed out. App-specific fields (base path, GL codes, keywords, sync intervals, etc.) remain editable regardless. Backend: new use_global_* columns on kitchen_settings, migration, global_settings_service with apply_global_overrides() for in-memory credential injection, GET /api/settings/global-status endpoint, and apply_global_overrides() called in test-connection endpoints and FileArchivalService. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
62417d59de
commit
d7898ba897
10 changed files with 356 additions and 34 deletions
|
|
@ -27,6 +27,7 @@ class SambaPOSSettingsResponse(BaseModel):
|
|||
sambapos_db_password_set: bool
|
||||
sambapos_tracked_categories: list[str]
|
||||
sambapos_excluded_items: list[str]
|
||||
use_global_sambapos: bool = False
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
|
@ -38,6 +39,7 @@ class SambaPOSSettingsUpdate(BaseModel):
|
|||
sambapos_db_name: str | None = None
|
||||
sambapos_db_username: str | None = None
|
||||
sambapos_db_password: str | None = None
|
||||
use_global_sambapos: bool | None = None
|
||||
|
||||
|
||||
class CategoryResponse(BaseModel):
|
||||
|
|
@ -91,7 +93,8 @@ async def get_sambapos_settings(
|
|||
sambapos_db_username=settings.sambapos_db_username,
|
||||
sambapos_db_password_set=bool(settings.sambapos_db_password),
|
||||
sambapos_tracked_categories=tracked_categories,
|
||||
sambapos_excluded_items=excluded_items
|
||||
sambapos_excluded_items=excluded_items,
|
||||
use_global_sambapos=settings.use_global_sambapos or False,
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -136,7 +139,8 @@ async def update_sambapos_settings(
|
|||
sambapos_db_username=settings.sambapos_db_username,
|
||||
sambapos_db_password_set=bool(settings.sambapos_db_password),
|
||||
sambapos_tracked_categories=tracked_categories,
|
||||
sambapos_excluded_items=excluded_items
|
||||
sambapos_excluded_items=excluded_items,
|
||||
use_global_sambapos=settings.use_global_sambapos or False,
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -154,6 +158,9 @@ async def test_sambapos_connection(
|
|||
if not settings:
|
||||
raise HTTPException(status_code=404, detail="Settings not found")
|
||||
|
||||
from services.global_settings_service import apply_global_overrides
|
||||
await apply_global_overrides(settings)
|
||||
|
||||
if not all([
|
||||
settings.sambapos_db_host,
|
||||
settings.sambapos_db_name,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue