mirror of
https://github.com/zed-industries/zed.git
synced 2024-09-18 18:08:07 +03:00
Make POST /contributors API idempotent
Co-authored-by: Marshall <marshall@zed.dev>
This commit is contained in:
parent
1981de4cae
commit
6c937c4a90
@ -37,11 +37,17 @@ impl Database {
|
||||
&*tx,
|
||||
)
|
||||
.await?;
|
||||
contributor::ActiveModel {
|
||||
|
||||
contributor::Entity::insert(contributor::ActiveModel {
|
||||
user_id: ActiveValue::Set(user.id),
|
||||
signed_at: ActiveValue::NotSet,
|
||||
}
|
||||
.insert(&*tx)
|
||||
})
|
||||
.on_conflict(
|
||||
OnConflict::column(contributor::Column::UserId)
|
||||
.do_nothing()
|
||||
.to_owned(),
|
||||
)
|
||||
.exec_without_returning(&*tx)
|
||||
.await?;
|
||||
Ok(())
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user