chore: build
ci-api / test (push) Failing after 8m7s
ci-web / test (push) Failing after 5m5s

This commit is contained in:
Xor290
2026-09-20 12:18:33 +02:00
parent 8f4c7fa47a
commit 919c807004
174 changed files with 9669 additions and 1308 deletions
@@ -31,14 +31,14 @@ func NewAdminHandler(service *Service, cookieSecure bool) *AdminHandler {
}
type loginRequest struct {
Email string `json:"email" binding:"required,email"`
Username string `json:"username" binding:"required"`
Password string `json:"password" binding:"required"`
}
type authUserResponse struct {
ID uuid.UUID `json:"id"`
Email string `json:"email"`
Role string `json:"role"`
ID uuid.UUID `json:"id"`
Username string `json:"username"`
Role string `json:"role"`
}
type accessTokenResponse struct {
@@ -53,7 +53,7 @@ func (h *AdminHandler) Login(c *gin.Context) {
return
}
pair, user, err := h.service.Login(c.Request.Context(), security.AudienceAdmin, users.RoleAdmin, req.Email, req.Password)
pair, user, err := h.service.Login(c.Request.Context(), security.AudienceAdmin, users.RoleAdmin, req.Username, req.Password)
if err != nil {
h.respondLoginError(c, err)
return
@@ -62,7 +62,7 @@ func (h *AdminHandler) Login(c *gin.Context) {
h.setRefreshCookie(c, pair.RefreshToken)
c.JSON(http.StatusOK, accessTokenResponse{
AccessToken: pair.AccessToken,
User: &authUserResponse{ID: user.ID, Email: user.Email, Role: user.Role},
User: &authUserResponse{ID: user.ID, Username: user.Username, Role: user.Role},
})
}
@@ -107,7 +107,7 @@ func (h *AdminHandler) Me(c *gin.Context) {
c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to load user"})
return
}
c.JSON(http.StatusOK, authUserResponse{ID: user.ID, Email: user.Email, Role: user.Role})
c.JSON(http.StatusOK, authUserResponse{ID: user.ID, Username: user.Username, Role: user.Role})
}
func (h *AdminHandler) respondLoginError(c *gin.Context, err error) {