diff --git a/controllers/controlSafes.go b/controllers/controlSafes.go index 283a602..cab5c31 100644 --- a/controllers/controlSafes.go +++ b/controllers/controlSafes.go @@ -92,7 +92,7 @@ func AddSafeHandler(c *gin.Context) { return } - c.JSON(http.StatusOK, gin.H{"message": "safe creation success"}) + c.JSON(http.StatusOK, gin.H{"message": "safe creation success", "data": s}) } func DeleteSafeHandler(c *gin.Context) { diff --git a/models/safe.go b/models/safe.go index a3698db..1f59f29 100644 --- a/models/safe.go +++ b/models/safe.go @@ -107,6 +107,7 @@ func (s *Safe) SafeAdd() (*Safe, error) { affected, _ := result.RowsAffected() id, _ := result.LastInsertId() log.Printf("SafeAdd insert returned result id '%d' affecting %d row(s).\n", id, affected) + s.SafeId = int(id) log.Printf("safe: %v\n", s) } } else {