Skip to content

Commit

Permalink
feat stock.rb: task #7
Browse files Browse the repository at this point in the history
 filter by status
  • Loading branch information
Pauloparakleto committed Dec 23, 2023
1 parent b1d7c53 commit 617adb8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/models/stock.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ def self.filter_by_total_balance_situation(balance_situation = :all)
where("total_balance #{balance_situation} ?", 0)
end

def self.filter_by_status(status_number = :all)
return all if status_number == :all

joins(:product).where(product: { active: status_number })
end

def self.synchronize_bling(tenant, bling_product_ids)
options = { idsProdutos: bling_product_ids }
results = Services::Bling::Stock.call(stock_command: 'find_stocks', tenant:, options:)
Expand Down

0 comments on commit 617adb8

Please sign in to comment.