2020-12-04 23:41:26 +01:00
|
|
|
package db
|
2016-01-05 00:32:53 +01:00
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
2018-03-27 22:12:47 +02:00
|
|
|
//User is the model for an entity which has access to the API
|
2016-01-05 00:32:53 +01:00
|
|
|
type User struct {
|
2016-03-19 00:23:03 +01:00
|
|
|
ID int `db:"id" json:"id"`
|
2016-01-05 00:32:53 +01:00
|
|
|
Created time.Time `db:"created" json:"created"`
|
2016-04-10 20:03:12 +02:00
|
|
|
Username string `db:"username" json:"username" binding:"required"`
|
|
|
|
Name string `db:"name" json:"name" binding:"required"`
|
|
|
|
Email string `db:"email" json:"email" binding:"required"`
|
2021-05-06 14:41:31 +02:00
|
|
|
Password string `db:"password" json:"-"` // password hash
|
2017-07-26 07:55:34 +02:00
|
|
|
Admin bool `db:"admin" json:"admin"`
|
2017-03-27 06:53:00 +02:00
|
|
|
External bool `db:"external" json:"external"`
|
2017-03-10 01:12:55 +01:00
|
|
|
Alert bool `db:"alert" json:"alert"`
|
2016-01-05 00:32:53 +01:00
|
|
|
}
|
2021-03-12 22:13:39 +01:00
|
|
|
|
2021-08-28 13:44:41 +02:00
|
|
|
// UserWithPwd extends User structure with field for unhashed password received from JSON.
|
2021-03-12 22:13:39 +01:00
|
|
|
type UserWithPwd struct {
|
2021-08-28 13:44:41 +02:00
|
|
|
Pwd string `db:"-" json:"password"` // unhashed password from JSON
|
2021-03-12 22:13:39 +01:00
|
|
|
User
|
|
|
|
}
|
2021-10-12 13:37:51 +02:00
|
|
|
|
|
|
|
func ValidateUsername(login string) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|