b2ebb9a
use sea_orm::entity::prelude::*;
use time::OffsetDateTime;
use uuid::Uuid;
#[sea_orm::model]
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
#[sea_orm(table_name = "pull_request")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: Uuid,
#[sea_orm(unique_key = "repo_number")]
pub repo_id: Uuid,
pub issue_id: Uuid,
#[sea_orm(unique_key = "repo_number")]
pub autoincrement_id: i32,
pub author_id: Uuid,
pub title: String,
pub body: String,
pub head_branch: String,
pub head_sha: String,
pub base_branch: String,
pub base_sha: String,
pub has_merged: bool,
pub merged_commit_sha: Option<String>,
pub additions: i32,
pub deletions: i32,
pub files_changed: i32,
pub merger_id: Option<Uuid>,
pub merged_at: Option<OffsetDateTime>,
pub is_locked: bool,
pub created_at: OffsetDateTime,
pub updated_at: Option<OffsetDateTime>,
pub closed_at: Option<OffsetDateTime>,
#[sea_orm(belongs_to, from = "repo_id", to = "id")]
pub repo: BelongsTo<super::super::repo::repos::Entity>,
#[sea_orm(belongs_to, from = "issue_id", to = "id")]
pub issue: BelongsTo<super::super::issue::issue::Entity>,
#[sea_orm(belongs_to, relation_enum = "Author", from = "author_id", to = "uid")]
pub author: BelongsTo<super::super::user::users::Entity>,
#[sea_orm(belongs_to, relation_enum = "Merger", from = "merger_id", to = "uid")]
pub merger: BelongsTo<Option<super::super::user::users::Entity>>,
}
impl ActiveModelBehavior for ActiveModel {}