mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-02-04 12:40:07 +00:00
feat: list server api
This commit is contained in:
@@ -12,6 +12,26 @@ import (
|
||||
"github.com/naiba/nezha/service/singleton"
|
||||
)
|
||||
|
||||
// List server
|
||||
// @Summary List server
|
||||
// @Security BearerAuth
|
||||
// @Schemes
|
||||
// @Description List server
|
||||
// @Tags auth required
|
||||
// @Produce json
|
||||
// @Success 200 {object} model.CommonResponse[any]
|
||||
// @Router /server [get]
|
||||
func listServer(c *gin.Context) error {
|
||||
var servers []model.Server
|
||||
if err := singleton.DB.Find(&servers).Error; err != nil {
|
||||
return newGormError("%v", err)
|
||||
}
|
||||
c.JSON(http.StatusOK, model.CommonResponse[any]{
|
||||
Data: servers,
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
// Edit server
|
||||
// @Summary Edit server
|
||||
// @Security BearerAuth
|
||||
|
||||
Reference in New Issue
Block a user