nquest/pkg/models/user.go

28 lines
484 B
Go
Raw Normal View History

2023-11-01 23:21:12 +03:00
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
)