Merged in feature/e2etest (pull request #74)
Feature/e2etest * e2etest * testcleanups
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package queryservice
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/oapi-codegen/runtime/types"
|
||||
)
|
||||
|
||||
func (s *Controllers) ListDocumentsByJobId(ctx echo.Context, jobId types.UUID) error {
|
||||
documents, err := s.svc.Document.ListByJobId(ctx.Request().Context(), jobId)
|
||||
if err != nil {
|
||||
return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Unable to list documents: %s", err))
|
||||
}
|
||||
|
||||
docs := make([]Document, len(documents))
|
||||
for i, doc := range documents {
|
||||
docs[i] = Document{
|
||||
Id: doc.ID,
|
||||
Bucket: doc.Bucket,
|
||||
Key: doc.Key,
|
||||
}
|
||||
}
|
||||
|
||||
return ctx.JSON(http.StatusOK, docs)
|
||||
}
|
||||
Reference in New Issue
Block a user