modified: main_dc/yalarba/api_yal/go.mod
modified: main_dc/yalarba/api_yal/go.sum modified: main_dc/yalarba/api_yal/internal/domain/auth/dto.go modified: main_dc/yalarba/api_yal/internal/domain/auth/handler.go modified: main_dc/yalarba/api_yal/internal/domain/auth/router.go modified: main_dc/yalarba/api_yal/internal/domain/auth/servcie.go new file: main_dc/yalarba/api_yal/internal/middleware/auth.go deleted: main_dc/yalarba/api_yal/internal/middleware/authMiddleware.go modified: main_dc/yalarba/api_yal/internal/router/router.go set auth domain, not tested
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package auth
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"errors"
|
||||
"time"
|
||||
)
|
||||
|
||||
// RegisterRequest - запрос на регистрацию
|
||||
type RegisterRequest struct {
|
||||
@@ -24,6 +27,22 @@ type AuthResponse struct {
|
||||
User UserInfo `json:"user"`
|
||||
}
|
||||
|
||||
// ResetPasswordRequest - запрос на сброс пароля
|
||||
type ResetPasswordRequest struct {
|
||||
Email string `json:"email" validate:"required,email"`
|
||||
}
|
||||
|
||||
// RefreshTokenRequest - запрос на обновление токена
|
||||
type RefreshTokenRequest struct {
|
||||
RefreshToken string `json:"refresh_token" validate:"required"`
|
||||
}
|
||||
|
||||
// ChangePasswordRequest - запрос на смену пароля
|
||||
type ChangePasswordRequest struct {
|
||||
OldPassword string `json:"old_password" validate:"required"`
|
||||
NewPassword string `json:"new_password" validate:"required,min=6"`
|
||||
}
|
||||
|
||||
// UserInfo информация о пользователе для ответа
|
||||
type UserInfo struct {
|
||||
ID uint `json:"id"`
|
||||
@@ -33,3 +52,9 @@ type UserInfo struct {
|
||||
FullName string `json:"full_name"`
|
||||
Role string `json:"role"`
|
||||
}
|
||||
|
||||
var (
|
||||
ErrUserNotFound = errors.New("user not found")
|
||||
ErrInvalidPassword = errors.New("invalid password")
|
||||
ErrUserAlreadyExists = errors.New("user with this email already exists")
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user