diff --git a/app/game/api/internal/logic/game/listGamesLogic.go b/app/game/api/internal/logic/game/listGamesLogic.go index 46a3530..b28204d 100644 --- a/app/game/api/internal/logic/game/listGamesLogic.go +++ b/app/game/api/internal/logic/game/listGamesLogic.go @@ -29,9 +29,13 @@ func NewListGamesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListGam } func (l *ListGamesLogic) ListGames(req *types.PageReq) (resp *types.GameListResp, err error) { - // todo: add your logic here and delete this line + page := req.Offset + if req.Limit > 0 { + page = req.Offset/req.Limit + 1 + } + all, err := l.svcCtx.GameRpc.SearchGames(l.ctx, &pb.SearchGamesReq{ - Page: req.Offset, + Page: page, Limit: req.Limit, }) if err != nil {