feat(handler):lab4 add AttachmentHandler.Get
This commit is contained in:
@@ -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))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user