use sea_orm::entity::prelude::*; use time::OffsetDateTime; use uuid::Uuid; #[sea_orm::model] #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "code_comment")] pub struct Model { #[sea_orm(primary_key, auto_increment = false)] pub id: Uuid, #[sea_orm(indexed)] pub repo_id: Uuid, #[sea_orm(indexed)] pub path: String, pub line: i32, #[sea_orm(indexed)] pub commit_sha: String, pub author_id: i64, #[sea_orm(indexed)] pub parent_id: Option, pub body: String, pub resolved_at: Option, pub resolved_by: Option, pub created_at: OffsetDateTime, pub updated_at: Option, #[sea_orm(belongs_to, from = "repo_id", to = "id")] pub repo: BelongsTo, #[sea_orm(belongs_to, relation_enum = "Author", from = "author_id", to = "uid")] pub author: BelongsTo, #[sea_orm(belongs_to, from = "resolved_by", to = "uid")] pub resolver: BelongsTo>, #[sea_orm(belongs_to, relation_enum = "Parent", from = "parent_id", to = "id")] pub parent: BelongsTo>, } impl ActiveModelBehavior for ActiveModel {}