Skip to content

Commit

Permalink
Add validate to service insert in mhandler
Browse files Browse the repository at this point in the history
  • Loading branch information
zachhuff386 committed Jul 14, 2019
1 parent dccbe81 commit 1a06f98
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions mhandlers/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,17 @@ func servicePost(c *gin.Context) {
WhitelistNetworks: data.WhitelistNetworks,
}

errData, err := srvce.Validate(db)
if err != nil {
utils.AbortWithError(c, 500, err)
return
}

if errData != nil {
c.JSON(400, errData)
return
}

err = srvce.Insert(db)
if err != nil {
utils.AbortWithError(c, 500, err)
Expand Down

0 comments on commit 1a06f98

Please sign in to comment.