diff --git a/api/methods/report.go b/api/methods/report.go index 748b590..8956914 100644 --- a/api/methods/report.go +++ b/api/methods/report.go @@ -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{ diff --git a/api/models/report.go b/api/models/report.go index ae0a2a4..af47cd3 100644 --- a/api/models/report.go +++ b/api/models/report.go @@ -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 diff --git a/api/storage/report_schema.sql.tmpl b/api/storage/report_schema.sql.tmpl index b84dbdb..dbd1d64 100644 --- a/api/storage/report_schema.sql.tmpl +++ b/api/storage/report_schema.sql.tmpl @@ -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 );