feat: track imported accounts per upstream key across platforms

Add upstream_key_account_links table mapping generated keys to remote
accounts per website/platform, surface imported_accounts on key
responses, and update website sync/routers to manage the links.
This commit is contained in:
liujing
2026-07-23 17:52:58 +08:00
parent ee89cd6119
commit df7e400e7b
17 changed files with 1081 additions and 537 deletions
+7 -3
View File
@@ -469,6 +469,10 @@ def test_import_auto_priority_by_rate(db_session, monkeypatch):
def __init__(self, **kwargs): pass
def __enter__(self): return self
def __exit__(self, *a): pass
def get_groups(self, *args, **kwargs):
return [{"id": "TG1", "name": "TG1", "platform": "openai"}]
def list_accounts(self):
return []
def create_account(self, body):
created_accounts.append(body)
return {"id": f"remote-{len(created_accounts)}", "name": body["name"]}
@@ -616,12 +620,12 @@ def test_priority_sync_fetches_remote_accounts_and_backfills_info(db_session, mo
def __exit__(self, *a): pass
def list_accounts(self):
return [
{"id": "A1", "name": "SmartUp-A1-Name", "priority": 15},
{"id": "A2", "name": "SmartUp-A2-Name", "priority": 25},
{"id": "A1", "name": "SmartUp-A1-Name", "priority": 15, "platform": "openai"},
{"id": "A2", "name": "SmartUp-A2-Name", "priority": 25, "platform": "openai"},
]
def get_groups(self, *args, **kwargs):
return [
{"id": "TG1", "name": "TG1-Readable-Group-Name"}
{"id": "TG1", "name": "TG1-Readable-Group-Name", "platform": "openai"}
]
def update_account(self, account_id, data):
update_calls.append((account_id, data))