use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; use time::OffsetDateTime; use uuid::Uuid; #[derive( Debug, Clone, Copy, PartialEq, Eq, Default, EnumIter, DeriveActiveEnum, Serialize, Deserialize, )] #[sea_orm(rs_type = "i32", db_type = "SmallInteger")] pub enum ReviewState { #[default] Approved = 0, ChangesRequested = 1, Commented = 2, } #[sea_orm::model] #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "pull_request_review")] pub struct Model { #[sea_orm(primary_key, auto_increment = false)] pub id: Uuid, pub pull_request_id: Uuid, pub user_id: Uuid, pub commit_sha: String, pub official: bool, pub content: Option, pub state: ReviewState, pub created_at: OffsetDateTime, pub updated_at: Option, #[sea_orm(belongs_to, from = "pull_request_id", to = "id")] pub pull_request: BelongsTo, #[sea_orm(belongs_to, from = "user_id", to = "uid")] pub user: BelongsTo, } impl ActiveModelBehavior for ActiveModel {}