add createStakeOrder mutation

This commit is contained in:
João Geonizeli
2021-08-16 15:14:48 -03:00
parent 17d502430f
commit c1bd034f5a
11 changed files with 335 additions and 152 deletions

View File

@@ -0,0 +1,6 @@
# frozen_string_literal: true
class AddCurrencyToStakeOrder < ActiveRecord::Migration[6.1]
def change
add_reference(:stake_orders, :currency, foreign_key: true)
end
end

5
db/schema.rb generated
View File

@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2021_08_16_032056) do
ActiveRecord::Schema.define(version: 2021_08_16_174637) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -111,6 +111,8 @@ ActiveRecord::Schema.define(version: 2021_08_16_032056) do
t.decimal "amount", precision: 20, scale: 10, default: "0.0", null: false
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.bigint "currency_id"
t.index ["currency_id"], name: "index_stake_orders_on_currency_id"
t.index ["user_id"], name: "index_stake_orders_on_user_id"
end
@@ -145,6 +147,7 @@ ActiveRecord::Schema.define(version: 2021_08_16_032056) do
add_foreign_key "fiat_balances", "users"
add_foreign_key "sell_crypto_orders", "currencies"
add_foreign_key "sell_crypto_orders", "users"
add_foreign_key "stake_orders", "currencies"
add_foreign_key "stake_orders", "users"
add_foreign_key "user_documents", "users"
end

View File

@@ -2,19 +2,11 @@
AdminUser.create!(email: "admin@example.com", password: "password")
user = User.create!(
Currency.create!(name: "CAKE")
User.create!(
first_name: "Test",
last_name: "User",
email: "user@example.com",
password: "password"
)
currency = Currency.create!(name: "CAKE")
Balance.create!(
user_id: user.id,
currency_id: currency.id,
amount: rand * 10000
)
FiatBalance.create!(user_id: user.id, amount_cents: 15000)