mirror of
https://github.com/EZ-Api/ez-api.git
synced 2026-01-13 17:47:51 +00:00
feat(core): implement group-based routing and optimize sync
Replace direct provider linkage with group-based routing for Keys and Providers. This allows for more flexible load balancing and tiering strategies. Changes include: - Remove `ProviderID` from Key model and DTO - Add `Group` field to Key and Provider models - Refactor Redis sync to use Hashes for O(1) partial updates - Update API handlers to perform incremental syncs BREAKING CHANGE: Key API payload no longer accepts `provider_id`. Redis configuration storage format has changed from JSON strings to Hashes.
This commit is contained in:
@@ -2,9 +2,9 @@ package dto
|
||||
|
||||
// KeyDTO defines payload for key creation/update.
|
||||
type KeyDTO struct {
|
||||
ProviderID uint `json:"provider_id"`
|
||||
KeySecret string `json:"key_secret"`
|
||||
Balance float64 `json:"balance"`
|
||||
Status string `json:"status"`
|
||||
Weight int `json:"weight"`
|
||||
Group string `json:"group"`
|
||||
KeySecret string `json:"key_secret"`
|
||||
Balance float64 `json:"balance"`
|
||||
Status string `json:"status"`
|
||||
Weight int `json:"weight"`
|
||||
}
|
||||
|
||||
@@ -2,8 +2,9 @@ package dto
|
||||
|
||||
// ProviderDTO defines inbound payload for provider creation/update.
|
||||
type ProviderDTO struct {
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
BaseURL string `json:"base_url"`
|
||||
APIKey string `json:"api_key"`
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
BaseURL string `json:"base_url"`
|
||||
APIKey string `json:"api_key"`
|
||||
Group string `json:"group"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user