Skip to content

Commit c99229b

Browse files
committed
feat: provide pagination
1 parent c664493 commit c99229b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/controllers/crate_owner_invitation.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,16 @@ fn prepare_list(
139139
)
140140
.load(&*conn)?
141141
}
142-
Page::Numeric(_) => unreachable!("page-based pagination is disabled"),
142+
Page::Numeric(_) => query
143+
.pages_pagination(pagination)
144+
.filter(
145+
crate_owner_invitations::crate_id.gt(seek_key.0).or(
146+
crate_owner_invitations::crate_id
147+
.eq(seek_key.0)
148+
.and(crate_owner_invitations::invited_user_id.gt(seek_key.1)),
149+
),
150+
)
151+
.load(&*conn)?,
143152
};
144153
let next_page = if raw_invitations.len() > pagination.per_page as usize {
145154
// We fetch `per_page + 1` to check if there are records for the next page. Since the last

0 commit comments

Comments
 (0)