changed column type for new string field

pull/679/head v0.90.51
hunterlong 2020-06-15 16:04:10 -07:00
parent 780095cc84
commit feb20bfa4e
2 changed files with 14 additions and 21 deletions

View File

@ -11,7 +11,6 @@ import (
"net/http" "net/http"
"net/url" "net/url"
"strconv" "strconv"
"strings"
"time" "time"
) )
@ -145,8 +144,7 @@ func registerNews(email, domain string) error {
v.Set("email", email) v.Set("email", email)
v.Set("domain", domain) v.Set("domain", domain)
v.Set("timezone", "UTC") v.Set("timezone", "UTC")
rb := strings.NewReader(v.Encode()) resp, err := http.PostForm("https://news.statping.com/new", v)
resp, err := http.Post("https://news.statping.com/new", "application/x-www-form-urlencoded", rb)
if err != nil { if err != nil {
return err return err
} }

View File

@ -26,8 +26,8 @@ type Notification struct {
Enabled null.NullBool `gorm:"column:enabled;type:boolean;default:false" json:"enabled,omitempty"` Enabled null.NullBool `gorm:"column:enabled;type:boolean;default:false" json:"enabled,omitempty"`
Limits int `gorm:"not null;column:limits" json:"limits"` Limits int `gorm:"not null;column:limits" json:"limits"`
Removable bool `gorm:"column:removable" json:"removable"` Removable bool `gorm:"column:removable" json:"removable"`
SuccessData string `gorm:"not null;column:success_data" json:"success_data,omitempty"` SuccessData string `gorm:"type:text;not null;column:success_data" json:"success_data,omitempty"`
FailureData string `gorm:"not null;column:failure_data" json:"failure_data,omitempty"` FailureData string `gorm:"type:text;not null;column:failure_data" json:"failure_data,omitempty"`
DataType string `gorm:"-" json:"data_type,omitempty"` DataType string `gorm:"-" json:"data_type,omitempty"`
RequestInfo string `gorm:"-" json:"request_info,omitempty"` RequestInfo string `gorm:"-" json:"request_info,omitempty"`
CreatedAt time.Time `gorm:"column:created_at" json:"created_at"` CreatedAt time.Time `gorm:"column:created_at" json:"created_at"`
@ -41,12 +41,8 @@ type Notification struct {
Running chan bool `gorm:"-" json:"-"` Running chan bool `gorm:"-" json:"-"`
Form []NotificationForm `gorm:"-" json:"form"` Form []NotificationForm `gorm:"-" json:"form"`
Queue []RunFunc `gorm:"-" json:"-"`
lastSent time.Time `gorm:"-" json:"-"` lastSent time.Time `gorm:"-" json:"-"`
lastSentCount int `gorm:"-" json:"-"` lastSentCount int `gorm:"-" json:"-"`
Hits notificationHits `gorm:"-" json:"-"`
} }
func (n *Notification) Logger() *logrus.Logger { func (n *Notification) Logger() *logrus.Logger {
@ -64,8 +60,7 @@ type NotificationForm struct {
SmallText string `json:"small_text"` // insert small text under a html input SmallText string `json:"small_text"` // insert small text under a html input
Required bool `json:"required"` // require this input on the html form Required bool `json:"required"` // require this input on the html form
IsHidden bool `json:"hidden"` // hide this form element from end user IsHidden bool `json:"hidden"` // hide this form element from end user
IsList bool `json:"list"` // make this form element a comma separated list ListOptions []string `json:"list_options,omitempty"`
IsSwitch bool `json:"switch"` // make the notifier a boolean true/false switch
} }
type notificationHits struct { type notificationHits struct {