diff --git a/src/models.go b/src/models.go index b7f5310..51893d3 100644 --- a/src/models.go +++ b/src/models.go @@ -6,10 +6,10 @@ import "time" type Connection struct { ID int `gorm:"primary_key"` ClientID string `gorm:"client_id type:varchar(70);not null;unique" json:"clientId,omitempty"` - APIKEY string `gorm:"api_key type:varchar(100);not null" json:"api_key,omitempty" binding:"required"` - APIURL string `gorm:"api_url type:varchar(255);not null" json:"api_url,omitempty" binding:"required,validatecrmurl"` - MGURL string `gorm:"mg_url type:varchar(255);not null;" json:"mg_url,omitempty"` - MGToken string `gorm:"mg_token type:varchar(100);not null;unique" json:"mg_token,omitempty"` + APIKEY string `gorm:"api_key type:varchar(100);not null" json:"api_key,omitempty" binding:"required,max=100"` + APIURL string `gorm:"api_url type:varchar(255);not null" json:"api_url,omitempty" binding:"required,validatecrmurl,max=255"` + MGURL string `gorm:"mg_url type:varchar(255);not null;" json:"mg_url,omitempty" binding:"max=255"` + MGToken string `gorm:"mg_token type:varchar(100);not null;unique" json:"mg_token,omitempty" binding:"max=100"` CreatedAt time.Time UpdatedAt time.Time Active bool `json:"active,omitempty"` @@ -21,10 +21,10 @@ type Bot struct { ID int `gorm:"primary_key"` ConnectionID int `gorm:"connection_id" json:"connectionId,omitempty"` Channel uint64 `gorm:"channel;not null;unique" json:"channel,omitempty"` - ChannelSettingsHash string `gorm:"channel_settings_hash type:varchar(70)"` - Token string `gorm:"token type:varchar(100);not null;unique" json:"token,omitempty"` - Name string `gorm:"name type:varchar(40)" json:"name,omitempty"` - Lang string `gorm:"lang type:varchar(2)" json:"lang,omitempty"` + ChannelSettingsHash string `gorm:"channel_settings_hash type:varchar(70)" binding:"max=70"` + Token string `gorm:"token type:varchar(100);not null;unique" json:"token,omitempty" binding:"max=100"` + Name string `gorm:"name type:varchar(40)" json:"name,omitempty" binding:"max=40"` + Lang string `gorm:"lang type:varchar(2)" json:"lang,omitempty" binding:"max=2"` CreatedAt time.Time UpdatedAt time.Time } @@ -33,8 +33,8 @@ type Bot struct { type User struct { ID int `gorm:"primary_key"` ExternalID int `gorm:"external_id;not null;unique"` - UserPhotoURL string `gorm:"user_photo_url type:varchar(255)"` - UserPhotoID string `gorm:"user_photo_id type:varchar(100)"` + UserPhotoURL string `gorm:"user_photo_url type:varchar(255)" binding:"max=255"` + UserPhotoID string `gorm:"user_photo_id type:varchar(100)" binding:"max=100"` CreatedAt time.Time UpdatedAt time.Time } diff --git a/templates/form.html b/templates/form.html index 988f6fa..708098b 100644 --- a/templates/form.html +++ b/templates/form.html @@ -12,12 +12,12 @@