admin only route is working

This commit is contained in:
2023-03-29 19:52:46 +11:00
parent 1654ff87ed
commit cc4a890064
7 changed files with 127 additions and 10 deletions

View File

@@ -0,0 +1,24 @@
package controllers
import (
"net/http"
"github.com/gin-gonic/gin"
)
// bindings are validated by https://github.com/go-playground/validator
type StoreInput struct {
RoleId int `json:"roleId"`
DeviceName string `json:"deviceName" binding:"required"`
UserName string `json:"userName" binding:"required"`
SecretValue string `json:"secretValue" binding:"required"`
}
func Store(c *gin.Context) {
var input RetrieveInput
if err := c.ShouldBindJSON(&input); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
return
}
}