Update wagfarm-api/routes/asset/asset_routes.go
This commit is contained in:
@@ -32,14 +32,4 @@ func RegisterRoutes(router *gin.Engine) {
|
|||||||
db.Preload("AssetType").Find(&assets)
|
db.Preload("AssetType").Find(&assets)
|
||||||
c.JSON(http.StatusOK, assets)
|
c.JSON(http.StatusOK, assets)
|
||||||
})
|
})
|
||||||
|
|
||||||
router.POST("/assets", func(c *gin.Context) {
|
|
||||||
var asset models.Asset
|
|
||||||
if err := c.ShouldBindJSON(&asset); err != nil {
|
|
||||||
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
db.Create(&asset)
|
|
||||||
c.JSON(http.StatusCreated, asset)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user