fix: change avatar upload response to JSON object with URL;
feat: add UrlDto for standardized URL responses; refactor: update avatar upload endpoint to return UrlDto; docs: regenerate Swagger; chore: add comments for untested profile controller methods
This commit is contained in:
@@ -89,6 +89,7 @@ func NewProfileController(_log *zap.Logger, _ps services.ProfileService) Control
|
||||
}
|
||||
}
|
||||
|
||||
// XXX: untested
|
||||
// @Summary Get your profile
|
||||
// @Tags Profile
|
||||
// @Accept json
|
||||
@@ -107,6 +108,7 @@ func (ctrl *ProfileController) getMyProfile(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, response)
|
||||
}
|
||||
|
||||
// XXX: untested
|
||||
// @Summary Get profile by username
|
||||
// @Tags Profile
|
||||
// @Accept json
|
||||
@@ -142,6 +144,7 @@ func (ctrl *ProfileController) getProfileByUsername(c *gin.Context) {
|
||||
panic("Not implemented")
|
||||
}
|
||||
|
||||
// XXX: untested
|
||||
// @Summary Get your profile settings
|
||||
// @Tags Profile
|
||||
// @Accept json
|
||||
@@ -160,6 +163,7 @@ func (ctrl *ProfileController) getProfileSettings(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, response)
|
||||
}
|
||||
|
||||
// XXX: untested
|
||||
// @Summary Update your profile
|
||||
// @Tags Profile
|
||||
// @Accept json
|
||||
@@ -181,6 +185,7 @@ func (ctrl *ProfileController) updateProfile(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, response)
|
||||
}
|
||||
|
||||
// XXX: untested
|
||||
// @Summary Update your profile's settings
|
||||
// @Tags Profile
|
||||
// @Accept json
|
||||
@@ -202,13 +207,14 @@ func (ctrl *ProfileController) updateProfileSettings(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, response)
|
||||
}
|
||||
|
||||
// XXX: untested
|
||||
// @Summary Upload an avatar
|
||||
// @Tags Profile
|
||||
// @Accept mpfd
|
||||
// @Produce plain
|
||||
// @Produce json
|
||||
// @Security JWT
|
||||
// @Param file formData file true "Avatar image file"
|
||||
// @Success 200 {object} string "Uploaded image url"
|
||||
// @Success 200 {object} dto.UrlDto "Uploaded image url"
|
||||
// @Router /profile/avatar [post]
|
||||
func (ctrl *ProfileController) uploadAvatar(c *gin.Context) {
|
||||
cinfo := GetClientInfo(c)
|
||||
@@ -228,5 +234,5 @@ func (ctrl *ProfileController) uploadAvatar(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
c.String(http.StatusOK, link)
|
||||
c.JSON(http.StatusOK, dto.UrlDto{Url: link})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user