27 lines
484 B
Go
27 lines
484 B
Go
package models
|
|
|
|
import (
|
|
"errors"
|
|
)
|
|
|
|
var (
|
|
ErrEmptyPassword = errors.New("empty password")
|
|
)
|
|
|
|
type User struct {
|
|
Model
|
|
Username string `gorm:"unique" json:"username"`
|
|
Email string `gorm:"unique" json:"email"`
|
|
Password string `json:"-"`
|
|
Team *TeamMember `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"team"`
|
|
Role UserRole `json:"role"`
|
|
}
|
|
|
|
type UserRole int
|
|
|
|
const (
|
|
RoleNotVerified UserRole = iota
|
|
RoleUser
|
|
RoleCreator
|
|
RoleAdmin
|
|
)
|