0xfurai / 0xfurai/peekaping

Can't create push monitor via API

Offen
#273 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Go
Sterne
1.2k
Forks
69
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

**Describe the bug**
Impossible to create a push monitor via API because it doesn't manage the token generation.

**Database**
- postgresql

**To Reproduce**
Steps to reproduce the behavior:
```
tmp_config=$(jq -nc \
'{
"pushToken": ""
}')

# construction du json final
payload=$(jq -nc \
--arg name "$name" \
--arg config "$tmp_config" \
--arg notification_id "$tmp_notification_id" \
--arg tag_id "$tmp_tag_id" \
'{
"type": "push",
"name": $name,
"interval": 60,
"max_retries": 1,
"retry_interval": 60,
"notification_ids": [$notification_id],
"tag_ids": [$tag_id],
"config": $config,
"resend_interval": 0,
"timeout": 16,
"active": true
}')

curl -X POST "$API_URL" -H "X-API-Key: $API_KEY" -H "Content-Type: application/json" -d "$payload"
```

**Expected behavior**
should generate a token and create the monitor

**Screenshots**
```
{"message":"Invalid monitor configuration: Key: 'PushConfig.PushToken' Error:Field validation for 'PushToken' failed on the 'required' tag","data":null}
```
**Desktop (please complete the following information):**
- OS: Ubuntu 24.04

**Additional context**
Add any other context about the problem here.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Look at the API endpoint for creating monitors, likely in a handler file. Find the push monitor configuration struct and validation logic. The token generation for push monitors needs to be integrated into the create flow when the token is empty. Check existing push monitor creation in the UI to see how tokens are generated there.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
go, postgresql
Bereich
api, backend
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Ruhig
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
55/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.