mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-02-04 04:30:05 +00:00
feat: support id query for "list" apis (#908)
* feat: support id query for "list" apis * gosec
This commit is contained in:
@@ -17,6 +17,7 @@ import (
|
||||
// @Schemes
|
||||
// @Description List Alert rules
|
||||
// @Tags auth required
|
||||
// @Param id query uint false "Resource ID"
|
||||
// @Produce json
|
||||
// @Success 200 {object} model.CommonResponse[[]model.AlertRule]
|
||||
// @Router /alert-rule [get]
|
||||
|
||||
@@ -247,7 +247,8 @@ func listHandler[S ~[]E, E model.CommonInterface](handler handlerFunc[S]) func(*
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, model.CommonResponse[S]{Success: true, Data: filter(c, data)})
|
||||
filtered := filter(c, data)
|
||||
c.JSON(http.StatusOK, model.CommonResponse[S]{Success: true, Data: model.SearchByIDCtx(c, filtered)})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import (
|
||||
// @Schemes
|
||||
// @Description List schedule tasks
|
||||
// @Tags auth required
|
||||
// @Param id query uint false "Resource ID"
|
||||
// @Produce json
|
||||
// @Success 200 {object} model.CommonResponse[[]model.Cron]
|
||||
// @Router /cron [get]
|
||||
|
||||
@@ -17,6 +17,7 @@ import (
|
||||
// @Description List DDNS profiles
|
||||
// @Security BearerAuth
|
||||
// @Tags auth required
|
||||
// @Param id query uint false "Resource ID"
|
||||
// @Produce json
|
||||
// @Success 200 {object} model.CommonResponse[[]model.DDNSProfile]
|
||||
// @Router /ddns [get]
|
||||
|
||||
@@ -16,6 +16,7 @@ import (
|
||||
// @Description List NAT profiles
|
||||
// @Security BearerAuth
|
||||
// @Tags auth required
|
||||
// @Param id query uint false "Resource ID"
|
||||
// @Produce json
|
||||
// @Success 200 {object} model.CommonResponse[[]model.NAT]
|
||||
// @Router /nat [get]
|
||||
|
||||
@@ -16,6 +16,7 @@ import (
|
||||
// @Schemes
|
||||
// @Description List notification
|
||||
// @Tags auth required
|
||||
// @Param id query uint false "Resource ID"
|
||||
// @Produce json
|
||||
// @Success 200 {object} model.CommonResponse[[]model.Notification]
|
||||
// @Router /notification [get]
|
||||
|
||||
@@ -19,6 +19,7 @@ import (
|
||||
// @Schemes
|
||||
// @Description List server
|
||||
// @Tags auth required
|
||||
// @Param id query uint false "Resource ID"
|
||||
// @Produce json
|
||||
// @Success 200 {object} model.CommonResponse[[]model.Server]
|
||||
// @Router /server [get]
|
||||
|
||||
@@ -50,6 +50,7 @@ func showService(c *gin.Context) (*model.ServiceResponse, error) {
|
||||
// @Schemes
|
||||
// @Description List service
|
||||
// @Tags auth required
|
||||
// @Param id query uint false "Resource ID"
|
||||
// @Produce json
|
||||
// @Success 200 {object} model.CommonResponse[[]model.Service]
|
||||
// @Router /service [get]
|
||||
|
||||
Reference in New Issue
Block a user