Skip to content
Clone

refactor: drop platform tables now owned by KenShell

Comment threads and both protection policy tables were superseded by the
KenShell equivalents in the previous two commits and are no longer read or
written anywhere.
ZhenYi committed
parent 4667de2 commit 23b64ff Browse files

6 files changed

+0 −165

File tree 6
Deleted lib/share/models/src/repo/code_comment.rs
@@ -1,36 +0,0 @@
1use sea_orm::entity::prelude::*;
2use time::OffsetDateTime;
3use uuid::Uuid;
4
5#[sea_orm::model]
6#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
7#[sea_orm(table_name = "code_comment")]
8pub struct Model {
9 #[sea_orm(primary_key, auto_increment = false)]
10 pub id: Uuid,
11 #[sea_orm(indexed)]
12 pub repo_id: Uuid,
13 #[sea_orm(indexed)]
14 pub path: String,
15 pub line: i32,
16 #[sea_orm(indexed)]
17 pub commit_sha: String,
18 pub author_id: i64,
19 #[sea_orm(indexed)]
20 pub parent_id: Option<Uuid>,
21 pub body: String,
22 pub resolved_at: Option<OffsetDateTime>,
23 pub resolved_by: Option<i64>,
24 pub created_at: OffsetDateTime,
25 pub updated_at: Option<OffsetDateTime>,
26 #[sea_orm(belongs_to, from = "repo_id", to = "id")]
27 pub repo: BelongsTo<crate::repo::repos::Entity>,
28 #[sea_orm(belongs_to, relation_enum = "Author", from = "author_id", to = "uid")]
29 pub author: BelongsTo<crate::users::user::Entity>,
30 #[sea_orm(belongs_to, from = "resolved_by", to = "uid")]
31 pub resolver: BelongsTo<Option<crate::users::user::Entity>>,
32 #[sea_orm(belongs_to, relation_enum = "Parent", from = "parent_id", to = "id")]
33 pub parent: BelongsTo<Option<crate::repo::code_comment::Entity>>,
34}
35
36impl ActiveModelBehavior for ActiveModel {}
Modified lib/share/models/src/repo/mod.rs View lib/share/models/src/repo/mod.rs
@@ -1,13 +1,8 @@
1pub mod code_comment;
2pub mod repo_branch_protection_policy;
3pub mod repo_branch_protection_whitelists;
41pub mod repo_collaborations;
52pub mod repo_license;
63pub mod repo_relation_topic;
74pub mod repo_release;
85pub mod repo_star;
9pub mod repo_tag_protection_policy;
10pub mod repo_tag_protection_whitelists;
116pub mod repo_topic;
127pub mod repo_watch;
138pub mod repos;
Deleted lib/share/models/src/repo/repo_branch_protection_policy.rs
@@ -1,35 +0,0 @@
1use sea_orm::entity::prelude::*;
2use time::OffsetDateTime;
3use uuid::Uuid;
4
5#[sea_orm::model]
6#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
7#[sea_orm(table_name = "repo_branch_protection_policy")]
8pub struct Model {
9 #[sea_orm(primary_key, auto_increment = false)]
10 pub id: Uuid,
11 pub repo_id: Uuid,
12 pub branch_pattern: String,
13 pub enable_push: bool,
14 pub enable_push_whitelist: bool,
15 pub push_whitelist_deploy_keys: bool,
16 pub enable_merge_whitelist: bool,
17 pub required_approvals: i32,
18 pub enable_approvals_whitelist: bool,
19 pub block_on_rejected_reviews: bool,
20 pub block_on_change_requested_reviews: bool,
21 pub block_on_outdated_branch: bool,
22 pub dismiss_stale_approvals: bool,
23 pub require_signed_commits: bool,
24 pub protected_file_patterns: String,
25 pub unprotected_file_patterns: String,
26 pub enable_force_push: bool,
27 #[sea_orm(default_value = "")]
28 pub required_status_contexts: String,
29 pub created_at: OffsetDateTime,
30 pub updated_at: OffsetDateTime,
31 #[sea_orm(belongs_to, from = "repo_id", to = "id")]
32 pub repo: BelongsTo<super::repos::Entity>,
33}
34
35impl ActiveModelBehavior for ActiveModel {}
Deleted lib/share/models/src/repo/repo_branch_protection_whitelists.rs
@@ -1,51 +0,0 @@
1use sea_orm::entity::prelude::*;
2use serde::{Deserialize, Serialize};
3use uuid::Uuid;
4
5#[derive(
6 Debug,
7 Clone,
8 Copy,
9 PartialEq,
10 Eq,
11 Default,
12 EnumIter,
13 DeriveActiveEnum,
14 Serialize,
15 Deserialize,
16 utoipa::ToSchema,
17)]
18#[sea_orm(rs_type = "i16", db_type = "SmallInteger")]
19pub enum WhitelistKind {
20 #[default]
21 #[sea_orm(num_value = 0)]
22 Push,
23 #[sea_orm(num_value = 1)]
24 Merge,
25 #[sea_orm(num_value = 2)]
26 Approval,
27}
28
29#[sea_orm::model]
30#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
31#[sea_orm(table_name = "repo_branch_protection_whitelist")]
32pub struct Model {
33 #[sea_orm(primary_key, auto_increment = false)]
34 pub id: Uuid,
35 #[sea_orm(unique_key = "policy_principal")]
36 pub policy_id: Uuid,
37 #[sea_orm(unique_key = "policy_principal")]
38 pub kind: WhitelistKind,
39 #[sea_orm(unique_key = "policy_principal")]
40 pub user_id: Option<i64>,
41 #[sea_orm(unique_key = "policy_principal")]
42 pub group_id: Option<Uuid>,
43 #[sea_orm(belongs_to, from = "policy_id", to = "id")]
44 pub policy: BelongsTo<super::repo_branch_protection_policy::Entity>,
45 #[sea_orm(belongs_to, from = "user_id", to = "uid")]
46 pub user: BelongsTo<Option<super::super::users::user::Entity>>,
47 #[sea_orm(belongs_to, from = "group_id", to = "id")]
48 pub group: BelongsTo<Option<super::super::space::space_groups::Entity>>,
49}
50
51impl ActiveModelBehavior for ActiveModel {}
Deleted lib/share/models/src/repo/repo_tag_protection_policy.rs
@@ -1,20 +0,0 @@
1use sea_orm::entity::prelude::*;
2use time::OffsetDateTime;
3use uuid::Uuid;
4
5#[sea_orm::model]
6#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
7#[sea_orm(table_name = "repo_tag_protection_policy")]
8pub struct Model {
9 #[sea_orm(primary_key, auto_increment = false)]
10 pub id: Uuid,
11 pub repo_id: Uuid,
12 pub name_pattern: String,
13 // 白名单用户见 repo_tag_protection_whitelist 关联表
14 pub created_at: OffsetDateTime,
15 pub updated_at: OffsetDateTime,
16 #[sea_orm(belongs_to, from = "repo_id", to = "id")]
17 pub repo: BelongsTo<super::repos::Entity>,
18}
19
20impl ActiveModelBehavior for ActiveModel {}
Deleted lib/share/models/src/repo/repo_tag_protection_whitelists.rs
@@ -1,18 +0,0 @@
1use sea_orm::entity::prelude::*;
2use uuid::Uuid;
3
4#[sea_orm::model]
5#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
6#[sea_orm(table_name = "repo_tag_protection_whitelist")]
7pub struct Model {
8 #[sea_orm(primary_key, auto_increment = false)]
9 pub policy_id: Uuid,
10 #[sea_orm(primary_key, auto_increment = false)]
11 pub user_id: i64,
12 #[sea_orm(belongs_to, from = "policy_id", to = "id")]
13 pub policy: BelongsTo<super::repo_tag_protection_policy::Entity>,
14 #[sea_orm(belongs_to, from = "user_id", to = "uid")]
15 pub user: BelongsTo<super::super::users::user::Entity>,
16}
17
18impl ActiveModelBehavior for ActiveModel {}