Add API for retrieving the date that a contributor signed the CLA
Co-authored-by: Marshall <marshall@zed.dev>
This commit is contained in:
parent
6c937c4a90
commit
56556d71a1
6 changed files with 51 additions and 1 deletions
|
@ -21,6 +21,28 @@ impl Database {
|
|||
.await
|
||||
}
|
||||
|
||||
/// Records that a given user has signed the CLA.
|
||||
pub async fn get_contributor_sign_timestamp(
|
||||
&self,
|
||||
github_user_id: i32,
|
||||
) -> Result<Option<DateTime>> {
|
||||
self.transaction(|tx| async move {
|
||||
let Some(user) = user::Entity::find()
|
||||
.filter(user::Column::GithubUserId.eq(github_user_id))
|
||||
.one(&*tx)
|
||||
.await?
|
||||
else {
|
||||
return Ok(None);
|
||||
};
|
||||
let Some(contributor) = contributor::Entity::find_by_id(user.id).one(&*tx).await?
|
||||
else {
|
||||
return Ok(None);
|
||||
};
|
||||
Ok(Some(contributor.signed_at))
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
||||
/// Records that a given user has signed the CLA.
|
||||
pub async fn add_contributor(
|
||||
&self,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue