remove crypto balance from backend
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# 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
|
||||
# user_id :bigint not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_balances_on_user_id (user_id)
|
||||
#
|
||||
# Foreign Keys
|
||||
#
|
||||
# fk_rails_... (user_id => users.id)
|
||||
#
|
||||
class Balance < ApplicationRecord
|
||||
include Trackable
|
||||
|
||||
belongs_to :user
|
||||
|
||||
validates :amount, presence: true, numericality: { greater_than_or_equal_to: 0 }
|
||||
|
||||
def withdrawal!(value)
|
||||
update!(amount: amount - value)
|
||||
end
|
||||
|
||||
def deposit!(value)
|
||||
update!(amount: amount + value)
|
||||
end
|
||||
end
|
||||
@@ -29,7 +29,6 @@ class User < ApplicationRecord
|
||||
|
||||
has_many :documents, class_name: "UserDocument", dependent: :destroy
|
||||
has_many :stake_orders, 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