From 92057c52fa0be6b786946bd79d16856aacc29ce7 Mon Sep 17 00:00:00 2001 From: Kirill Fedoseev Date: Wed, 27 Dec 2023 18:05:21 +0200 Subject: [PATCH] fix: last page --- .../proto/user-ops-indexer.proto | 2 +- .../src/services/user_ops.rs | 28 ++++++++----------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/user-ops-indexer/user-ops-indexer-proto/proto/user-ops-indexer.proto b/user-ops-indexer/user-ops-indexer-proto/proto/user-ops-indexer.proto index 4c19a9d82..f01e4c245 100644 --- a/user-ops-indexer/user-ops-indexer-proto/proto/user-ops-indexer.proto +++ b/user-ops-indexer/user-ops-indexer-proto/proto/user-ops-indexer.proto @@ -20,7 +20,7 @@ service UserOpsService { } message Pagination { - optional string page_token = 1; + string page_token = 1; uint32 page_size = 2; } diff --git a/user-ops-indexer/user-ops-indexer-server/src/services/user_ops.rs b/user-ops-indexer/user-ops-indexer-server/src/services/user_ops.rs index 1aa4a591d..b48d144e7 100644 --- a/user-ops-indexer/user-ops-indexer-server/src/services/user_ops.rs +++ b/user-ops-indexer/user-ops-indexer-server/src/services/user_ops.rs @@ -156,8 +156,8 @@ impl UserOps for UserOpsService { let res = ListAccountsResponse { items: accounts.into_iter().map(|acc| acc.into()).collect(), - next_page_params: Some(Pagination { - page_token: next_page_token.map(|a| to_checksum(&a, None)), + next_page_params: next_page_token.map(|a| Pagination { + page_token: to_checksum(&a, None), page_size, }), }; @@ -193,9 +193,8 @@ impl UserOps for UserOpsService { let res = ListBundlesResponse { items: bundles.into_iter().map(|b| b.into()).collect(), - next_page_params: Some(Pagination { - page_token: next_page_token - .map(|(b, t, i)| format!("{},{},{}", b, t.encode_hex(), i)), + next_page_params: next_page_token.map(|(b, t, i)| Pagination { + page_token: format!("{},{},{}", b, t.encode_hex(), i), page_size, }), }; @@ -242,8 +241,8 @@ impl UserOps for UserOpsService { let res = ListUserOpsResponse { items: ops.into_iter().map(|acc| acc.into()).collect(), - next_page_params: Some(Pagination { - page_token: next_page_token.map(|(b, o)| format!("{},{}", b, o.encode_hex())), + next_page_params: next_page_token.map(|(b, o)| Pagination { + page_token: format!("{},{}", b, o.encode_hex()), page_size, }), }; @@ -271,9 +270,8 @@ impl UserOps for UserOpsService { let res = ListBundlersResponse { items: bundlers.into_iter().map(|b| b.into()).collect(), - next_page_params: Some(Pagination { - page_token: next_page_token - .map(|(t, f)| format!("{},{}", t, to_checksum(&f, None))), + next_page_params: next_page_token.map(|(t, f)| Pagination { + page_token: format!("{},{}", t, to_checksum(&f, None)), page_size, }), }; @@ -301,9 +299,8 @@ impl UserOps for UserOpsService { let res = ListPaymastersResponse { items: paymasters.into_iter().map(|b| b.into()).collect(), - next_page_params: Some(Pagination { - page_token: next_page_token - .map(|(t, f)| format!("{},{}", t, to_checksum(&f, None))), + next_page_params: next_page_token.map(|(t, f)| Pagination { + page_token: format!("{},{}", t, to_checksum(&f, None)), page_size, }), }; @@ -331,9 +328,8 @@ impl UserOps for UserOpsService { let res = ListFactoriesResponse { items: factories.into_iter().map(|b| b.into()).collect(), - next_page_params: Some(Pagination { - page_token: next_page_token - .map(|(t, f)| format!("{},{}", t, to_checksum(&f, None))), + next_page_params: next_page_token.map(|(t, f)| Pagination { + page_token: format!("{},{}", t, to_checksum(&f, None)), page_size, }), };