notification.go 566 B

1234567891011121314151617181920212223242526
  1. package models
  2. import "gorm.io/gorm"
  3. type NotificationConfig struct {
  4. gorm.Model
  5. Enabled bool `gorm:"default:true"` // if notifications are enabled at all
  6. Success bool `gorm:"default:true"`
  7. Failure bool `gorm:"default:true"`
  8. }
  9. type NotificationConfigExternal struct {
  10. Enabled bool `json:"enabled"`
  11. Success bool `json:"success"`
  12. Failure bool `json:"failure"`
  13. }
  14. func (conf *NotificationConfig) Externalize() *NotificationConfigExternal {
  15. return &NotificationConfigExternal{
  16. Enabled: conf.Enabled,
  17. Success: conf.Success,
  18. Failure: conf.Failure,
  19. }
  20. }