mirror of
https://github.com/EZ-Api/ez-api.git
synced 2026-01-13 17:47:51 +00:00
feat(provider): add google project and location fields
Add support for Google Cloud-specific configuration in provider models. New fields `GoogleProject` and `GoogleLocation` are now included in the Provider DTO, database model, API handlers, and sync service snapshots. - Extend Provider struct in model with gorm/json tags - Update ProviderDTO with omitempty JSON tags - Include fields in handler create/update logic with trim - Add fields to providerSnapshot for sync operations
This commit is contained in:
@@ -58,15 +58,17 @@ func (h *Handler) CreateProvider(c *gin.Context) {
|
||||
}
|
||||
|
||||
provider := model.Provider{
|
||||
Name: req.Name,
|
||||
Type: req.Type,
|
||||
BaseURL: req.BaseURL,
|
||||
APIKey: req.APIKey,
|
||||
Group: group,
|
||||
Models: strings.Join(req.Models, ","),
|
||||
Status: status,
|
||||
AutoBan: autoBan,
|
||||
BanReason: req.BanReason,
|
||||
Name: req.Name,
|
||||
Type: req.Type,
|
||||
BaseURL: req.BaseURL,
|
||||
APIKey: req.APIKey,
|
||||
GoogleProject: strings.TrimSpace(req.GoogleProject),
|
||||
GoogleLocation: strings.TrimSpace(req.GoogleLocation),
|
||||
Group: group,
|
||||
Models: strings.Join(req.Models, ","),
|
||||
Status: status,
|
||||
AutoBan: autoBan,
|
||||
BanReason: req.BanReason,
|
||||
}
|
||||
if !req.BanUntil.IsZero() {
|
||||
tu := req.BanUntil.UTC()
|
||||
@@ -133,6 +135,12 @@ func (h *Handler) UpdateProvider(c *gin.Context) {
|
||||
if req.APIKey != "" {
|
||||
update["api_key"] = req.APIKey
|
||||
}
|
||||
if strings.TrimSpace(req.GoogleProject) != "" {
|
||||
update["google_project"] = strings.TrimSpace(req.GoogleProject)
|
||||
}
|
||||
if strings.TrimSpace(req.GoogleLocation) != "" {
|
||||
update["google_location"] = strings.TrimSpace(req.GoogleLocation)
|
||||
}
|
||||
if req.Models != nil {
|
||||
update["models"] = strings.Join(req.Models, ",")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user