Инициализация проекта + первые наработки

This commit is contained in:
Ганеев Артём
2025-01-04 10:42:04 +03:00
commit def3552a67
8 changed files with 248 additions and 0 deletions

37
internal/Dtos.go Normal file
View 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"
}
}