fix: adopted_api_key_id konsistent als string key_id statt numerischer rowid
- CreateApiKey() gibt jetzt string key_id zurück statt long rowid - SetScannedKeyAdopted() erwartet string statt long - DeleteApiKey() direkter Vergleich statt Subquery - DB-Explorer: PageSize Default auf 1000 erhöht
This commit is contained in:
1 parent
ce50633e33
commit
e1a9117b4a
3 files changed
+7
-7
No files matched your search
@@ -367,14 +367,14 @@ public partial class DatabaseService
|
||||
}
|
||||
|
||||
|
||||
public async Task<long> CreateApiKey(ApiKeyRecord record)
|
||||
public async Task<string> CreateApiKey(ApiKeyRecord record)
|
||||
{
|
||||
using var conn = CreateConnection();
|
||||
await conn.ExecuteAsync(@"
|
||||
INSERT INTO api_keys (key_id, provider, name, api_key, is_public, status, plan, usage_7d, usage_5h, checked_at, source_url, created_at, updated_at)
|
||||
VALUES (@KeyId, @Provider, @Name, @ApiKey, @IsPublic, @Status, @Plan, @Usage7d, @Usage5h, @CheckedAt, @SourceUrl, @CreatedAt, @UpdatedAt)",
|
||||
record);
|
||||
return await conn.ExecuteScalarAsync<long>("SELECT last_insert_rowid()");
|
||||
return record.KeyId;
|
||||
}
|
||||
|
||||
public async Task UpdateApiKey(string keyId, string name, string apiKey = null)
|
||||
@@ -425,7 +425,7 @@ public partial class DatabaseService
|
||||
using var conn = CreateConnection();
|
||||
// Scanned-Keys die auf diesen API-Key verweisen zurücksetzen
|
||||
await conn.ExecuteAsync(
|
||||
"UPDATE scanned_keys SET adopted_api_key_id = NULL WHERE adopted_api_key_id = (SELECT id FROM api_keys WHERE key_id = @keyId)",
|
||||
"UPDATE scanned_keys SET adopted_api_key_id = NULL WHERE adopted_api_key_id = @keyId",
|
||||
new { keyId });
|
||||
// User die diesen Key ausgewählt haben zurücksetzen
|
||||
await conn.ExecuteAsync(
|
||||
@@ -505,7 +505,7 @@ public partial class DatabaseService
|
||||
new { scannedKeyId });
|
||||
}
|
||||
|
||||
public async Task SetScannedKeyAdopted(string scannedKeyId, long apiKeyId)
|
||||
public async Task SetScannedKeyAdopted(string scannedKeyId, string apiKeyId)
|
||||
{
|
||||
using var conn = CreateConnection();
|
||||
await conn.ExecuteAsync(
|
||||
|
||||
Reference in new issue
Block a user