From 4dae583a9a8cda64c211310020d8dcc54b449a25 Mon Sep 17 00:00:00 2001 From: Rushikesh Nimkar Date: Fri, 19 Jul 2024 17:33:12 +0530 Subject: [PATCH] nodedwifi api update --- api/v1/nodeDwifi/nodeDwifi.go | 26 ++++++++++++++++---------- models/nodeDwifi.go | 26 ++++++++++++++++---------- 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/api/v1/nodeDwifi/nodeDwifi.go b/api/v1/nodeDwifi/nodeDwifi.go index f494cfe..c26c56d 100644 --- a/api/v1/nodeDwifi/nodeDwifi.go +++ b/api/v1/nodeDwifi/nodeDwifi.go @@ -61,11 +61,14 @@ func FetchAllNodeDwifi(c *gin.Context) { } response := models.NodeDwifiResponse{ - ID: nd.ID, - Gateway: nd.Gateway, - CreatedAt: nd.CreatedAt, - UpdatedAt: nd.UpdatedAt, - Status: deviceInfos, + ID: nd.ID, + Gateway: nd.Gateway, + CreatedAt: nd.CreatedAt, + UpdatedAt: nd.UpdatedAt, + Status: deviceInfos, + Password: nd.Password, + Location: nd.Location, + Price_per_min: nd.Price_per_min, } responses = append(responses, response) @@ -119,11 +122,14 @@ func CheckForUpdates() { } response := models.NodeDwifiResponse{ - ID: nd.ID, - Gateway: nd.Gateway, - CreatedAt: nd.CreatedAt, - UpdatedAt: nd.UpdatedAt, - Status: deviceInfos, + ID: nd.ID, + Gateway: nd.Gateway, + CreatedAt: nd.CreatedAt, + UpdatedAt: nd.UpdatedAt, + Status: deviceInfos, + Password: nd.Password, + Location: nd.Location, + Price_per_min: nd.Price_per_min, } mutex.Lock() diff --git a/models/nodeDwifi.go b/models/nodeDwifi.go index e09053a..b52ef8c 100644 --- a/models/nodeDwifi.go +++ b/models/nodeDwifi.go @@ -5,19 +5,25 @@ import ( ) type NodeDwifi struct { - ID uint `json:"id" gorm:"primaryKey"` - Gateway string `json:"gateway"` - Status string `json:"-"` - CreatedAt time.Time `json:"created_at"` - UpdatedAt time.Time `json:"updated_at"` + ID uint `json:"id" gorm:"primaryKey"` + Gateway string `json:"gateway"` + Status string `json:"-"` + CreatedAt time.Time `json:"created_at"` + UpdatedAt time.Time `json:"updated_at"` + Password string `json:"password"` + Location string `json:"location"` + Price_per_min string `json:"price_per_min"` } type NodeDwifiResponse struct { - ID uint `json:"id"` - Gateway string `json:"gateway"` - CreatedAt time.Time `json:"created_at"` - UpdatedAt time.Time `json:"updated_at"` - Status []DeviceInfo `json:"status"` + ID uint `json:"id"` + Gateway string `json:"gateway"` + CreatedAt time.Time `json:"created_at"` + UpdatedAt time.Time `json:"updated_at"` + Status []DeviceInfo `json:"status"` + Password string `json:"password"` + Location string `json:"location"` + Price_per_min string `json:"price_per_min"` } type DeviceInfo struct {