Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Commit

Permalink
feat: Create Dlq job api witht testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Lifosmin Simon authored and Lifosmin Simon committed Oct 18, 2023
1 parent e4d8a69 commit 5644e8b
Show file tree
Hide file tree
Showing 6 changed files with 663 additions and 23 deletions.
8 changes: 6 additions & 2 deletions internal/server/v1/dlq/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/goto/dex/entropy"
"github.com/goto/dex/generated/models"
"github.com/goto/dex/internal/server/gcs"
"github.com/goto/dex/internal/server/reqctx"
"github.com/goto/dex/internal/server/utils"
"github.com/goto/dex/internal/server/v1/firehose"
)
Expand Down Expand Up @@ -65,6 +66,7 @@ func (*Handler) listDlqJobs(w http.ResponseWriter, _ *http.Request) {
func (h *Handler) createDlqJob(w http.ResponseWriter, r *http.Request) {
// transform request body into DlqJob (validation?)
ctx := r.Context()
reqCtx := reqctx.From(ctx)
var dlqJob models.DlqJob

if err := utils.ReadJSON(r, &dlqJob); err != nil {
Expand All @@ -73,13 +75,15 @@ func (h *Handler) createDlqJob(w http.ResponseWriter, r *http.Request) {
}

// call service.CreateDLQJob
resp, err := h.service.CreateDLQJob(ctx, &dlqJob)
err := h.service.CreateDLQJob(ctx, reqCtx.UserEmail, &dlqJob)
if err != nil {
utils.WriteErr(w, err)
return
}
// return
utils.WriteJSON(w, http.StatusOK, resp)
utils.WriteJSON(w, http.StatusOK, map[string]interface{}{
"dlq_list": dlqJob.Urn,
})
}

func (h *Handler) getDlqJob(w http.ResponseWriter, r *http.Request) {
Expand Down
Loading

0 comments on commit 5644e8b

Please sign in to comment.