From 2878bae8ec3ccc0738c64590e841355174744bef Mon Sep 17 00:00:00 2001 From: skeris Date: Thu, 1 Feb 2024 14:39:55 +0300 Subject: [PATCH] -- --- internal/client/customer.go | 5 +++-- internal/controllers/verification.go | 4 ++-- staging.env | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/internal/client/customer.go b/internal/client/customer.go index f8985bb..8f25c97 100644 --- a/internal/client/customer.go +++ b/internal/client/customer.go @@ -17,8 +17,9 @@ func NewCustomer(logger *zap.Logger, address string) *Customer { return &Customer{logger: logger, address: address} } -func (c *Customer) UpdateAccountVerification(userId, status string) (*models.RespUpdateVerificationStatus, error) { - agent := fiber.Patch(fmt.Sprintf("%s/account/%s", c.address, userId)) +func (c *Customer) UpdateAccountVerification(userId, status, token string) (*models.RespUpdateVerificationStatus, error) { + agent := fiber.Patch(fmt.Sprintf("%s/account/%s", c.address, userId)).Set("Authorization", token) + fmt.Println("PATCHED", fmt.Sprintf("%s/account/%s", c.address, userId)) agent.JSON(&models.ReqCreateVerification{Status: status}) err := agent.Parse() diff --git a/internal/controllers/verification.go b/internal/controllers/verification.go index b43807f..69febae 100644 --- a/internal/controllers/verification.go +++ b/internal/controllers/verification.go @@ -137,7 +137,7 @@ func (r *VerificationController) SetVerificationStatus(c *fiber.Ctx) error { return c.Status(fiber.StatusBadRequest).JSON(errValidate) } - _, err = r.repository.Update(c.Context(), &models.Verification{ + verrecord, err := r.repository.Update(c.Context(), &models.Verification{ ID: req.ID, Accepted: req.Accepted, Status: req.Status, @@ -150,7 +150,7 @@ func (r *VerificationController) SetVerificationStatus(c *fiber.Ctx) error { } if req.Accepted { - _, err := r.customer.UpdateAccountVerification(req.ID, req.Status) + _, err := r.customer.UpdateAccountVerification(verrecord.UserID, req.Status, c.Get("Authorization")) if err != nil { return fiber.NewError(fiber.StatusInternalServerError, err.Error()) } diff --git a/staging.env b/staging.env index 87febbf..e9cafce 100644 --- a/staging.env +++ b/staging.env @@ -1,3 +1,3 @@ MONGO_DATABASE_NAME=verification HTTP_ADDRESS=:7035 -CUSTOMER_SVC_ADDRESS=http://10.8.0.8:8085/customer +CUSTOMER_SVC_ADDRESS=http://10.8.0.8:8065