* Copyright(c) 2024-2026 China Telecom Cloud Technologies Co., Ltd. All rights
* reserved. track-system is licensed under Mulan PSL v2. You can use this software
* according to the terms and conditions of the Mulan PSL V2. You may obtain a
* copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2.
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY
* KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. See the Mulan PSL v2 for
* more details.
*/
use sea_orm::{entity::prelude::*, JsonValue};
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
#[sea_orm(table_name = "commit_records")]
pub struct Model {
#[sea_orm(primary_key)]
pub id: i32,
pub tracking_id: i32,
pub commit_sha: String,
#[sea_orm(column_type = "Text")]
pub commit_message: String,
pub author_name: String,
pub author_email: String,
pub committed_at: DateTimeUtc,
pub change_type: Option<String>,
pub primary_change_type: Option<String>,
#[sea_orm(column_type = "JsonBinary", nullable)]
pub cve_list: Option<JsonValue>,
pub spec_changed: bool,
#[sea_orm(column_type = "JsonBinary", nullable)]
pub patch_stats: Option<JsonValue>,
pub classification_status: String,
#[sea_orm(column_type = "Text", nullable)]
pub classification_notes: Option<String>,
pub sync_status: String,
pub synced_to_l2_commit: Option<String>,
pub synced_at: Option<DateTimeUtc>,
#[sea_orm(column_type = "Text")]
pub api_url: String,
pub fetched_at: DateTimeUtc,
pub files_changed_count: i32,
pub additions: i32,
pub deletions: i32,
pub created_at: DateTimeUtc,
pub updated_at: DateTimeUtc,
#[sea_orm(nullable)]
pub spec_version: Option<String>,
#[sea_orm(nullable)]
pub spec_release: Option<String>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::tracking::Entity",
from = "Column::TrackingId",
to = "super::tracking::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
Tracking,
}
impl Related<super::tracking::Entity> for Entity {
fn to() -> RelationDef {
Relation::Tracking.def()
}
}
impl ActiveModelBehavior for ActiveModel {}