2019-05-06 01:40:41 +03:00
|
|
|
package models
|
|
|
|
|
|
|
|
type User struct {
|
2019-05-21 23:40:59 +03:00
|
|
|
ID string `json:"id" gorm:"primary_key"`
|
|
|
|
ApiKey string `json:"api_key" gorm:"unique"`
|
|
|
|
Password string `json:"-"`
|
2019-05-06 01:40:41 +03:00
|
|
|
}
|
2020-05-24 14:41:19 +03:00
|
|
|
|
|
|
|
type Login struct {
|
2020-05-24 17:34:32 +03:00
|
|
|
Username string `schema:"username"`
|
|
|
|
Password string `schema:"password"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type Signup struct {
|
|
|
|
Username string `schema:"username"`
|
|
|
|
Password string `schema:"password"`
|
|
|
|
PasswordRepeat string `schema:"password_repeat"`
|
2020-05-24 14:41:19 +03:00
|
|
|
}
|
2020-05-24 22:42:15 +03:00
|
|
|
|
|
|
|
func (s *Signup) IsValid() bool {
|
|
|
|
return len(s.Username) >= 3 &&
|
|
|
|
len(s.Password) >= 6 &&
|
|
|
|
s.Password == s.PasswordRepeat
|
|
|
|
}
|