From 201007f7a03f06256b826de9de1bd1c8441ad9f2 Mon Sep 17 00:00:00 2001 From: imterah Date: Sat, 28 Dec 2024 15:26:48 -0500 Subject: [PATCH] chore: Make lookup fields in the API omit when they're empty. This makes the API more accurate to the previous API's responses. --- backend/api/controllers/v1/backends/lookup.go | 4 ++-- backend/api/controllers/v1/proxies/lookup.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/api/controllers/v1/backends/lookup.go b/backend/api/controllers/v1/backends/lookup.go index fda1a8e..a68e183 100644 --- a/backend/api/controllers/v1/backends/lookup.go +++ b/backend/api/controllers/v1/backends/lookup.go @@ -27,9 +27,9 @@ type SanitizedBackend struct { Name string `json:"name"` BackendID uint `json:"id"` OwnerID uint `json:"ownerID"` - Description *string `json:"description"` + Description *string `json:"description,omitempty"` Backend string `json:"backend"` - BackendParameters *string `json:"connectionDetails"` + BackendParameters *string `json:"connectionDetails,omitempty"` Logs []string `json:"logs"` } diff --git a/backend/api/controllers/v1/proxies/lookup.go b/backend/api/controllers/v1/proxies/lookup.go index c290e27..f370e79 100644 --- a/backend/api/controllers/v1/proxies/lookup.go +++ b/backend/api/controllers/v1/proxies/lookup.go @@ -29,7 +29,7 @@ type ProxyLookupRequest struct { type SanitizedProxy struct { Id uint `json:"id"` Name string `json:"name"` - Description *string `json:"description"` + Description *string `json:"description,omitempty"` Protcol string `json:"protocol"` SourceIP string `json:"sourceIP"` SourcePort uint16 `json:"sourcePort"`