diff --git a/internal/db/account.go b/internal/db/storage.go similarity index 100% rename from internal/db/account.go rename to internal/db/storage.go diff --git a/server/handles/storage.go b/server/handles/storage.go index 9a462262e0c..b9f4b99fb04 100644 --- a/server/handles/storage.go +++ b/server/handles/storage.go @@ -69,3 +69,18 @@ func DeleteStorage(c *gin.Context) { } common.SuccessResp(c) } + +func GetStorage(c *gin.Context) { + idStr := c.Query("id") + id, err := strconv.Atoi(idStr) + if err != nil { + common.ErrorResp(c, err, 400) + return + } + storage, err := db.GetStorageById(uint(id)) + if err != nil { + common.ErrorResp(c, err, 500, true) + return + } + common.SuccessResp(c, storage) +} diff --git a/server/router.go b/server/router.go index 22e1feefa53..c89683556aa 100644 --- a/server/router.go +++ b/server/router.go @@ -39,6 +39,7 @@ func Init(r *gin.Engine) { storage := admin.Group("/storage") storage.GET("/list", handles.ListStorages) + storage.GET("/get", handles.GetStorage) storage.POST("/create", handles.CreateStorage) storage.POST("/update", handles.UpdateStorage) storage.POST("/delete", handles.DeleteStorage)