ThatAIguyA world of ideas

THE CONSCIOUSNESS ATLAS
Read. Experiment. Follow the evidence.

ConsciousnessLearn · Explore · Joseph Anady

Janady13/missionmatch / internal/modules/awards/handler.go

Source identity, revision, and recovered contents.

GitHub sourceSource text recovered

Source identity

FieldRecorded value
Source typeGitHub source
Original recordJanady13/missionmatch / internal/modules/awards/handler.go
DateNot specified in source
RepositoryJanady13/missionmatch
Revision720d47fae476b0d38477ae4401697d372b1ea2bc
Branchfeature/opportunity-to-outcome
Path or archive memberinternal/modules/awards/handler.go
Original SHA-256655fb796eee9b43d53f47afe07158168c745e08a0995fc7cfffdacba257ff506
Git blob SHAc995402d0704859ca1f7d444432c9eecf8078f40
Reading-copy SHA-256655fb796eee9b43d53f47afe07158168c745e08a0995fc7cfffdacba257ff506

Original source ↗

Every recorded occurrence

These 2 records contain identical original source bytes. Their paths and revisions remain part of the archive.

Original recordBranch or archiveRevision / identifierOriginal location
Janady13/missionmatch / internal/modules/awards/handler.gofeature/opportunity-to-outcome720d47fae476b0d38477ae4401697d372b1ea2bcOpen original
Janady13/missionmatch / internal/modules/awards/handler.gofeature/aioe-upgrade2178e7298d0e5d9af83afa12402fd587f0ba6ed8Open original

Recovered source transcript

package awards import ( "encoding/json" "errors" "net/http" "strconv" "strings" "github.com/go-chi/chi/v5" "github.com/missionworkforce/missionmatch/internal/platform/security" ) // Handler serves the cached awards read API. type Handler struct{ svc *Service } func NewHandler(svc *Service) *Handler { return &Handler{svc: svc} } // Routes mounts the awards endpoints under the /api group. // Routes mounts the cached federal award feed. Gated for the reason set out on the opportunity routes: // an endpoint should name its own authority rather than inherit it from where it is mounted. func (h *Handler) Routes(r chi.Router) { read := security.RequireCapability(security.CapCandidateRead) r.With(read).Get("/awards", h.incumbents) r.With(read).Get("/awards/galapagos", h.galapagos) } // incumbents returns the largest comparable awards for one or more NAICS codes. func (h *Handler) incumbents(w http.ResponseWriter, r *http.Request) { naics := multiVals(r, "naics") items, err := h.svc.Incumbents(r.Context(), naics, intParam(r, "limit", 0)) if err != nil { writeErr(w, err) return } writeJSON(w, http.StatusOK, items) } // galapagos returns Galapagos own past performance. func (h *Handler) galapagos(w http.ResponseWriter, r *http.Request) { items, err := h.svc.Galapagos(r.Context(), intParam(r, "limit", 0)) if err != nil { writeErr(w, err) return } writeJSON(w, http.StatusOK, items) } func multiVals(r *http.Request, key string) []string { var out []string for _, v := range r.URL.Query()[key] { for _, p := range strings.Split(v, ",") { if p = strings.TrimSpace(p); p != "" { out = append(out, p) } } } return out } func intParam(r *http.Request, key string, def int) int { if v := strings.TrimSpace(r.URL.Query().Get(key)); v != "" { if n, err := strconv.Atoi(v); err == nil { return n } } return def } func writeErr(w http.ResponseWriter, err error) { if errors.Is(err, ErrNoDatabase) { writeJSON(w, http.StatusServiceUnavailable, map[string]string{"error": "database not configured"}) return } writeJSON(w, http.StatusInternalServerError, map[string]string{"error": "internal error"}) } func writeJSON(w http.ResponseWriter, status int, v any) { w.Header().Set("Content-Type", "application/json") w.WriteHeader(status) _ = json.NewEncoder(w).Encode(v) }

Search equations, builds, manuscript text, and recovered sources.