Yimaru-BackEnd/internal/domain/role.go

25 lines
429 B
Go

package domain
type Role string
const (
RoleSuperAdmin Role = "super_admin"
RoleAdmin Role = "admin"
RoleStudent Role = "student"
RoleInstructor Role = "instructor"
RoleSupport Role = "support"
)
func (r Role) IsValid() bool {
switch r {
case RoleSuperAdmin, RoleAdmin, RoleStudent, RoleInstructor, RoleSupport:
return true
default:
return false
}
}
func (r Role) Value() string {
return string(r)
}