Skip to main content

knowdit_kg_model/db/
project_finding.rs

1//! Many-to-many between historical projects and audit findings.
2//!
3//! Replaces the old `audit_finding.project_id` column. A merged finding can
4//! be the target of merges from multiple originating projects, so provenance
5//! is recorded as a separate edge rather than a scalar on the finding row.
6//!
7//! `audit_finding_id` may reference either a canonical or merged-away finding;
8//! consumers that need only canonical visibility resolve through
9//! `finding_merge`.
10use sea_orm::entity::prelude::*;
11
12#[sea_orm::model]
13#[derive(Clone, Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize, DeriveEntityModel)]
14#[sea_orm(table_name = "project_finding")]
15pub struct Model {
16    #[sea_orm(primary_key, auto_increment = false)]
17    pub project_id: i32,
18    #[sea_orm(primary_key, auto_increment = false)]
19    pub audit_finding_id: i32,
20
21    #[sea_orm(belongs_to, from = "project_id", to = "id")]
22    pub project: Option<super::project::Entity>,
23    #[sea_orm(belongs_to, from = "audit_finding_id", to = "id")]
24    pub audit_finding: Option<super::audit_finding::Entity>,
25}
26
27impl ActiveModelBehavior for ActiveModel {}