Files
auth-service/internal/Dtos.go

38 lines
549 B
Go

package internal
type RegistrationUser struct {
Username string `json:"username"`
Password string `json:"password"`
}
const (
Student UserRole = iota
Teacher
Admin
)
type User struct {
Username string
Password string
UserRole UserRole
}
func (user *User) ChangeRole(userRole UserRole) {
user.UserRole = userRole
}
type UserRole int
func (role UserRole) String() string {
switch role {
case Student:
return "student"
case Teacher:
return "teacher"
case Admin:
return "admin"
default:
return "unknown"
}
}