@@ -43,6 +43,7 @@ impl NewCrateOwnerInvitation {
43
43
// already exists. This does not cause problems with expired invitation as those are
44
44
// deleted before doing this INSERT.
45
45
. on_conflict_do_nothing ( )
46
+ . returning ( CrateOwnerInvitation :: as_returning ( ) )
46
47
. get_result ( conn)
47
48
. await
48
49
. optional ( ) ?;
@@ -57,7 +58,7 @@ impl NewCrateOwnerInvitation {
57
58
}
58
59
59
60
/// The model representing a row in the `crate_owner_invitations` database table.
60
- #[ derive( Clone , Debug , Identifiable , Queryable ) ]
61
+ #[ derive( Clone , Debug , Identifiable , Queryable , Selectable ) ]
61
62
#[ diesel( primary_key( invited_user_id, crate_id) ) ]
62
63
pub struct CrateOwnerInvitation {
63
64
pub invited_user_id : i32 ,
@@ -77,13 +78,15 @@ impl CrateOwnerInvitation {
77
78
) -> QueryResult < Self > {
78
79
crate_owner_invitations:: table
79
80
. find ( ( user_id, crate_id) )
81
+ . select ( CrateOwnerInvitation :: as_select ( ) )
80
82
. first :: < Self > ( conn)
81
83
. await
82
84
}
83
85
84
86
pub async fn find_by_token ( token : & str , conn : & mut AsyncPgConnection ) -> QueryResult < Self > {
85
87
crate_owner_invitations:: table
86
88
. filter ( crate_owner_invitations:: token. eq ( token) )
89
+ . select ( CrateOwnerInvitation :: as_select ( ) )
87
90
. first :: < Self > ( conn)
88
91
. await
89
92
}
0 commit comments