feat(worker): lab5 add retries, DLQ registry and manual replay endpoint
This commit is contained in:
@@ -92,3 +92,20 @@ func (h *AttachmentHandler) Content(c *gin.Context) {
|
||||
|
||||
c.DataFromReader(http.StatusOK, size, contentType, rc, nil)
|
||||
}
|
||||
|
||||
func (h *AttachmentHandler) Replay(c *gin.Context) {
|
||||
me := middleware.CurrentUser(c)
|
||||
|
||||
attachmentID, err := parseUUIDPathParam(c, "attachment_id")
|
||||
if err != nil {
|
||||
respondError(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
if err := h.svc.Replay(c.Request.Context(), me.ID, attachmentID); err != nil {
|
||||
respondError(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
c.Status(http.StatusAccepted)
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ func NewRouter(h Handlers, auth gin.HandlerFunc) *gin.Engine {
|
||||
protected.POST("/chats/:chat_id/attachments", h.Attachment.Upload)
|
||||
protected.GET("/attachments/:attachment_id", h.Attachment.Get)
|
||||
protected.GET("/attachments/:attachment_id/content", h.Attachment.Content)
|
||||
protected.POST("/attachments/:attachment_id/replay", h.Attachment.Replay)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user