Add REST APIs for getting and adding contributors
Co-authored-by: Mikayla <mikayla@zed.dev>
This commit is contained in:
parent
5b906e731d
commit
1981de4cae
12 changed files with 206 additions and 56 deletions
30
crates/collab/src/db/tables/contributor.rs
Normal file
30
crates/collab/src/db/tables/contributor.rs
Normal file
|
@ -0,0 +1,30 @@
|
|||
use crate::db::UserId;
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::Serialize;
|
||||
|
||||
/// A user who has signed the CLA.
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, DeriveEntityModel, Serialize)]
|
||||
#[sea_orm(table_name = "contributors")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
pub user_id: UserId,
|
||||
pub signed_at: DateTime,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(
|
||||
belongs_to = "super::user::Entity",
|
||||
from = "Column::UserId",
|
||||
to = "super::user::Column::Id"
|
||||
)]
|
||||
User,
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
|
||||
impl Related<super::user::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::User.def()
|
||||
}
|
||||
}
|
|
@ -31,6 +31,8 @@ pub enum Relation {
|
|||
ChannelMemberships,
|
||||
#[sea_orm(has_many = "super::user_feature::Entity")]
|
||||
UserFeatures,
|
||||
#[sea_orm(has_one = "super::contributor::Entity")]
|
||||
Contributor,
|
||||
}
|
||||
|
||||
impl Related<super::access_token::Entity> for Entity {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue