Removed local picture saving
parent
82f8520e8a
commit
8adf121160
|
@ -2,16 +2,13 @@ package picture
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
|
||||
"git.umbach.dev/app-idea/rest-api/modules/config"
|
||||
"git.umbach.dev/app-idea/rest-api/modules/rabbitmq"
|
||||
"git.umbach.dev/app-idea/rest-api/modules/structs"
|
||||
"git.umbach.dev/app-idea/rest-api/routers/api/v1/user"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/google/uuid"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
|
@ -56,22 +53,5 @@ func Test(c *fiber.Ctx) error {
|
|||
|
||||
rabbitmq.PublishPicture(structs.RabbitmqPictureMessage{Picture: buf.Bytes(), UserId: user.Id, Filename: file.Filename})
|
||||
|
||||
filename := strings.Replace(uuid.New().String(), "-", "", -1)
|
||||
fileExt := strings.Split(file.Filename, ".")[1]
|
||||
image := fmt.Sprintf("%s.%s", filename, fileExt)
|
||||
|
||||
err = c.SaveFile(file, "./img/"+image)
|
||||
|
||||
if err != nil {
|
||||
log.Infoln("err2", err)
|
||||
return c.SendStatus(fiber.StatusInternalServerError)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
log.Infoln("err fileUpload:", err)
|
||||
}
|
||||
|
||||
log.Infoln("no error")
|
||||
|
||||
return c.SendStatus(fiber.StatusCreated)
|
||||
return c.SendStatus(fiber.StatusOK)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue