Create logic and endpoint for confirming report location
This commit is contained in:
parent
b0fce4f363
commit
c7dd53b6eb
6 changed files with 63 additions and 18 deletions
|
|
@ -134,3 +134,14 @@ func getMailerUpdate(ctx context.Context, r *http.Request) (*html.Response[conte
|
|||
},
|
||||
), nil
|
||||
}
|
||||
|
||||
type formMailerConfirm struct{}
|
||||
|
||||
func postMailerConfirm(ctx context.Context, r *http.Request, form formMailerConfirm) (string, *nhttp.ErrorWithStatus) {
|
||||
log.Info().Msg("Fake confirm location")
|
||||
public_id := chi.URLParam(r, "public_id")
|
||||
if public_id == "" {
|
||||
return "", nhttp.NewErrorStatus(http.StatusBadRequest, "No 'public_id' in the url params")
|
||||
}
|
||||
return config.MakeURLReport("/mailer/%s/evidence", public_id), nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ func Router() chi.Router {
|
|||
r.Get("/email/unsubscribe/report/{report_id}", getEmailReportUnsubscribe)
|
||||
r.Get("/image/{uuid}", getImageByUUID)
|
||||
r.Get("/mailer/{public_id}", html.MakeGet(getMailer))
|
||||
r.Get("/mailer/{public_id}/confirm", html.MakeGet(getMailerConfirm))
|
||||
r.Post("/mailer/{public_id}/confirm", html.MakePost(postMailerConfirm))
|
||||
r.Get("/mailer/{public_id}/contribute", html.MakeGet(getMailerContribute))
|
||||
r.Get("/mailer/{public_id}/evidence", html.MakeGet(getMailerEvidence))
|
||||
r.Get("/mailer/{public_id}/schedule", html.MakeGet(getMailerSchedule))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue