add new column

This commit is contained in:
olegphenomenon 2022-04-13 09:25:44 +03:00
parent 77249629bb
commit d8c0ba2432
7 changed files with 16 additions and 3 deletions

View file

@ -24,7 +24,7 @@ module Admin
end end
def create def create
auction = Auction.new(domain: params[:domain], status: Auction.statuses[:started]) auction = Auction.new(domain: params[:domain], status: Auction.statuses[:started], platform: :english)
if auction.save if auction.save
remove_from_reserved(auction) remove_from_reserved(auction)
@ -41,7 +41,7 @@ module Admin
table.each do |row| table.each do |row|
record = row.to_h record = row.to_h
auction = Auction.new(domain: record['name'], status: Auction.statuses[:started]) auction = Auction.new(domain: record['name'], status: Auction.statuses[:started], platform: :english)
remove_from_reserved(auction) if auction.save! remove_from_reserved(auction) if auction.save!
end end

View file

@ -58,7 +58,7 @@ module Admin
reserved_domains = ReservedDomain.where(id: reserved_domains_ids) reserved_domains = ReservedDomain.where(id: reserved_domains_ids)
reserved_domains.each do |domain| reserved_domains.each do |domain|
Auction.create!(domain: domain.name, status: Auction.statuses[:started]) Auction.create!(domain: domain.name, status: Auction.statuses[:started], platform: :english)
domain.destroy! domain.destroy!
end end

View file

@ -9,6 +9,8 @@ class Auction < ApplicationRecord
domain_not_registered: 'domain_not_registered', domain_not_registered: 'domain_not_registered',
} }
enum type: %i[blind english]
PENDING_STATUSES = [statuses[:started], PENDING_STATUSES = [statuses[:started],
statuses[:awaiting_payment], statuses[:awaiting_payment],
statuses[:payment_received]].freeze statuses[:payment_received]].freeze

View file

@ -35,6 +35,7 @@ module DNS
def sell_at_auction def sell_at_auction
auction = Auction.new auction = Auction.new
auction.domain = name auction.domain = name
auction.platform = :blind
auction.start auction.start
ToStdout.msg "Created the auction: #{auction.inspect}" ToStdout.msg "Created the auction: #{auction.inspect}"
update_whois_from_auction(auction) update_whois_from_auction(auction)

View file

@ -114,6 +114,9 @@
<th class="col-xs-2"> <th class="col-xs-2">
<%= sort_link(@q, 'registration_deadline') %> <%= sort_link(@q, 'registration_deadline') %>
</th> </th>
<th class="col-xs-2">
<%= sort_link(@q, 'type') %>
</th>
</tr> </tr>
</thead> </thead>
@ -126,6 +129,7 @@
<td><%= auction.created_at %></td> <td><%= auction.created_at %></td>
<td><%= auction.registration_code %></td> <td><%= auction.registration_code %></td>
<td><%= auction.registration_deadline %></td> <td><%= auction.registration_deadline %></td>
<td><%= auction.platform %></td>
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>

View file

@ -0,0 +1,5 @@
class AddTypeToAuction < ActiveRecord::Migration[6.1]
def change
# add_column :auctions, :type, :integer, null: true
end
end

View file

@ -5090,3 +5090,4 @@ INSERT INTO "schema_migrations" (version) VALUES
('20220124105717'), ('20220124105717'),
('20220216113112'), ('20220216113112'),
('20220228093211'); ('20220228093211');
('20220412130856');