Инициализация проекта + первые наработки
This commit is contained in:
37
internal/Dtos.go
Normal file
37
internal/Dtos.go
Normal file
@@ -0,0 +1,37 @@
|
||||
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"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user