diff --git a/api/handlers.go b/api/handlers.go index d4ee8ff..250dea7 100644 --- a/api/handlers.go +++ b/api/handlers.go @@ -6,6 +6,7 @@ import ( "strings" "git.beisel.it/florian/hostname-service/db" + "git.beisel.it/florian/hostname-service/models" "git.beisel.it/florian/hostname-service/rules" "github.com/gin-gonic/gin" ) @@ -65,7 +66,8 @@ func CreateOrUpdateHostname(c *gin.Context, isUpdate bool) { return } - c.JSON(http.StatusOK, gin.H{"hostname": hostname}) + response := models.SimpleHostnameResponse{Hostname: hostname} + c.JSON(http.StatusOK, response) } // @Summary Delete a hostname from the database @@ -87,7 +89,8 @@ func DeleteHostname(c *gin.Context) { c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) return } - c.JSON(http.StatusOK, gin.H{"hostname": hostname}) + response := models.SimpleHostnameResponse{Hostname: hostname} + c.JSON(http.StatusOK, response) } // @Summary Return a list of hosts and their details filtered by category