From 933f71d2d999762b6349790c51462d073eff6cfa Mon Sep 17 00:00:00 2001 From: yenicelik Date: Sun, 19 Feb 2023 21:54:23 +0100 Subject: [PATCH] should be ok now again --- entities/src/mod.rs | 2 - entities/src/prelude.rs | 2 - entities/src/referral.rs | 43 ----------- entities/src/rpc_request.rs | 33 -------- .../src/m20230205_130035_create_credits.rs | 66 ---------------- .../src/m20230205_133204_create_requests.rs | 70 ----------------- .../src/m20230205_133755_create_referrals.rs | 77 ------------------- web3_proxy/src/bin/web3_proxy_cli/main.rs | 11 +-- 8 files changed, 1 insertion(+), 303 deletions(-) delete mode 100644 entities/src/referral.rs delete mode 100644 entities/src/rpc_request.rs delete mode 100644 migration/src/m20230205_130035_create_credits.rs delete mode 100644 migration/src/m20230205_133204_create_requests.rs delete mode 100644 migration/src/m20230205_133755_create_referrals.rs diff --git a/entities/src/mod.rs b/entities/src/mod.rs index 627d1d6f..2121477c 100644 --- a/entities/src/mod.rs +++ b/entities/src/mod.rs @@ -6,11 +6,9 @@ pub mod admin; pub mod admin_trail; pub mod login; pub mod pending_login; -pub mod referral; pub mod revert_log; pub mod rpc_accounting; pub mod rpc_key; -pub mod rpc_request; pub mod sea_orm_active_enums; pub mod secondary_user; pub mod serialization; diff --git a/entities/src/prelude.rs b/entities/src/prelude.rs index ad1ac9a9..bb19388d 100644 --- a/entities/src/prelude.rs +++ b/entities/src/prelude.rs @@ -10,5 +10,3 @@ pub use super::rpc_key::Entity as RpcKey; pub use super::secondary_user::Entity as SecondaryUser; pub use super::user::Entity as User; pub use super::user_tier::Entity as UserTier; -pub use super::referral::Entity as Referral; -pub use super::rpc_request::Entity as RpcRequest; diff --git a/entities/src/referral.rs b/entities/src/referral.rs deleted file mode 100644 index 0a8b5059..00000000 --- a/entities/src/referral.rs +++ /dev/null @@ -1,43 +0,0 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.10.6 - -use sea_orm::entity::prelude::*; - -#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)] -#[sea_orm(table_name = "referral")] -pub struct Model { - #[sea_orm(primary_key)] - pub id: i32, - #[sea_orm(unique)] - pub referral_code: String, - pub used_referral_code: Option, - #[sea_orm(unique)] - pub user_id: u64, -} - -#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] -pub enum Relation { - #[sea_orm( - belongs_to = "Entity", - from = "Column::UsedReferralCode", - to = "Column::ReferralCode", - on_update = "NoAction", - on_delete = "NoAction" - )] - SelfRef, - #[sea_orm( - belongs_to = "super::user::Entity", - from = "Column::UserId", - to = "super::user::Column::Id", - on_update = "NoAction", - on_delete = "NoAction" - )] - User, -} - -impl Related for Entity { - fn to() -> RelationDef { - Relation::User.def() - } -} - -impl ActiveModelBehavior for ActiveModel {} diff --git a/entities/src/rpc_request.rs b/entities/src/rpc_request.rs deleted file mode 100644 index 186ec589..00000000 --- a/entities/src/rpc_request.rs +++ /dev/null @@ -1,33 +0,0 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.10.6 - -use sea_orm::entity::prelude::*; - -#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)] -#[sea_orm(table_name = "rpc_request")] -pub struct Model { - #[sea_orm(primary_key)] - pub id: i32, - pub tx_hash: Option, - pub chain: String, - pub user_id: u64, -} - -#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] -pub enum Relation { - #[sea_orm( - belongs_to = "super::user::Entity", - from = "Column::UserId", - to = "super::user::Column::Id", - on_update = "NoAction", - on_delete = "NoAction" - )] - User, -} - -impl Related for Entity { - fn to() -> RelationDef { - Relation::User.def() - } -} - -impl ActiveModelBehavior for ActiveModel {} diff --git a/migration/src/m20230205_130035_create_credits.rs b/migration/src/m20230205_130035_create_credits.rs deleted file mode 100644 index 01499910..00000000 --- a/migration/src/m20230205_130035_create_credits.rs +++ /dev/null @@ -1,66 +0,0 @@ -use sea_orm_migration::prelude::*; - -#[derive(DeriveMigrationName)] -pub struct Migration; - -#[async_trait::async_trait] -impl MigrationTrait for Migration { - async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> { - manager - .create_table( - Table::create() - .table(Credits::Table) - .if_not_exists() - .col( - ColumnDef::new(Credits::Id) - .integer() - .not_null() - .auto_increment() - .primary_key(), - ) - .col( - ColumnDef::new(Credits::Credits) - .big_unsigned() - .not_null() - .default(0) - ) - .col( - ColumnDef::new(Credits::UserId) - .big_unsigned() - .unique_key() - .not_null() - ) - .foreign_key( - sea_query::ForeignKey::create() - .from(Credits::Table, Credits::UserId) - .to(User::Table, User::Id), - ) - .to_owned(), - ) - .await - } - - async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> { - manager - .drop_table(Table::drop().table(Credits::Table).to_owned()) - .await - } -} - -/// Learn more at https://docs.rs/sea-query#iden -#[derive(Iden)] -enum Credits { - Table, - Id, - UserId, - Credits, -} - -#[derive(Iden)] -enum User { - Table, - Id, - Address, - Description, - Email, -} \ No newline at end of file diff --git a/migration/src/m20230205_133204_create_requests.rs b/migration/src/m20230205_133204_create_requests.rs deleted file mode 100644 index 061584fb..00000000 --- a/migration/src/m20230205_133204_create_requests.rs +++ /dev/null @@ -1,70 +0,0 @@ -use sea_orm_migration::prelude::*; - -#[derive(DeriveMigrationName)] -pub struct Migration; - -#[async_trait::async_trait] -impl MigrationTrait for Migration { - async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> { - manager - .create_table( - Table::create() - .table(RpcRequest::Table) - .if_not_exists() - .col( - ColumnDef::new(RpcRequest::Id) - .integer() - .not_null() - .auto_increment() - .primary_key(), - ) - .col( - ColumnDef::new(RpcRequest::TxHash) - .string() - ) - // TODO: Should eventually be an enum ... - .col( - ColumnDef::new(RpcRequest::Chain) - .string() - .not_null() - ) - .col( - ColumnDef::new(RpcRequest::UserId) - .big_unsigned() - .not_null() - ) - .foreign_key( - sea_query::ForeignKey::create() - .from(RpcRequest::Table, RpcRequest::UserId) - .to(User::Table, User::Id), - ) - .to_owned(), - ) - .await - } - - async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> { - manager - .drop_table(Table::drop().table(RpcRequest::Table).to_owned()) - .await - } -} - -/// Learn more at https://docs.rs/sea-query#iden -#[derive(Iden)] -enum RpcRequest { - Table, - Id, - UserId, - TxHash, - Chain -} - -#[derive(Iden)] -enum User { - Table, - Id, - Address, - Description, - Email, -} \ No newline at end of file diff --git a/migration/src/m20230205_133755_create_referrals.rs b/migration/src/m20230205_133755_create_referrals.rs deleted file mode 100644 index a74416dc..00000000 --- a/migration/src/m20230205_133755_create_referrals.rs +++ /dev/null @@ -1,77 +0,0 @@ -use sea_orm_migration::prelude::*; - -#[derive(DeriveMigrationName)] -pub struct Migration; - -#[async_trait::async_trait] -impl MigrationTrait for Migration { - async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> { - manager - .create_table( - Table::create() - .table(Referral::Table) - .if_not_exists() - .col( - ColumnDef::new(Referral::Id) - .integer() - .not_null() - .auto_increment() - .primary_key(), - ) - .col( - ColumnDef::new(Referral::ReferralCode) - .string() - .unique_key() - .not_null() - ) - .col( - ColumnDef::new(Referral::UsedReferralCode) - .string() - ) - // Basically, this links to who invited the user ... - .foreign_key( - sea_query::ForeignKey::create() - .from(Referral::Table, Referral::UsedReferralCode) - .to(Referral::Table, Referral::ReferralCode), - ) - .col( - ColumnDef::new(Referral::UserId) - .big_unsigned() - .unique_key() - .not_null() - ) - .foreign_key( - sea_query::ForeignKey::create() - .from(Referral::Table, Referral::UserId) - .to(User::Table, User::Id), - ) - .to_owned(), - ) - .await - } - - async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> { - manager - .drop_table(Table::drop().table(Referral::Table).to_owned()) - .await - } -} - -/// Learn more at https://docs.rs/sea-query#iden -#[derive(Iden)] -enum Referral { - Table, - Id, - UserId, - ReferralCode, - UsedReferralCode -} - -#[derive(Iden)] -enum User { - Table, - Id, - Address, - Description, - Email, -} diff --git a/web3_proxy/src/bin/web3_proxy_cli/main.rs b/web3_proxy/src/bin/web3_proxy_cli/main.rs index 4f17aecc..0827dd18 100644 --- a/web3_proxy/src/bin/web3_proxy_cli/main.rs +++ b/web3_proxy/src/bin/web3_proxy_cli/main.rs @@ -291,7 +291,7 @@ fn main() -> anyhow::Result<()> { SubCommand::ChangeUserAdminStatus(x) => { let db_url = cli_config .db_url - .expect("'--config' (with a db) or '--db-url' is required to run change user admin status"); + .expect("'--config' (with a db) or '--db-url' is required to run change_user_admin_status"); let db_conn = get_db(db_url, 1, 1).await?; @@ -306,15 +306,6 @@ fn main() -> anyhow::Result<()> { x.main(&db_conn).await } - SubCommand::ChangeUserAdminStatus(x) => { - let db_url = cli_config - .db_url - .expect("'--config' (with a db) or '--db-url' is required to run change_user_admin_status"); - - let db_conn = get_db(db_url, 1, 1).await?; - - x.main(&db_conn).await - } SubCommand::ChangeUserTierByAddress(x) => { let db_url = cli_config .db_url