telegram debugging
parent
fe486407d1
commit
c5dfabf4af
|
@ -50,7 +50,7 @@ def CreateCrmCustomer():
|
||||||
url=f"{ENDPOINT_URL}/customer/create",
|
url=f"{ENDPOINT_URL}/customer/create",
|
||||||
headers=headers,
|
headers=headers,
|
||||||
json={
|
json={
|
||||||
"FirstName": "Shopify Customer",
|
"FirstName": customerName,
|
||||||
"Email": customerEmail,
|
"Email": customerEmail,
|
||||||
"LeadOrigin": "Shopify Customer added by GroupTask",
|
"LeadOrigin": "Shopify Customer added by GroupTask",
|
||||||
})
|
})
|
||||||
|
|
|
@ -38,6 +38,11 @@ func AddNotification(c *fiber.Ctx, body structs.AddNotificationRequest) error {
|
||||||
var userIds []string
|
var userIds []string
|
||||||
|
|
||||||
if len(body.UserIds) == 0 && body.NeededPermission == "" && len(body.RoleIds) == 0 {
|
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)
|
return c.SendStatus(fiber.StatusBadRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,6 +74,11 @@ func AddNotification(c *fiber.Ctx, body structs.AddNotificationRequest) error {
|
||||||
|
|
||||||
// no users found
|
// no users found
|
||||||
if len(userIds) == 0 {
|
if len(userIds) == 0 {
|
||||||
|
// c not defined when called from code itself
|
||||||
|
if c == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
return c.SendStatus(fiber.StatusUnprocessableEntity)
|
return c.SendStatus(fiber.StatusUnprocessableEntity)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,6 +119,11 @@ func AddNotification(c *fiber.Ctx, body structs.AddNotificationRequest) error {
|
||||||
Type: body.Type,
|
Type: body.Type,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// c not defined when called from code itself
|
||||||
|
if c == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
return c.SendStatus(fiber.StatusOK)
|
return c.SendStatus(fiber.StatusOK)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package crm
|
||||||
import (
|
import (
|
||||||
"jannex/admin-dashboard-backend/modules/database"
|
"jannex/admin-dashboard-backend/modules/database"
|
||||||
"jannex/admin-dashboard-backend/modules/logger"
|
"jannex/admin-dashboard-backend/modules/logger"
|
||||||
|
"jannex/admin-dashboard-backend/modules/notification"
|
||||||
"jannex/admin-dashboard-backend/modules/structs"
|
"jannex/admin-dashboard-backend/modules/structs"
|
||||||
"jannex/admin-dashboard-backend/modules/utils"
|
"jannex/admin-dashboard-backend/modules/utils"
|
||||||
"jannex/admin-dashboard-backend/socketclients"
|
"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)
|
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)
|
return c.Redirect(link.Url)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue