Conversation
## Walkthrough
A new optional field, `DeviceID` (pointer to string), was added to the `Webhook` struct in the codebase. This field includes JSON serialization and validation tags, allowing webhooks to optionally specify an associated device identifier. Corresponding test cases were updated to include the `deviceId` field with null values in JSON requests and responses. No additional logic or validation changes were introduced.
## Changes
| File(s) | Change Summary |
|---------------------------------|-----------------------------------------------------------------------------------------------------------------------------|
| smsgateway/domain_webhooks.go | Added optional `DeviceID *string` field to the `Webhook` struct with JSON and validation metadata. |
| smsgateway/client_test.go | Updated test server JSON payloads in webhook-related tests to include `"deviceId":null` in requests and responses; added error logging for request body mismatches. |
## Sequence Diagram(s)
```mermaid
sequenceDiagram
participant Client
participant Webhook
participant Device
Client->>Webhook: Create/Update Webhook (with optional deviceId)
Webhook-->>Device: Associates deviceId if provided
Webhook-->>Client: Responds with webhook details (including deviceId if set) |
Codecov ReportAll modified and coverable lines are covered by tests ✅
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
smsgateway/client_test.go (1)
247-251: Added proper request validation with improved error reportingThe test now correctly expects the deviceId field in the JSON request and provides better error reporting when the request body doesn't match expectations.
Consider adding an explicit assertion for the DeviceID field in the test's "want" section (around line 286-290), even though it's null, to make the test more complete.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
smsgateway/client_test.go(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Analyze (go)
🔇 Additional comments (2)
smsgateway/client_test.go (2)
185-185: JSON response correctly includes the new deviceId fieldThe webhook list response now includes the deviceId field (set to null), which aligns with the addition of the new optional DeviceID field to the Webhook struct.
255-255: JSON response correctly includes the new deviceId fieldThe webhook registration response now includes the deviceId field (set to null), consistent with the Webhook struct update.
5876d8d to
25bc23a
Compare
Summary by CodeRabbit