Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(feat) initial pagination for ListHomeChanges #233

Merged
merged 1 commit into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion changes.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import "bookmarks.proto";
import "items.proto";
import "snapshots.proto";
import "config.proto";
import "util.proto";

// ______
// ,'" "-._
Expand Down Expand Up @@ -261,9 +262,13 @@ message GetAppSummariesResponse {
repeated changes.AppSummary apps = 1;
}

message ListHomeChangesRequest {}
message ListHomeChangesRequest {
PaginationRequest pagination = 1;
tphoney marked this conversation as resolved.
Show resolved Hide resolved
}

message ListHomeChangesResponse {
repeated ChangeSummary changes = 1;
PaginationResponse pagination = 2;
}

message ListHomeAppsRequest {}
Expand Down
37 changes: 37 additions & 0 deletions util.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
syntax = "proto3";

// _____/\\\\\\\\\\\____/\\\\\\\\\\\\_____/\\\\\\\\\\\\\___
// ___/\\\/////////\\\_\/\\\////////\\\__\/\\\/////////\\\_
// __\//\\\______\///__\/\\\______\//\\\_\/\\\_______\/\\\_
// ___\////\\\_________\/\\\_______\/\\\_\/\\\\\\\\\\\\\/__
// ______\////\\\______\/\\\_______\/\\\_\/\\\/////////____
// _________\////\\\___\/\\\_______\/\\\_\/\\\_____________
// __/\\\______\//\\\__\/\\\_______/\\\__\/\\\_____________
// _\///\\\\\\\\\\\/___\/\\\\\\\\\\\\/___\/\\\_____________
// ___\///////////_____\////////////_____\///______________
option go_package = "github.com/overmindtech/sdp-go;sdp";

message PaginationRequest {
// The number of items to return in a single page. The minimum is 10 and the maximum is 100.
int32 pageSize = 1;

// The page number to return. the first page is 0.
// if the page number is larger than the total number of pages, the last page is returned.
// if the page number is negative, the first page 0 is returned.
int32 page = 2;
}

message PaginationResponse {
// The number of items in the current page
int32 pageSize = 1;

// The total number of items available. Expensive to calculate https://www.cybertec-postgresql.com/en/pagination-problem-total-result-count/
// this is done as a separate query
int32 totalItems = 2;

// The current page number
int32 page = 3;

// The total number of pages available. based on the totalItems and pageSize.
int32 totalPages = 4;
}
Loading