feat: Added basic user authorization

This commit is contained in:
2025-08-20 01:24:49 +03:00
parent b72066f19e
commit fb4902dea6
15 changed files with 396 additions and 2 deletions

27
dto/auth.go Normal file
View File

@@ -0,0 +1,27 @@
package dto
import (
"errors"
"net/http"
)
type LoginRequest struct {
Login string `json:"login"`
Password string `json:"password"`
}
func (l *LoginRequest) Bind(r *http.Request) error {
if l.Login == "" {
return errors.New("login required")
}
if l.Password == "" {
return errors.New("password required")
}
return nil
}
type LoginResponse struct {
AccessToken string `json:"accessToken"`
}