chore: add id to resp of create storage

This commit is contained in:
Noah Hsu
2022-11-13 20:17:10 +08:00
parent 6e3df9f847
commit 3b6d8987db
6 changed files with 34 additions and 13 deletions

View File

@ -36,10 +36,14 @@ func CreateStorage(c *gin.Context) {
common.ErrorResp(c, err, 400)
return
}
if err := op.CreateStorage(c, req); err != nil {
common.ErrorResp(c, err, 500, true)
if id, err := op.CreateStorage(c, req); err != nil {
common.ErrorWithDataResp(c, err, 500, gin.H{
"id": id,
}, true)
} else {
common.SuccessResp(c)
common.SuccessResp(c, gin.H{
"id": id,
})
}
}