Ejemplo n.º 1
0
// @Title uploadImages
// @Description upload images to storage. Request should contain multipart form data.
// @Accept  json
// @Success 201 {object} gin.H "Uploaded"
// @Failure 401 {object} response.BasicResponse "Authentication required"
// @Failure 500 {object} response.BasicResponse "Upload failed"
// @Resource /upload/images
// @Router /upload [post]
func uploadImages(c *gin.Context) {
	status, err := uploadService.UploadImages(c)
	messageTypes := &response.MessageTypes{
		OK:                  "upload.done",
		Unauthorized:        "upload.error.unauthorized",
		InternalServerError: "upload.error.internalServerError",
	}
	messages := &response.Messages{OK: "Files uploaded successfully."}
	response.JSON(c, status, messageTypes, messages, err)
}
Ejemplo n.º 2
0
// @Title uploadImages
// @Description upload images to storage. Request should contain multipart form data.
// @Accept  json
// @Success 201 {object} gin.H "Uploaded"
// @Failure 401 {object} response.BasicResponse "Authentication required"
// @Failure 500 {object} response.BasicResponse "Upload failed"
// @Resource /upload/images
// @Router /upload [post]
func uploadImages(c *gin.Context) {
	status, err := uploadService.UploadImages(c)
	messageTypes := &response.MessageTypes{
		OK:                  "image.upload.done",
		BadRequest:          "image.upload.error.badRequest",
		Unauthorized:        "image.upload.error.unauthorized",
		Forbidden:           "image.upload.error.forbidden",
		NotFound:            "image.upload.error.notFound",
		InternalServerError: "image.upload.error.internalServerError",
	}
	messages := &response.Messages{OK: "Files uploaded successfully."}
	response.JSON(c, status, messageTypes, messages, err)
}