Send Test Notification Type fix

This commit is contained in:
headlesdev
2025-05-25 22:01:15 +02:00
parent fb13c2bfce
commit a218a7f8f3
4 changed files with 16 additions and 7 deletions

View File

@@ -91,14 +91,17 @@ func SendNotification(providerType NotificationType, config json.RawMessage, tes
func sendTelegramNotification(config json.RawMessage, test NotificationTest) error {
var cfg struct {
BotToken string `json:"botToken"`
ChatID string `json:"chatID"`
Token string `json:"token"`
ChatID string `json:"chat_id"`
}
if err := json.Unmarshal(config, &cfg); err != nil {
return fmt.Errorf("invalid Telegram config: %w", err)
}
fmt.Println("Token:", cfg.Token)
fmt.Println("ChatID:", cfg.ChatID)
log.Printf("Sending Telegram test to chat %s", cfg.ChatID)
return nil
}
@@ -144,7 +147,7 @@ func getPendingTests() ([]NotificationTest, error) {
FROM notification_tests t
JOIN notification_providers p
ON "t"."notificationProviderId" = p.id
WHERE t.success IS NOT TRUE`
WHERE t.sent IS NOT TRUE`
rows, err := db.Query(query)
if err != nil {