Skip to content

Commit

Permalink
feat(api): add wan status
Browse files Browse the repository at this point in the history
This can be displayes inside dashboards
  • Loading branch information
gsanchietti committed Sep 19, 2024
1 parent b6e5957 commit c8de74c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion api/methods/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func SetUnitWan(c *gin.Context) {
}
// Insert inside WAN table
for _, wan := range req.Data {
_, err := dbpool.Exec(dbctx, "INSERT INTO wan_config (uuid, interface, device) VALUES ($1, $2, $3)", c.MustGet("UnitId").(string), wan.Interface, wan.Device)
_, err := dbpool.Exec(dbctx, "INSERT INTO wan_config (uuid, interface, device, status) VALUES ($1, $2, $3, $4)", c.MustGet("UnitId").(string), wan.Interface, wan.Device, wan.Status)
if err != nil {
logs.Logs.Println("[ERR][UNITWAN] error inserting data: " + err.Error())
c.JSON(http.StatusInternalServerError, structs.Map(response.StatusInternalServerError{
Expand Down
1 change: 1 addition & 0 deletions api/models/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ type UnitOpenVPNRWRequest struct {
type Wan struct {
Interface string `json:"interface" binding:"required"`
Device string `json:"device" binding:"required"`
Status string `json:"status" binding:"required"`
}

type Wans []Wan
Expand Down
1 change: 1 addition & 0 deletions api/storage/report_schema.sql.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ CREATE TABLE IF NOT EXISTS wan_config (
uuid UUID NOT NULL references units(uuid),
interface TEXT NOT NULL,
device TEXT,
status TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

Expand Down

0 comments on commit c8de74c

Please sign in to comment.