feat: add location and proxy host entities with migrations
This commit is contained in:
46
public/database/src/generated/entities/location.rs
Normal file
46
public/database/src/generated/entities/location.rs
Normal file
@@ -0,0 +1,46 @@
|
||||
//! `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_protocol: Option<String>,
|
||||
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 {}
|
||||
@@ -3,6 +3,8 @@
|
||||
pub mod prelude;
|
||||
|
||||
pub mod config;
|
||||
pub mod location;
|
||||
pub mod proxy_host;
|
||||
pub mod upstream;
|
||||
pub mod upstream_target;
|
||||
pub mod user;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 2.0.0-rc.18
|
||||
|
||||
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::upstream::Entity as Upstream;
|
||||
pub use super::upstream_target::Entity as UpstreamTarget;
|
||||
pub use super::user::Entity as User;
|
||||
|
||||
48
public/database/src/generated/entities/proxy_host.rs
Normal file
48
public/database/src/generated/entities/proxy_host.rs
Normal file
@@ -0,0 +1,48 @@
|
||||
//! `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(
|
||||
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 {}
|
||||
@@ -17,6 +17,10 @@ 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 upstream_targets: HasMany<super::upstream_target::Entity>,
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@ pub struct Model {
|
||||
pub last_login_at: Option<DateTimeUtc>,
|
||||
pub deleted_at: Option<DateTimeUtc>,
|
||||
#[sea_orm(has_many)]
|
||||
pub proxy_hosts: HasMany<super::proxy_host::Entity>,
|
||||
#[sea_orm(has_many)]
|
||||
pub user_identities: HasMany<super::user_identity::Entity>,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user