telegram debugging
parent
fe486407d1
commit
c5dfabf4af
|
@ -50,7 +50,7 @@ def CreateCrmCustomer():
|
|||
url=f"{ENDPOINT_URL}/customer/create",
|
||||
headers=headers,
|
||||
json={
|
||||
"FirstName": "Shopify Customer",
|
||||
"FirstName": customerName,
|
||||
"Email": customerEmail,
|
||||
"LeadOrigin": "Shopify Customer added by GroupTask",
|
||||
})
|
||||
|
|
|
@ -38,6 +38,11 @@ func AddNotification(c *fiber.Ctx, body structs.AddNotificationRequest) error {
|
|||
var userIds []string
|
||||
|
||||
if len(body.UserIds) == 0 && body.NeededPermission == "" && len(body.RoleIds) == 0 {
|
||||
// c not defined when called from code itself
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return c.SendStatus(fiber.StatusBadRequest)
|
||||
}
|
||||
|
||||
|
@ -69,6 +74,11 @@ func AddNotification(c *fiber.Ctx, body structs.AddNotificationRequest) error {
|
|||
|
||||
// no users found
|
||||
if len(userIds) == 0 {
|
||||
// c not defined when called from code itself
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return c.SendStatus(fiber.StatusUnprocessableEntity)
|
||||
}
|
||||
|
||||
|
@ -109,6 +119,11 @@ func AddNotification(c *fiber.Ctx, body structs.AddNotificationRequest) error {
|
|||
Type: body.Type,
|
||||
})
|
||||
|
||||
// c not defined when called from code itself
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return c.SendStatus(fiber.StatusOK)
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package crm
|
|||
import (
|
||||
"jannex/admin-dashboard-backend/modules/database"
|
||||
"jannex/admin-dashboard-backend/modules/logger"
|
||||
"jannex/admin-dashboard-backend/modules/notification"
|
||||
"jannex/admin-dashboard-backend/modules/structs"
|
||||
"jannex/admin-dashboard-backend/modules/utils"
|
||||
"jannex/admin-dashboard-backend/socketclients"
|
||||
|
@ -763,6 +764,18 @@ func CrmUseLink(c *fiber.Ctx) error {
|
|||
|
||||
logger.AddCrmLog(rslogger.LogTypeInfo, "Crm link id: %s used: %v", link.Id, link)
|
||||
|
||||
// only for debugging
|
||||
|
||||
var crmCustomer structs.CrmCustomer
|
||||
|
||||
database.DB.First(&crmCustomer, "id = ?", link.CustomerId)
|
||||
|
||||
notification.AddNotification(nil, structs.AddNotificationRequest{
|
||||
UserIds: []string{"00de4e2c-4790-4272-bc30-e0b25d8426b6", "3d7f3dc2-dc81-4d5d-93a1-dc6690511ee3"},
|
||||
Type: 1,
|
||||
Title: "Crm link used: " + link.Name + " by crm customer: " + crmCustomer.FirstName + " " + crmCustomer.Email + " (" + link.CustomerId + ")",
|
||||
})
|
||||
|
||||
return c.Redirect(link.Url)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue