@@ -67,6 +67,7 @@ func (h *dashboardHandler) Mux() *http.ServeMux {
6767 mux .HandleFunc ("/sessions/{id}/triage_log" , errToStatus (h .sessionTriageLog ))
6868 mux .HandleFunc ("/sessions/{id}/test_logs" , errToStatus (h .sessionTestLog ))
6969 mux .HandleFunc ("/sessions/{id}/test_artifacts" , errToStatus (h .sessionTestArtifacts ))
70+ mux .HandleFunc ("/series/{id}/all_patches" , errToStatus (h .allPatches ))
7071 mux .HandleFunc ("/series/{id}" , errToStatus (h .seriesInfo ))
7172 mux .HandleFunc ("/patches/{id}" , errToStatus (h .patchContent ))
7273 mux .HandleFunc ("/findings/{id}/{key}" , errToStatus (h .findingInfo ))
@@ -301,6 +302,28 @@ func (h *dashboardHandler) patchContent(w http.ResponseWriter, r *http.Request)
301302 return h .streamBlob (w , patch .BodyURI )
302303}
303304
305+ // nolint:dupl
306+ func (h * dashboardHandler ) allPatches (w http.ResponseWriter , r * http.Request ) error {
307+ ctx := r .Context ()
308+ series , err := h .seriesRepo .GetByID (ctx , r .PathValue ("id" ))
309+ if err != nil {
310+ return fmt .Errorf ("failed to query series: %w" , err )
311+ } else if series == nil {
312+ return fmt .Errorf ("%w: series" , errNotFound )
313+ }
314+ patches , err := h .seriesRepo .ListPatches (ctx , series )
315+ if err != nil {
316+ return fmt .Errorf ("failed to query patches: %w" , err )
317+ }
318+ for _ , patch := range patches {
319+ err = h .streamBlob (w , patch .BodyURI )
320+ if err != nil {
321+ return err
322+ }
323+ }
324+ return nil
325+ }
326+
304327func (h * dashboardHandler ) findingInfo (w http.ResponseWriter , r * http.Request ) error {
305328 finding , err := h .findingRepo .GetByID (r .Context (), r .PathValue ("id" ))
306329 if err != nil {
0 commit comments