Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/missionmatch / internal/modules/wages/handler.go |
| Date | Not specified in source |
| Repository | Janady13/missionmatch |
| Revision | 720d47fae476b0d38477ae4401697d372b1ea2bc |
| Branch | feature/opportunity-to-outcome |
| Path or archive member | internal/modules/wages/handler.go |
| Original SHA-256 | 6221eb08ab4496609e9cd43931b3deb3158382561b80e42b938cb6dd09ab0ff2 |
| Git blob SHA | ecb5e15b4ffedf2cd41d043138d9fc116e6366fd |
| Reading-copy SHA-256 | 6221eb08ab4496609e9cd43931b3deb3158382561b80e42b938cb6dd09ab0ff2 |
Every recorded occurrence
These 2 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/wages/handler.go | feature/opportunity-to-outcome | 720d47fae476b0d38477ae4401697d372b1ea2bc | Open original |
| Janady13/missionmatch / internal/modules/wages/handler.go | feature/aioe-upgrade | 2178e7298d0e5d9af83afa12402fd587f0ba6ed8 | Open original |
Recovered source transcript
Download complete source text ↓39 lines · 1.1 KB
package wages
import (
"encoding/json"
"errors"
"net/http"
"github.com/go-chi/chi/v5"
"github.com/missionworkforce/missionmatch/internal/platform/security"
)
// Handler serves the cached wage baseline read API.
type Handler struct{ svc *Service }
func NewHandler(svc *Service) *Handler { return &Handler{svc: svc} }
// Routes mounts the wages endpoint under the /api group.
// Routes mounts the cached wage baseline. Gated for the reason set out on the opportunity routes.
func (h *Handler) Routes(r chi.Router) {
r.With(security.RequireCapability(security.CapCandidateRead)).Get("/wages", h.baseline)
}
func (h *Handler) baseline(w http.ResponseWriter, r *http.Request) {
items, err := h.svc.Baseline(r.Context())
w.Header().Set("Content-Type", "application/json")
if err != nil {
if errors.Is(err, ErrNoDatabase) {
w.WriteHeader(http.StatusServiceUnavailable)
_, _ = w.Write([]byte(`{"error":"database not configured"}`))
return
}
w.WriteHeader(http.StatusInternalServerError)
_, _ = w.Write([]byte(`{"error":"internal error"}`))
return
}
_ = json.NewEncoder(w).Encode(items)
}