Skip to content

Commit

Permalink
Merge pull request #35 from NetSepio/rushikesh-api
Browse files Browse the repository at this point in the history
nodedwifi api update
  • Loading branch information
Rushikeshnimkar authored Jul 19, 2024
2 parents 4639f32 + 4dae583 commit 7e4f9d1
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 20 deletions.
26 changes: 16 additions & 10 deletions api/v1/nodeDwifi/nodeDwifi.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand Down
26 changes: 16 additions & 10 deletions models/nodeDwifi.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 7e4f9d1

Please sign in to comment.