2016-01-05 00:32:53 +01:00
|
|
|
package models
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
2016-03-18 23:03:28 +01:00
|
|
|
|
2016-05-24 11:55:48 +02:00
|
|
|
database "github.com/ansible-semaphore/semaphore/db"
|
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"`
|
2016-04-02 14:40:07 +02:00
|
|
|
Password string `db:"password" json:"-"`
|
2017-03-10 01:12:55 +01:00
|
|
|
Alert bool `db:"alert" json:"alert"`
|
2016-01-05 00:32:53 +01:00
|
|
|
}
|
2016-03-18 23:03:28 +01:00
|
|
|
|
|
|
|
func FetchUser(userID int) (*User, error) {
|
|
|
|
var user User
|
|
|
|
|
|
|
|
err := database.Mysql.SelectOne(&user, "select * from user where id=?", userID)
|
|
|
|
return &user, err
|
|
|
|
}
|