up
This commit is contained in:
+15
-7
@@ -9,13 +9,14 @@ import (
|
||||
|
||||
type OssApi struct {
|
||||
gorm.Model
|
||||
Name string `gorm:"size:100;not null" json:"name"` // Alias o nombre interno
|
||||
Endpoint string `gorm:"not null" json:"endpoint"` // Endpoint del access point
|
||||
AccessKeyID string `gorm:"not null" json:"access_key_id"` // Access Key ID
|
||||
AccessKeySecret string `gorm:"not null" json:"access_key_secret"` // Access Key Secret
|
||||
BucketName string `gorm:"not null" json:"bucket_name"` // Nombre del bucket o access point
|
||||
Region string `gorm:"size:50" json:"region"` // Región, opcional
|
||||
IsActive bool `gorm:"default:true" json:"is_active"` // Activar o desactivar config
|
||||
Name string `gorm:"size:100;not null" json:"name"` // Alias o nombre interno
|
||||
Provider string `gorm:"size:20;default:alibaba" json:"provider"` // alibaba | s3
|
||||
Endpoint string `gorm:"not null" json:"endpoint"` // Endpoint del access point
|
||||
AccessKeyID string `gorm:"not null" json:"access_key_id"` // Access Key ID
|
||||
AccessKeySecret string `gorm:"not null" json:"access_key_secret"` // Access Key Secret
|
||||
BucketName string `gorm:"not null" json:"bucket_name"` // Nombre del bucket o access point
|
||||
Region string `gorm:"size:50" json:"region"` // Región, opcional
|
||||
IsActive bool `gorm:"default:true" json:"is_active"` // Activar o desactivar config
|
||||
Notes string `gorm:"type:text" json:"notes"`
|
||||
}
|
||||
|
||||
@@ -84,6 +85,13 @@ func GetOssApiByID(id uint) (*OssApi, error) {
|
||||
return &item, nil
|
||||
}
|
||||
|
||||
// GetActiveOssApis obtiene todas las configuraciones activas
|
||||
func GetActiveOssApis() ([]OssApi, error) {
|
||||
var items []OssApi
|
||||
err := app.Http.Database.DB.Where("is_active = ?", true).Order("id DESC").Find(&items).Error
|
||||
return items, err
|
||||
}
|
||||
|
||||
// GetLastActiveOssApi obtiene el último registro activo
|
||||
func GetLastActiveOssApi() (*OssApi, error) {
|
||||
var ossConfig OssApi
|
||||
|
||||
Reference in New Issue
Block a user