telegram notification

main
alex 2024-05-27 19:38:14 +02:00
parent e154dd3b78
commit 73824e6fb2
1 changed files with 14 additions and 1 deletions

View File

@ -1,8 +1,11 @@
package customerfeedback
import (
"encoding/json"
"jannex/admin-dashboard-backend/modules/config"
"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"
@ -56,7 +59,17 @@ func CreateCustomerFeedback(c *fiber.Ctx) error {
}},
)
logger.AddSystemLog(rslogger.LogTypeInfo, "Received customer feedback origin: %s data: %s", query.Origin, body.Data)
jsonData, err := json.MarshalIndent(customerFeedback.Data, "", " ")
if err == nil {
notification.AddNotification(nil, structs.AddNotificationRequest{
UserIds: config.Cfg.NotificationUserIds,
Type: 1,
Title: "New customer feedback\n\norigin: " + query.Origin + "\ndata: " + string(jsonData),
})
}
logger.AddSystemLog(rslogger.LogTypeInfo, "New customer feedback origin: %s data: %s", query.Origin, body.Data)
return c.SendStatus(fiber.StatusOK)
}