remove currency model and all references
This commit is contained in:
@@ -4,28 +4,24 @@
|
||||
#
|
||||
# Table name: balances
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# amount :decimal(20, 10) default(0.0), not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# currency_id :bigint not null
|
||||
# user_id :bigint not null
|
||||
# id :bigint not null, primary key
|
||||
# amount :decimal(20, 10) default(0.0), not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# user_id :bigint not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_balances_on_currency_id (currency_id)
|
||||
# index_balances_on_user_id (user_id)
|
||||
# index_balances_on_user_id (user_id)
|
||||
#
|
||||
# Foreign Keys
|
||||
#
|
||||
# fk_rails_... (currency_id => currencies.id)
|
||||
# fk_rails_... (user_id => users.id)
|
||||
#
|
||||
class Balance < ApplicationRecord
|
||||
include Trackable
|
||||
|
||||
belongs_to :user
|
||||
belongs_to :currency
|
||||
|
||||
validates :amount, presence: true, numericality: { greater_than_or_equal_to: 0 }
|
||||
|
||||
|
||||
@@ -10,17 +10,14 @@
|
||||
# status :string not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# currency_id :bigint not null
|
||||
# user_id :bigint not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_buy_crypto_orders_on_currency_id (currency_id)
|
||||
# index_buy_crypto_orders_on_user_id (user_id)
|
||||
# index_buy_crypto_orders_on_user_id (user_id)
|
||||
#
|
||||
# Foreign Keys
|
||||
#
|
||||
# fk_rails_... (currency_id => currencies.id)
|
||||
# fk_rails_... (user_id => users.id)
|
||||
#
|
||||
class BuyCryptoOrder < ApplicationRecord
|
||||
@@ -28,7 +25,6 @@ class BuyCryptoOrder < ApplicationRecord
|
||||
include Notifiable
|
||||
|
||||
belongs_to :user
|
||||
belongs_to :currency
|
||||
|
||||
monetize :paid_amount_cents
|
||||
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: currencies
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# name :string not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
class Currency < ApplicationRecord
|
||||
validates :name, presence: true
|
||||
end
|
||||
@@ -10,17 +10,14 @@
|
||||
# status :string not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# currency_id :bigint not null
|
||||
# user_id :bigint not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_sell_crypto_orders_on_currency_id (currency_id)
|
||||
# index_sell_crypto_orders_on_user_id (user_id)
|
||||
# index_sell_crypto_orders_on_user_id (user_id)
|
||||
#
|
||||
# Foreign Keys
|
||||
#
|
||||
# fk_rails_... (currency_id => currencies.id)
|
||||
# fk_rails_... (user_id => users.id)
|
||||
#
|
||||
class SellCryptoOrder < ApplicationRecord
|
||||
@@ -28,7 +25,6 @@ class SellCryptoOrder < ApplicationRecord
|
||||
include Notifiable
|
||||
|
||||
belongs_to :user
|
||||
belongs_to :currency
|
||||
|
||||
monetize :received_amount_cents
|
||||
|
||||
@@ -41,7 +37,7 @@ class SellCryptoOrder < ApplicationRecord
|
||||
"
|
||||
💸 New sell crypto order! 💸\n
|
||||
user: #{user.email} \n
|
||||
amount: #{paid_amount} #{currency.name}
|
||||
amount: #{paid_amount} CAKE
|
||||
"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,23 +4,20 @@
|
||||
#
|
||||
# Table name: stake_orders
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# amount :decimal(20, 10) default(0.0), not null
|
||||
# pool_name :string not null
|
||||
# status :string not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# currency_id :bigint
|
||||
# user_id :bigint not null
|
||||
# id :bigint not null, primary key
|
||||
# amount :decimal(20, 10) default(0.0), not null
|
||||
# pool_name :string not null
|
||||
# status :string not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# user_id :bigint not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_stake_orders_on_currency_id (currency_id)
|
||||
# index_stake_orders_on_user_id (user_id)
|
||||
# index_stake_orders_on_user_id (user_id)
|
||||
#
|
||||
# Foreign Keys
|
||||
#
|
||||
# fk_rails_... (currency_id => currencies.id)
|
||||
# fk_rails_... (user_id => users.id)
|
||||
#
|
||||
class StakeOrder < ApplicationRecord
|
||||
@@ -28,7 +25,6 @@ class StakeOrder < ApplicationRecord
|
||||
include Notifiable
|
||||
|
||||
belongs_to :user
|
||||
belongs_to :currency
|
||||
|
||||
validates :pool_name, presence: true
|
||||
validates :amount, presence: true
|
||||
|
||||
@@ -29,7 +29,7 @@ class User < ApplicationRecord
|
||||
|
||||
has_many :documents, class_name: "UserDocument", dependent: :destroy
|
||||
has_many :stake_orders, dependent: :restrict_with_error
|
||||
has_many :balances, dependent: :restrict_with_error
|
||||
has_one :balance, dependent: :restrict_with_error
|
||||
has_one :fiat_balance, dependent: :restrict_with_error
|
||||
|
||||
validates :first_name, :last_name, :email, presence: true
|
||||
|
||||
Reference in New Issue
Block a user