🚧 Begin implementing the Models

This commit is contained in:
Florian Beisel 2024-01-18 00:10:48 +01:00
parent 607682884c
commit ce4d469466
Signed by: florian
GPG Key ID: 79ECA2E54996FF4D
1 changed files with 5 additions and 2 deletions

View File

@ -6,6 +6,7 @@ import (
"strings" "strings"
"git.beisel.it/florian/hostname-service/db" "git.beisel.it/florian/hostname-service/db"
"git.beisel.it/florian/hostname-service/models"
"git.beisel.it/florian/hostname-service/rules" "git.beisel.it/florian/hostname-service/rules"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -65,7 +66,8 @@ func CreateOrUpdateHostname(c *gin.Context, isUpdate bool) {
return 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 // @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()}) c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return 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 // @Summary Return a list of hosts and their details filtered by category