feat(provider): add status and banning mechanism

Introduce fields for managing provider status (active, auto_disabled,
manual_disabled) and banning logic.

- Add Status, AutoBan, BanReason, and BanUntil to Provider model and DTO
- Update CreateProvider handler to process new fields with defaults
- Extend sync service to propagate status and ban information in snapshots
- Serialize BanUntil as Unix timestamp for sync compatibility
This commit is contained in:
zenfun
2025-12-12 23:40:18 +08:00
parent eaf99e1582
commit 2407afe0e6
4 changed files with 96 additions and 39 deletions

View File

@@ -1,11 +1,17 @@
package dto
import "time"
// 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"`
Group string `json:"group"`
Models []string `json:"models"` // List of supported model names
Name string `json:"name"`
Type string `json:"type"`
BaseURL string `json:"base_url"`
APIKey string `json:"api_key"`
Group string `json:"group"`
Models []string `json:"models"` // List of supported model names
Status string `json:"status"`
AutoBan *bool `json:"auto_ban,omitempty"`
BanReason string `json:"ban_reason,omitempty"`
BanUntil time.Time `json:"ban_until,omitempty"`
}