refactor(correction to folder sturcture): before we got to deep resturctures to best pactice folder

This commit is contained in:
2025-08-01 15:54:20 -05:00
parent b6968b7b67
commit c775bb3354
32 changed files with 476 additions and 601 deletions

View File

@@ -0,0 +1,34 @@
package settings
import (
"gorm.io/gorm"
"lst.net/internal/models"
)
func UpdateSetting(db *gorm.DB, id string, input SettingUpdateInput) error {
var cfg models.Settings
if err := db.Where("setting_id =?", id).First(&cfg).Error; err != nil {
return err
}
updates := map[string]interface{}{}
if input.Description != nil {
updates["description"] = *input.Description
}
if input.Value != nil {
updates["value"] = *input.Value
}
if input.Enabled != nil {
updates["enabled"] = *input.Enabled
}
if input.AppService != nil {
updates["app_service"] = *input.AppService
}
if len(updates) == 0 {
return nil // nothing to update
}
return db.Model(&cfg).Updates(updates).Error
}