updates
This commit is contained in:
1 parent
8432286101
commit
c229e93103
6 files changed
+86
-2
No files matched your search
@@ -123,3 +123,15 @@ func CurrentUser(c *gin.Context) {
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{"message": "success", "data": u})
|
||||
}
|
||||
|
||||
func GetRoles(c *gin.Context) {
|
||||
roles, err := models.QueryRoles()
|
||||
|
||||
if err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{"message": "success", "data": roles})
|
||||
|
||||
}
|
||||
@@ -42,6 +42,11 @@ func StoreSecret(c *gin.Context) {
|
||||
s.RoleId = 1
|
||||
}
|
||||
|
||||
if input.DeviceCategory == "" && input.DeviceName == "" {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": "cannot store secret with empty deviceName and empty deviceCategory"})
|
||||
return
|
||||
}
|
||||
|
||||
// If this secret already exists in the database then generate an error
|
||||
checkExists, err := models.GetSecrets(&s)
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user