From a75813e6c15f2d70e1f36fa0adb8c9ee5232054d Mon Sep 17 00:00:00 2001 From: colinlyguo Date: Thu, 7 Dec 2023 22:58:29 +0800 Subject: [PATCH] add PageSize limit --- .../internal/controller/api/history_controller.go | 6 +++--- bridge-history-api/internal/types/types.go | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bridge-history-api/internal/controller/api/history_controller.go b/bridge-history-api/internal/controller/api/history_controller.go index d1e5c02a65..521d63549e 100644 --- a/bridge-history-api/internal/controller/api/history_controller.go +++ b/bridge-history-api/internal/controller/api/history_controller.go @@ -31,7 +31,7 @@ func (c *HistoryController) GetL2ClaimableWithdrawalsByAddress(ctx *gin.Context) return } - pagedTxs, total, err := c.historyLogic.GetL2ClaimableWithdrawalsByAddress(ctx, req.Address, uint64(req.Page), uint64(req.PageSize)) + pagedTxs, total, err := c.historyLogic.GetL2ClaimableWithdrawalsByAddress(ctx, req.Address, req.Page, req.PageSize) if err != nil { types.RenderFailure(ctx, types.ErrGetL2ClaimableWithdrawalsError, err) return @@ -49,7 +49,7 @@ func (c *HistoryController) GetL2WithdrawalsByAddress(ctx *gin.Context) { return } - pagedTxs, total, err := c.historyLogic.GetL2WithdrawalsByAddress(ctx, req.Address, uint64(req.Page), uint64(req.PageSize)) + pagedTxs, total, err := c.historyLogic.GetL2WithdrawalsByAddress(ctx, req.Address, req.Page, req.PageSize) if err != nil { types.RenderFailure(ctx, types.ErrGetL2WithdrawalsError, err) return @@ -67,7 +67,7 @@ func (c *HistoryController) GetTxsByAddress(ctx *gin.Context) { return } - pagedTxs, total, err := c.historyLogic.GetTxsByAddress(ctx, req.Address, uint64(req.Page), uint64(req.PageSize)) + pagedTxs, total, err := c.historyLogic.GetTxsByAddress(ctx, req.Address, req.Page, req.PageSize) if err != nil { types.RenderFailure(ctx, types.ErrGetTxsError, err) return diff --git a/bridge-history-api/internal/types/types.go b/bridge-history-api/internal/types/types.go index abd1aac670..48032d1ab6 100644 --- a/bridge-history-api/internal/types/types.go +++ b/bridge-history-api/internal/types/types.go @@ -27,8 +27,8 @@ const ( // QueryByAddressRequest the request parameter of address api type QueryByAddressRequest struct { Address string `form:"address" binding:"required"` - Page int `form:"page" binding:"required"` - PageSize int `form:"page_size" binding:"required"` + Page uint64 `form:"page" binding:"required"` + PageSize uint64 `form:"page_size" binding:"required,min=1,max=100"` } // QueryByHashRequest the request parameter of hash api