Semaphore/db/User.go

29 lines
856 B
Go
Raw Normal View History

package db
2016-01-05 00:32:53 +01:00
import (
"time"
)
//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"`
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
Admin bool `db:"admin" json:"admin"`
External bool `db:"external" json:"external"`
Alert bool `db:"alert" json:"alert"`
2016-01-05 00:32:53 +01:00
}
// UserWithPwd extends User structure with field for unhashed password received from JSON.
type UserWithPwd struct {
2021-12-18 14:16:34 +01:00
Pwd string `db:"-" json:"password"` // unhashed password from JSON
User
}
2021-10-12 13:37:51 +02:00
2021-12-18 14:16:34 +01:00
func ValidateUser(user User) error {
2021-10-12 13:37:51 +02:00
return nil
}