src.dualinventive.com/go/authentication-service/internal/domain/user.go

18 lines
713 B
Go

package domain
//User is a table structure definition
type User struct {
ID uint `gorm:"column:user_id;primary_key"`
Name string `gorm:"column:user_name"`
PasswordHash string `gorm:"column:password"`
Email string `gorm:"column:email"`
CompanyID uint `gorm:"column:company_id"`
Company Company `gorm:"foreignkey:ID;association_foreignkey:CompanyID;auto_preload"`
Roles []Role `gorm:"many2many:user_role_user;foreignkey:user_id;association_foreignkey:user_role_id;association_jointable_foreignkey:user_role_id;jointable_foreignkey:user_id;"` //nolint:lll
}
// TableName returns the name of the Users table
func (User) TableName() string {
return "user"
}