mirror of
https://github.com/EZ-Api/ez-api.git
synced 2026-01-13 17:47:51 +00:00
feat(api): add admin master key listing/revoke
Add admin endpoints to list and revoke child keys under a master. Standardize OpenAPI responses to use ResponseEnvelope with MapData for error payloads, and regenerate swagger specs accordingly.
This commit is contained in:
@@ -90,9 +90,9 @@ func toIPBanView(ban *model.IPBan) IPBanView {
|
||||
// @Security AdminAuth
|
||||
// @Param ban body CreateIPBanRequest true "IP Ban Info"
|
||||
// @Success 201 {object} ResponseEnvelope{data=IPBanView}
|
||||
// @Failure 400 {object} ResponseEnvelope{data=gin.H}
|
||||
// @Failure 409 {object} ResponseEnvelope{data=gin.H}
|
||||
// @Failure 500 {object} ResponseEnvelope{data=gin.H}
|
||||
// @Failure 400 {object} ResponseEnvelope{data=MapData}
|
||||
// @Failure 409 {object} ResponseEnvelope{data=MapData}
|
||||
// @Failure 500 {object} ResponseEnvelope{data=MapData}
|
||||
// @Router /admin/ip-bans [post]
|
||||
func (h *IPBanHandler) Create(c *gin.Context) {
|
||||
var req CreateIPBanRequest
|
||||
@@ -140,7 +140,7 @@ func (h *IPBanHandler) Create(c *gin.Context) {
|
||||
// @Security AdminAuth
|
||||
// @Param status query string false "Filter by status (active, expired)"
|
||||
// @Success 200 {object} ResponseEnvelope{data=[]IPBanView}
|
||||
// @Failure 500 {object} ResponseEnvelope{data=gin.H}
|
||||
// @Failure 500 {object} ResponseEnvelope{data=MapData}
|
||||
// @Router /admin/ip-bans [get]
|
||||
func (h *IPBanHandler) List(c *gin.Context) {
|
||||
status := c.Query("status")
|
||||
@@ -168,8 +168,8 @@ func (h *IPBanHandler) List(c *gin.Context) {
|
||||
// @Security AdminAuth
|
||||
// @Param id path int true "IP Ban ID"
|
||||
// @Success 200 {object} ResponseEnvelope{data=IPBanView}
|
||||
// @Failure 404 {object} ResponseEnvelope{data=gin.H}
|
||||
// @Failure 500 {object} ResponseEnvelope{data=gin.H}
|
||||
// @Failure 404 {object} ResponseEnvelope{data=MapData}
|
||||
// @Failure 500 {object} ResponseEnvelope{data=MapData}
|
||||
// @Router /admin/ip-bans/{id} [get]
|
||||
func (h *IPBanHandler) Get(c *gin.Context) {
|
||||
id, err := strconv.ParseUint(c.Param("id"), 10, 64)
|
||||
@@ -201,10 +201,10 @@ func (h *IPBanHandler) Get(c *gin.Context) {
|
||||
// @Param id path int true "IP Ban ID"
|
||||
// @Param ban body UpdateIPBanRequest true "IP Ban Update"
|
||||
// @Success 200 {object} ResponseEnvelope{data=IPBanView}
|
||||
// @Failure 400 {object} ResponseEnvelope{data=gin.H}
|
||||
// @Failure 404 {object} ResponseEnvelope{data=gin.H}
|
||||
// @Failure 409 {object} ResponseEnvelope{data=gin.H}
|
||||
// @Failure 500 {object} ResponseEnvelope{data=gin.H}
|
||||
// @Failure 400 {object} ResponseEnvelope{data=MapData}
|
||||
// @Failure 404 {object} ResponseEnvelope{data=MapData}
|
||||
// @Failure 409 {object} ResponseEnvelope{data=MapData}
|
||||
// @Failure 500 {object} ResponseEnvelope{data=MapData}
|
||||
// @Router /admin/ip-bans/{id} [put]
|
||||
func (h *IPBanHandler) Update(c *gin.Context) {
|
||||
id, err := strconv.ParseUint(c.Param("id"), 10, 64)
|
||||
@@ -250,8 +250,8 @@ func (h *IPBanHandler) Update(c *gin.Context) {
|
||||
// @Security AdminAuth
|
||||
// @Param id path int true "IP Ban ID"
|
||||
// @Success 204
|
||||
// @Failure 404 {object} ResponseEnvelope{data=gin.H}
|
||||
// @Failure 500 {object} ResponseEnvelope{data=gin.H}
|
||||
// @Failure 404 {object} ResponseEnvelope{data=MapData}
|
||||
// @Failure 500 {object} ResponseEnvelope{data=MapData}
|
||||
// @Router /admin/ip-bans/{id} [delete]
|
||||
func (h *IPBanHandler) Delete(c *gin.Context) {
|
||||
id, err := strconv.ParseUint(c.Param("id"), 10, 64)
|
||||
|
||||
Reference in New Issue
Block a user