Skip to content
Clone
main
25 lines 812 B Rust
use crate::common::watch_mode::WatchMode;
use sea_orm::entity::prelude::*;
use time::OffsetDateTime;
use uuid::Uuid;
#[sea_orm::model]
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
#[sea_orm(table_name = "repo_watch")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: Uuid,
#[sea_orm(unique_key = "user_repo")]
pub user_id: i64,
#[sea_orm(unique_key = "user_repo")]
pub repo_id: Uuid,
pub mode: WatchMode,
pub created_at: OffsetDateTime,
pub updated_at: OffsetDateTime,
#[sea_orm(belongs_to, from = "user_id", to = "uid")]
pub user: BelongsTo<super::super::users::user::Entity>,
#[sea_orm(belongs_to, from = "repo_id", to = "id")]
pub repo: BelongsTo<super::repos::Entity>,
}
impl ActiveModelBehavior for ActiveModel {}