@@ -20,7 +20,9 @@ pub fn list(req: &mut dyn RequestExt) -> EndpointResult {
20
20
let user_id = auth. user_id ( ) ;
21
21
22
22
let PrivateListResponse {
23
- invitations, users, ..
23
+ invitations,
24
+ users,
25
+ meta,
24
26
} = prepare_list ( req, auth, ListFilter :: InviteeId ( user_id) ) ?;
25
27
26
28
// The schema for the private endpoints is converted to the schema used by v1 endpoints.
@@ -47,6 +49,7 @@ pub fn list(req: &mut dyn RequestExt) -> EndpointResult {
47
49
Ok ( req. json ( & json ! ( {
48
50
"crate_owner_invitations" : crate_owner_invitations,
49
51
"users" : users,
52
+ "meta" : meta,
50
53
} ) ) )
51
54
}
52
55
@@ -123,6 +126,10 @@ fn prepare_list(
123
126
) )
124
127
// We fetch one element over the page limit to then detect whether there is a next page.
125
128
. limit ( pagination. per_page as i64 + 1 ) ;
129
+ let total = crate_owner_invitations:: table
130
+ . count ( )
131
+ . get_result ( & * conn)
132
+ . unwrap ( ) ;
126
133
127
134
// Load and paginate the results.
128
135
let mut raw_invitations: Vec < CrateOwnerInvitation > = match pagination. page {
@@ -225,7 +232,7 @@ fn prepare_list(
225
232
Ok ( PrivateListResponse {
226
233
invitations,
227
234
users : users. into_iter ( ) . map ( |( _, user) | user. into ( ) ) . collect ( ) ,
228
- meta : ResponseMeta { next_page } ,
235
+ meta : ResponseMeta { next_page, total } ,
229
236
} )
230
237
}
231
238
@@ -239,6 +246,7 @@ struct PrivateListResponse {
239
246
#[ derive( Serialize ) ]
240
247
struct ResponseMeta {
241
248
next_page : Option < String > ,
249
+ total : i64 ,
242
250
}
243
251
244
252
#[ derive( Deserialize ) ]
0 commit comments