feat: add user search

This commit is contained in:
Krispire Admin
2026-05-31 10:53:37 +05:30
parent 0969887008
commit d3ad443fde
4 changed files with 118 additions and 1 deletions
+6 -1
View File
@@ -475,12 +475,17 @@ func (s *Server) setupRouter() {
})
})
// User profile + avatar — all protected.
// User profile — mixed public-read + protected writes.
r.Route("/users", func(r chi.Router) {
if s.userH == nil {
r.HandleFunc("/*", s.authUnavailable)
return
}
// Public read — search by handle / name. Returns a
// sanitized payload (no email / role / plan / etc.).
r.Get("/search", s.userH.Search)
// Protected writes — profile edit, avatar presign,
// reading-prefs roaming.
r.Group(func(r chi.Router) {
r.Use(middleware.RequireAuth(s.authIssuer, s.userRepo))
r.Patch("/me", s.userH.UpdateProfile)