feat(handler):lab4 add AttachmentHandler.Get

This commit is contained in:
Голиков Maximillian Антон
2026-10-22 10:08:31 +03:00
parent c83f6c4a9b
commit 6db5900099
@@ -54,3 +54,20 @@ func (h *AttachmentHandler) Upload(c *gin.Context) {
}
c.JSON(http.StatusCreated, dto.AttachmentFromDomain(att))
}
func (h *AttachmentHandler) Get(c *gin.Context) {
me := middleware.CurrentUser(c)
attachmentID, err := parseUUIDPathParam(c, "attachment_id")
if err != nil {
respondError(c, err)
return
}
a, err := h.svc.Get(c.Request.Context(), me.ID, attachmentID)
if err != nil {
respondError(c, err)
return
}
c.JSON(http.StatusOK, dto.AttachmentFromDomain(a))
}