@@ -44,15 +44,10 @@ pub fn list(req: &mut dyn RequestExt) -> EndpointResult {
4444 } )
4545 . collect :: < AppResult < Vec < EncodableCrateOwnerInvitationV1 > > > ( ) ?;
4646
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+ } ) ) )
5651}
5752
5853/// Handles the `GET /api/private/crate_owner_invitations` route.
@@ -271,13 +266,7 @@ pub fn handle_invite(req: &mut dyn RequestExt) -> EndpointResult {
271266 invitation. decline ( conn) ?;
272267 }
273268
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 } ) ) )
281270}
282271
283272/// 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 {
290279 let crate_id = invitation. crate_id ;
291280 invitation. accept ( & conn, config) ?;
292281
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 ,
301286 } ,
302- } ) )
287+ } ) ) )
303288}
0 commit comments