Refactor database schema: Remove access list and related entities, add editing session and edit operation entities
- Deleted `access_list_entry`, `location`, `proxy_host`, `proxy_host_access_list`, `session`, `stream_service`, `stream_service_access_list` entities and their corresponding migration files. - Introduced `editing_session` and `edit_operation` entities with appropriate fields and relationships. - Updated `mod.rs` and `prelude.rs` to reflect the changes in the entity structure. - Adjusted migration files to remove obsolete migrations and include new migrations for the editing session and edit operation tables.
This commit is contained in:
@@ -1,34 +0,0 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 2.0.0-rc.18
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[sea_orm::model]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Serialize, Deserialize)]
|
||||
#[sea_orm(table_name = "access_list")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub id: Uuid,
|
||||
pub name: String,
|
||||
#[sea_orm(column_type = "Text", nullable)]
|
||||
pub description: Option<String>,
|
||||
pub created_by: Option<Uuid>,
|
||||
pub created_at: DateTimeUtc,
|
||||
pub updated_at: DateTimeUtc,
|
||||
#[sea_orm(has_many)]
|
||||
pub access_list_entries: HasMany<super::access_list_entry::Entity>,
|
||||
#[sea_orm(has_many)]
|
||||
pub proxy_host_access_lists: HasMany<super::proxy_host_access_list::Entity>,
|
||||
#[sea_orm(has_many)]
|
||||
pub stream_service_access_lists: HasMany<super::stream_service_access_list::Entity>,
|
||||
#[sea_orm(
|
||||
belongs_to,
|
||||
from = "created_by",
|
||||
to = "id",
|
||||
on_update = "Cascade",
|
||||
on_delete = "SetNull"
|
||||
)]
|
||||
pub user: HasOne<super::user::Entity>,
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
@@ -1,28 +0,0 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 2.0.0-rc.18
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[sea_orm::model]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Serialize, Deserialize)]
|
||||
#[sea_orm(table_name = "access_list_entry")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub id: Uuid,
|
||||
pub access_list_id: Uuid,
|
||||
pub entry_type: String,
|
||||
pub value: String,
|
||||
#[sea_orm(column_type = "Text", nullable)]
|
||||
pub comment: Option<String>,
|
||||
pub created_at: DateTimeUtc,
|
||||
#[sea_orm(
|
||||
belongs_to,
|
||||
from = "access_list_id",
|
||||
to = "id",
|
||||
on_update = "Cascade",
|
||||
on_delete = "Cascade"
|
||||
)]
|
||||
pub access_list: HasOne<super::access_list::Entity>,
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
@@ -5,25 +5,26 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
#[sea_orm::model]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Serialize, Deserialize)]
|
||||
#[sea_orm(table_name = "audit_log")]
|
||||
#[sea_orm(table_name = "edit_operation")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub id: Uuid,
|
||||
pub actor_id: Option<Uuid>,
|
||||
pub action: String,
|
||||
pub session_id: Uuid,
|
||||
pub resource_type: String,
|
||||
pub resource_id: String,
|
||||
#[sea_orm(column_type = "JsonBinary", nullable)]
|
||||
pub details: Option<Json>,
|
||||
pub resource_id: Option<Uuid>,
|
||||
pub operation_type: String,
|
||||
#[sea_orm(column_type = "JsonBinary")]
|
||||
pub payload: Json,
|
||||
pub created_at: DateTimeUtc,
|
||||
pub applied_at: Option<DateTimeUtc>,
|
||||
#[sea_orm(
|
||||
belongs_to,
|
||||
from = "actor_id",
|
||||
from = "session_id",
|
||||
to = "id",
|
||||
on_update = "Cascade",
|
||||
on_delete = "SetNull"
|
||||
on_delete = "Cascade"
|
||||
)]
|
||||
pub user: HasOne<super::user::Entity>,
|
||||
pub editing_session: HasOne<super::editing_session::Entity>,
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
23
public/database/src/generated/entities/editing_session.rs
Normal file
23
public/database/src/generated/entities/editing_session.rs
Normal file
@@ -0,0 +1,23 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 2.0.0-rc.18
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[sea_orm::model]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Serialize, Deserialize)]
|
||||
#[sea_orm(table_name = "editing_session")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub id: Uuid,
|
||||
pub name: Option<String>,
|
||||
pub created_by: Option<Uuid>,
|
||||
pub status: String,
|
||||
pub created_at: DateTimeUtc,
|
||||
pub applied_at: Option<DateTimeUtc>,
|
||||
pub applied_by: Option<Uuid>,
|
||||
pub expires_at: Option<DateTimeUtc>,
|
||||
#[sea_orm(has_many)]
|
||||
pub edit_operations: HasMany<super::edit_operation::Entity>,
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
@@ -1,45 +0,0 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 2.0.0-rc.18
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[sea_orm::model]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Serialize, Deserialize)]
|
||||
#[sea_orm(table_name = "location")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub id: Uuid,
|
||||
pub host_id: Uuid,
|
||||
pub path: String,
|
||||
pub match_type: String,
|
||||
pub order: i64,
|
||||
pub upstream_id: Option<Uuid>,
|
||||
pub proxy_pass_host: Option<String>,
|
||||
pub proxy_pass_port: Option<i64>,
|
||||
pub preserve_host_header: Option<bool>,
|
||||
#[sea_orm(column_type = "JsonBinary", nullable)]
|
||||
pub allowed_methods: Option<Json>,
|
||||
#[sea_orm(column_type = "Text", nullable)]
|
||||
pub custom_config: Option<String>,
|
||||
pub enabled: bool,
|
||||
pub created_at: DateTimeUtc,
|
||||
pub updated_at: DateTimeUtc,
|
||||
#[sea_orm(
|
||||
belongs_to,
|
||||
from = "host_id",
|
||||
to = "id",
|
||||
on_update = "Cascade",
|
||||
on_delete = "Cascade"
|
||||
)]
|
||||
pub proxy_host: HasOne<super::proxy_host::Entity>,
|
||||
#[sea_orm(
|
||||
belongs_to,
|
||||
from = "upstream_id",
|
||||
to = "id",
|
||||
on_update = "Cascade",
|
||||
on_delete = "SetNull"
|
||||
)]
|
||||
pub upstream: HasOne<super::upstream::Entity>,
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
@@ -2,14 +2,9 @@
|
||||
|
||||
pub mod prelude;
|
||||
|
||||
pub mod access_list;
|
||||
pub mod access_list_entry;
|
||||
pub mod config;
|
||||
pub mod location;
|
||||
pub mod proxy_host;
|
||||
pub mod proxy_host_access_list;
|
||||
pub mod stream_service;
|
||||
pub mod stream_service_access_list;
|
||||
pub mod edit_operation;
|
||||
pub mod editing_session;
|
||||
pub mod upstream;
|
||||
pub mod upstream_target;
|
||||
pub mod user;
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 2.0.0-rc.18
|
||||
|
||||
pub use super::access_list::Entity as AccessList;
|
||||
pub use super::access_list_entry::Entity as AccessListEntry;
|
||||
pub use super::config::Entity as Config;
|
||||
pub use super::location::Entity as Location;
|
||||
pub use super::proxy_host::Entity as ProxyHost;
|
||||
pub use super::proxy_host_access_list::Entity as ProxyHostAccessList;
|
||||
pub use super::stream_service::Entity as StreamService;
|
||||
pub use super::stream_service_access_list::Entity as StreamServiceAccessList;
|
||||
pub use super::edit_operation::Entity as EditOperation;
|
||||
pub use super::editing_session::Entity as EditingSession;
|
||||
pub use super::upstream::Entity as Upstream;
|
||||
pub use super::upstream_target::Entity as UpstreamTarget;
|
||||
pub use super::user::Entity as User;
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 2.0.0-rc.18
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[sea_orm::model]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Serialize, Deserialize)]
|
||||
#[sea_orm(table_name = "proxy_host")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub id: Uuid,
|
||||
pub name: Option<String>,
|
||||
pub domain: String,
|
||||
pub scheme: String,
|
||||
pub listen_port: i64,
|
||||
pub forward_scheme: String,
|
||||
pub forward_host: Option<String>,
|
||||
pub forward_port: Option<i64>,
|
||||
pub preserve_host_header: bool,
|
||||
pub enable_websocket: bool,
|
||||
pub enabled: bool,
|
||||
#[sea_orm(column_type = "JsonBinary", nullable)]
|
||||
pub meta: Option<Json>,
|
||||
pub default_upstream_id: Option<Uuid>,
|
||||
pub created_by: Option<Uuid>,
|
||||
pub created_at: DateTimeUtc,
|
||||
pub updated_at: DateTimeUtc,
|
||||
#[sea_orm(has_many)]
|
||||
pub locations: HasMany<super::location::Entity>,
|
||||
#[sea_orm(has_many)]
|
||||
pub proxy_host_access_lists: HasMany<super::proxy_host_access_list::Entity>,
|
||||
#[sea_orm(
|
||||
belongs_to,
|
||||
from = "default_upstream_id",
|
||||
to = "id",
|
||||
on_update = "Cascade",
|
||||
on_delete = "SetNull"
|
||||
)]
|
||||
pub upstream: HasOne<super::upstream::Entity>,
|
||||
#[sea_orm(
|
||||
belongs_to,
|
||||
from = "created_by",
|
||||
to = "id",
|
||||
on_update = "Cascade",
|
||||
on_delete = "SetNull"
|
||||
)]
|
||||
pub user: HasOne<super::user::Entity>,
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
@@ -1,33 +0,0 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 2.0.0-rc.18
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[sea_orm::model]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Serialize, Deserialize)]
|
||||
#[sea_orm(table_name = "proxy_host_access_list")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub id: Uuid,
|
||||
pub proxy_host_id: Uuid,
|
||||
pub access_list_id: Uuid,
|
||||
pub created_at: DateTimeUtc,
|
||||
#[sea_orm(
|
||||
belongs_to,
|
||||
from = "access_list_id",
|
||||
to = "id",
|
||||
on_update = "Cascade",
|
||||
on_delete = "Cascade"
|
||||
)]
|
||||
pub access_list: HasOne<super::access_list::Entity>,
|
||||
#[sea_orm(
|
||||
belongs_to,
|
||||
from = "proxy_host_id",
|
||||
to = "id",
|
||||
on_update = "Cascade",
|
||||
on_delete = "Cascade"
|
||||
)]
|
||||
pub proxy_host: HasOne<super::proxy_host::Entity>,
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
@@ -1,29 +0,0 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 2.0.0-rc.18
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[sea_orm::model]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Serialize, Deserialize)]
|
||||
#[sea_orm(table_name = "session")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub id: Uuid,
|
||||
pub user_id: Uuid,
|
||||
#[sea_orm(unique)]
|
||||
pub refresh_token_hash: Option<String>,
|
||||
pub expires_at: DateTimeUtc,
|
||||
pub revoked_at: Option<DateTimeUtc>,
|
||||
pub created_at: DateTimeUtc,
|
||||
pub updated_at: DateTimeUtc,
|
||||
#[sea_orm(
|
||||
belongs_to,
|
||||
from = "user_id",
|
||||
to = "id",
|
||||
on_update = "Cascade",
|
||||
on_delete = "Cascade"
|
||||
)]
|
||||
pub user: HasOne<super::user::Entity>,
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
@@ -1,47 +0,0 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 2.0.0-rc.18
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[sea_orm::model]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Serialize, Deserialize)]
|
||||
#[sea_orm(table_name = "stream_service")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub id: Uuid,
|
||||
pub name: Option<String>,
|
||||
pub listen_host: String,
|
||||
pub listen_port: i64,
|
||||
pub protocol: String,
|
||||
pub mode: String,
|
||||
pub forward_host: Option<String>,
|
||||
pub forward_port: Option<i64>,
|
||||
pub upstream_id: Option<Uuid>,
|
||||
pub preserved_client_ip: bool,
|
||||
pub enabled: bool,
|
||||
#[sea_orm(column_type = "JsonBinary", nullable)]
|
||||
pub meta: Option<Json>,
|
||||
pub created_by: Option<Uuid>,
|
||||
pub created_at: DateTimeUtc,
|
||||
pub updated_at: DateTimeUtc,
|
||||
#[sea_orm(has_many)]
|
||||
pub stream_service_access_lists: HasMany<super::stream_service_access_list::Entity>,
|
||||
#[sea_orm(
|
||||
belongs_to,
|
||||
from = "upstream_id",
|
||||
to = "id",
|
||||
on_update = "Cascade",
|
||||
on_delete = "SetNull"
|
||||
)]
|
||||
pub upstream: HasOne<super::upstream::Entity>,
|
||||
#[sea_orm(
|
||||
belongs_to,
|
||||
from = "created_by",
|
||||
to = "id",
|
||||
on_update = "Cascade",
|
||||
on_delete = "SetNull"
|
||||
)]
|
||||
pub user: HasOne<super::user::Entity>,
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
@@ -1,33 +0,0 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 2.0.0-rc.18
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[sea_orm::model]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Serialize, Deserialize)]
|
||||
#[sea_orm(table_name = "stream_service_access_list")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub id: Uuid,
|
||||
pub stream_service_id: Uuid,
|
||||
pub access_list_id: Uuid,
|
||||
pub created_at: DateTimeUtc,
|
||||
#[sea_orm(
|
||||
belongs_to,
|
||||
from = "access_list_id",
|
||||
to = "id",
|
||||
on_update = "Cascade",
|
||||
on_delete = "Cascade"
|
||||
)]
|
||||
pub access_list: HasOne<super::access_list::Entity>,
|
||||
#[sea_orm(
|
||||
belongs_to,
|
||||
from = "stream_service_id",
|
||||
to = "id",
|
||||
on_update = "Cascade",
|
||||
on_delete = "Cascade"
|
||||
)]
|
||||
pub stream_service: HasOne<super::stream_service::Entity>,
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
@@ -17,12 +17,6 @@ pub struct Model {
|
||||
pub created_at: DateTimeUtc,
|
||||
pub updated_at: DateTimeUtc,
|
||||
#[sea_orm(has_many)]
|
||||
pub locations: HasMany<super::location::Entity>,
|
||||
#[sea_orm(has_many)]
|
||||
pub proxy_hosts: HasMany<super::proxy_host::Entity>,
|
||||
#[sea_orm(has_many)]
|
||||
pub stream_services: HasMany<super::stream_service::Entity>,
|
||||
#[sea_orm(has_many)]
|
||||
pub upstream_targets: HasMany<super::upstream_target::Entity>,
|
||||
}
|
||||
|
||||
|
||||
@@ -18,12 +18,6 @@ pub struct Model {
|
||||
pub last_login_at: Option<DateTimeUtc>,
|
||||
pub deleted_at: Option<DateTimeUtc>,
|
||||
#[sea_orm(has_many)]
|
||||
pub access_lists: HasMany<super::access_list::Entity>,
|
||||
#[sea_orm(has_many)]
|
||||
pub proxy_hosts: HasMany<super::proxy_host::Entity>,
|
||||
#[sea_orm(has_many)]
|
||||
pub stream_services: HasMany<super::stream_service::Entity>,
|
||||
#[sea_orm(has_many)]
|
||||
pub user_identities: HasMany<super::user_identity::Entity>,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user