This commit is contained in:
stefanodvx 2025-04-14 13:05:43 +02:00
parent 264c97183e
commit 3faede7b1c
74 changed files with 6228 additions and 1 deletions

37
database/settings.go Normal file
View file

@ -0,0 +1,37 @@
package database
import (
"govd/models"
)
func GetGroupSettings(
chatID int64,
) (*models.GroupSettings, error) {
var groupSettings models.GroupSettings
err := DB.
Where(&models.GroupSettings{
ChatID: chatID,
}).
FirstOrCreate(&groupSettings).
Error
if err != nil {
return nil, err
}
return &groupSettings, nil
}
func UpdateGroupSettings(
chatID int64,
settings *models.GroupSettings,
) error {
err := DB.
Where(&models.GroupSettings{
ChatID: chatID,
}).
Updates(settings).
Error
if err != nil {
return err
}
return nil
}