should be ok now again
This commit is contained in:
parent
a7161790f1
commit
933f71d2d9
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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<String>,
|
||||
#[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<super::user::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::User.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
@ -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<String>,
|
||||
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<super::user::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::User.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
@ -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,
|
||||
}
|
@ -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,
|
||||
}
|
@ -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,
|
||||
}
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user