Files
Docwell/Server/internal/httpapi/search.go
T
tajniak81andClaude Opus 5.5 ffc6cc4fbc Build out the admin panel
- Overview: users, organizations, workspaces, spaces, pages, files and
  storage (org admins see their organization), plus pages open right now,
  the search index size, and version, uptime and database health.
- Users: invite people by email (with resend, revoke and a copyable link
  when mail fails) and send a password-reset email.
- Authentication: sign-up on or off, the email-domain allow-list, and
  sign-in links by email.
- Branding: instance name, accent colour and logo. The web app shows them
  on the sign-in pages and applies the accent colour everywhere.
- Email and Storage: SMTP and S3 settings with test buttons.
- Maintenance: create, download and delete database backups, and a view
  of the background jobs with their last run, duration and errors.

On the server, a small jobs registry records each search-indexing pass,
and "search.rebuild" replaces the separate reindex endpoint. A new
instance package serves the dashboard numbers, health and backups.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 17:34:48 +01:00

27 lines
756 B
Go

// SPDX-License-Identifier: AGPL-3.0-or-later
package httpapi
import (
"context"
"net/http"
"strconv"
"docwell/server/internal/access"
"docwell/server/internal/directory"
)
// SearchService is the part of directory.Service that searches pages.
type SearchService interface {
Search(ctx context.Context, c access.Caller, wsID, text string, limit int) (directory.SearchResult, error)
}
func (a *api) searchRoutes(mux *routeMux) {
mux.HandleFunc("GET /api/v1/workspaces/{id}/search", a.requireUser(func(w http.ResponseWriter, r *http.Request) {
q := r.URL.Query()
limit, _ := strconv.Atoi(q.Get("limit"))
res, err := a.dir.Search(r.Context(), caller(r), r.PathValue("id"), q.Get("q"), min(max(limit, 0), 50))
a.respond(w, res, err)
}))
}