Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/missionmatch / internal/modules/commandcenter/handler.go |
| Date | Not specified in source |
| Repository | Janady13/missionmatch |
| Revision | 1675031db74316e100782d063e9eda1a597fe3a1 |
| Branch | workstream-a-opportunity-intelligence |
| Path or archive member | internal/modules/commandcenter/handler.go |
| Original SHA-256 | da96430a22a7121080b125071164de9afc16b97765a12f7b8a2f7e13f6669600 |
| Git blob SHA | 4fbfb9c523d516d6499b9fe12e60387fc45df8fb |
| Reading-copy SHA-256 | da96430a22a7121080b125071164de9afc16b97765a12f7b8a2f7e13f6669600 |
Every recorded occurrence
These 3 records contain identical original source bytes. Their paths and revisions remain part of the archive.
| Original record | Branch or archive | Revision / identifier | Original location |
|---|---|---|---|
| Janady13/missionmatch / internal/modules/commandcenter/handler.go | workstream-a-opportunity-intelligence | 1675031db74316e100782d063e9eda1a597fe3a1 | Open original |
| Janady13/missionmatch / internal/modules/commandcenter/handler.go | workstream-b-sam-contract-awards | d5101cceb98e70000cebb31d3e7ac73d747d3a6d | Open original |
| Janady13/missionmatch / internal/modules/commandcenter/handler.go | workstream-a-opportunity-intelligence | 1675031db74316e100782d063e9eda1a597fe3a1 | Open original |
Recovered source transcript
Download complete source text ↓52 lines · 1.6 KB
package commandcenter
import (
"encoding/json"
"errors"
"net/http"
"time"
"github.com/go-chi/chi/v5"
"github.com/missionworkforce/missionmatch/internal/platform/security"
"github.com/missionworkforce/missionmatch/internal/platform/tenant"
)
// Handler serves the Workforce Command Center endpoint.
type Handler struct{ svc *Service }
func NewHandler(svc *Service) *Handler { return &Handler{svc: svc} }
// Routes mounts GET /command-center under the tenant scoped group, gated on candidate.read since the
// payload exposes candidate names and clearance (the same data class as GET /candidates).
func (h *Handler) Routes(r chi.Router) {
r.With(security.RequireCapability(security.CapCandidateRead)).Get("/command-center", h.get)
}
func (h *Handler) get(w http.ResponseWriter, r *http.Request) {
asOf := h.svc.clock()
if q := r.URL.Query().Get("as_of"); q != "" {
if t, err := time.Parse("2006-01-02", q); err == nil {
asOf = t
}
}
v, err := h.svc.CommandCenter(r.Context(), asOf)
if err != nil {
w.Header().Set("Content-Type", "application/json")
switch {
case errors.Is(err, tenant.ErrNoTenant):
w.WriteHeader(http.StatusForbidden)
_, _ = w.Write([]byte(`{"error":"no validated tenant"}`))
case errors.Is(err, ErrNoDatabase):
w.WriteHeader(http.StatusServiceUnavailable)
_, _ = w.Write([]byte(`{"error":"database not configured"}`))
default:
w.WriteHeader(http.StatusInternalServerError)
_, _ = w.Write([]byte(`{"error":"internal error"}`))
}
return
}
w.Header().Set("Content-Type", "application/json")
_ = json.NewEncoder(w).Encode(v)
}