🐛 Bug fixes in update avatar
This commit is contained in:
@ -53,6 +53,11 @@ func main() {
|
||||
log.Info().Msg("Successfully setup firebase communication.")
|
||||
}
|
||||
|
||||
// Connect other services
|
||||
if err := grpc.ConnectPaperclip(); err != nil {
|
||||
log.Fatal().Err(err).Msg("An error occurred when connecting to paperclip...")
|
||||
}
|
||||
|
||||
// Server
|
||||
server.NewServer()
|
||||
go server.Listen()
|
||||
|
@ -7,6 +7,7 @@ import (
|
||||
"git.solsynth.dev/hydrogen/passport/pkg/database"
|
||||
"git.solsynth.dev/hydrogen/passport/pkg/grpc"
|
||||
"git.solsynth.dev/hydrogen/passport/pkg/models"
|
||||
"git.solsynth.dev/hydrogen/passport/pkg/utils"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/samber/lo"
|
||||
)
|
||||
@ -15,7 +16,11 @@ func setAvatar(c *fiber.Ctx) error {
|
||||
user := c.Locals("principal").(models.Account)
|
||||
|
||||
var data struct {
|
||||
AttachmentID string `json:"attachment"`
|
||||
AttachmentID string `json:"attachment" validate:"required"`
|
||||
}
|
||||
|
||||
if err := utils.BindAndValidate(c, &data); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if _, err := grpc.Attachments.CheckAttachmentExists(context.Background(), &pcpb.AttachmentLookupRequest{
|
||||
@ -36,8 +41,13 @@ func setAvatar(c *fiber.Ctx) error {
|
||||
|
||||
func setBanner(c *fiber.Ctx) error {
|
||||
user := c.Locals("principal").(models.Account)
|
||||
|
||||
var data struct {
|
||||
AttachmentID string `json:"attachment"`
|
||||
AttachmentID string `json:"attachment" validate:"required"`
|
||||
}
|
||||
|
||||
if err := utils.BindAndValidate(c, &data); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if _, err := grpc.Attachments.CheckAttachmentExists(context.Background(), &pcpb.AttachmentLookupRequest{
|
||||
|
Reference in New Issue
Block a user