-
Notifications
You must be signed in to change notification settings - Fork 2
/
models.go
27 lines (23 loc) · 955 Bytes
/
models.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package user
import (
"time"
"github.com/lib/pq"
)
// User represents someone with access to our system.
type User struct {
ID string `db:"user_id" json:"id"`
Name string `db:"name" json:"name"`
Email string `db:"email" json:"email"`
Roles pq.StringArray `db:"roles" json:"roles"`
PasswordHash []byte `db:"password_hash" json:"-"`
DateCreated time.Time `db:"date_created" json:"dateCreated"`
DateUpdated time.Time `db:"date_updated" json:"dateUpdated"`
}
// NewUser contains information needed to create a new User.
type NewUser struct {
Name string `json:"name" validate:"required"`
Email string `json:"email" validate:"required"`
Roles []string `json:"roles" validate:"required"`
Password string `json:"password" validate:"required"`
PasswordConfirm string `json:"password_confirm" validate:"eqfield=Password"`
}