@@ -44,15 +44,10 @@ pub fn list(req: &mut dyn RequestExt) -> EndpointResult {
44
44
} )
45
45
. collect :: < AppResult < Vec < EncodableCrateOwnerInvitationV1 > > > ( ) ?;
46
46
47
- #[ derive( Serialize ) ]
48
- struct R {
49
- crate_owner_invitations : Vec < EncodableCrateOwnerInvitationV1 > ,
50
- users : Vec < EncodablePublicUser > ,
51
- }
52
- Ok ( req. json ( & R {
53
- crate_owner_invitations,
54
- users,
55
- } ) )
47
+ Ok ( req. json ( & json ! ( {
48
+ "crate_owner_invitations" : crate_owner_invitations,
49
+ "users" : users,
50
+ } ) ) )
56
51
}
57
52
58
53
/// Handles the `GET /api/private/crate_owner_invitations` route.
@@ -271,13 +266,7 @@ pub fn handle_invite(req: &mut dyn RequestExt) -> EndpointResult {
271
266
invitation. decline ( conn) ?;
272
267
}
273
268
274
- #[ derive( Serialize ) ]
275
- struct R {
276
- crate_owner_invitation : InvitationResponse ,
277
- }
278
- Ok ( req. json ( & R {
279
- crate_owner_invitation : crate_invite,
280
- } ) )
269
+ Ok ( req. json ( & json ! ( { "crate_owner_invitation" : crate_invite } ) ) )
281
270
}
282
271
283
272
/// Handles the `PUT /api/v1/me/crate_owner_invitations/accept/:token` route.
@@ -290,14 +279,10 @@ pub fn handle_invite_with_token(req: &mut dyn RequestExt) -> EndpointResult {
290
279
let crate_id = invitation. crate_id ;
291
280
invitation. accept ( & conn, config) ?;
292
281
293
- #[ derive( Serialize ) ]
294
- struct R {
295
- crate_owner_invitation : InvitationResponse ,
296
- }
297
- Ok ( req. json ( & R {
298
- crate_owner_invitation : InvitationResponse {
299
- crate_id,
300
- accepted : true ,
282
+ Ok ( req. json ( & json ! ( {
283
+ "crate_owner_invitation" : {
284
+ "crate_id" : crate_id,
285
+ "accepted" : true ,
301
286
} ,
302
- } ) )
287
+ } ) ) )
303
288
}
0 commit comments