mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-08 10:27:46 +08:00
fix(wallet): 删除与过期删除 API Key 时同步禁用关联钱包 (#315)
- 在 delete_user_api_key 和 delete_standalone_api_key 事务中,先将关联 wallets.status 更新为 disabled - 在过期 Key 自动清理流程中,删除前同步禁用对应钱包 - 保留 wallet 与交易流水,避免出现 orphaned 且 active 的钱包状态
This commit is contained in:
@@ -570,6 +570,13 @@ const DELETE_EXPIRED_API_KEY_SQL: &str = r#"
|
||||
DELETE FROM api_keys
|
||||
WHERE id = $1
|
||||
"#;
|
||||
const DISABLE_EXPIRED_API_KEY_WALLET_SQL: &str = r#"
|
||||
UPDATE wallets
|
||||
SET status = 'disabled',
|
||||
updated_at = NOW()
|
||||
WHERE api_key_id = $1
|
||||
AND status <> 'disabled'
|
||||
"#;
|
||||
const DISABLE_EXPIRED_API_KEY_SQL: &str = r#"
|
||||
UPDATE api_keys
|
||||
SET is_active = FALSE,
|
||||
|
||||
Reference in New Issue
Block a user