feat(user): store users in Postgres with password hashes

This commit is contained in:
kk10
2026-10-04 22:49:42 +03:00
parent bbcde1e95e
commit 527c1748f8
4 changed files with 70 additions and 20 deletions
+7 -2
View File
@@ -37,7 +37,12 @@ func (h *UserHandler) Create(w http.ResponseWriter, r *http.Request) {
return
}
user, err := h.service.Create(req.Username, req.DisplayName)
user, err := h.service.Create(
r.Context(),
req.Username,
req.DisplayName,
req.Password,
)
if errors.Is(err, service.ErrUsernameTaken) {
httpx.WriteError(
w,
@@ -71,7 +76,7 @@ func (h *UserHandler) Me(w http.ResponseWriter, r *http.Request) {
requestID := middleware.GetRequestID(r.Context())
userID := middleware.GetUserID(r.Context())
user, err := h.service.GetByID(userID)
user, err := h.service.GetByID(r.Context(), userID)
if errors.Is(err, service.ErrUserNotFound) {
httpx.WriteError(
w,