chore: rename controllers to handles

This commit is contained in:
Noah Hsu
2022-07-11 17:12:50 +08:00
parent 8971a924f1
commit dc38f21294
12 changed files with 61 additions and 61 deletions

27
server/handles/driver.go Normal file
View File

@ -0,0 +1,27 @@
package handles
import (
"fmt"
"github.com/alist-org/alist/v3/internal/operations"
"github.com/alist-org/alist/v3/server/common"
"github.com/gin-gonic/gin"
)
func ListDriverItems(c *gin.Context) {
common.SuccessResp(c, operations.GetDriverItemsMap())
}
func ListDriverNames(c *gin.Context) {
common.SuccessResp(c, operations.GetDriverNames())
}
func GetDriverItems(c *gin.Context) {
driverName := c.Query("driver")
itemsMap := operations.GetDriverItemsMap()
items, ok := itemsMap[driverName]
if !ok {
common.ErrorStrResp(c, fmt.Sprintf("driver [%s] not found", driverName), 404)
return
}
common.SuccessResp(c, items)
}