Skip to content

Commit

Permalink
fix: remove unnecessary function
Browse files Browse the repository at this point in the history
  • Loading branch information
MarioRodrigues10 committed Dec 2, 2023
1 parent a9b8bf2 commit ff39e45
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions lib/store/inventory.ex
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ defmodule Store.Inventory do
alias Store.Accounts.User

def purchase(%User{} = user, %Product{} = product, product_params) do
order = get_user_draft_order(user)
order = get_order_draft_by_id(user.id, preloads: [])

case order do
%Order{} ->
Expand All @@ -355,13 +355,6 @@ defmodule Store.Inventory do
end
end

defp get_user_draft_order(user) do
Order
|> where(user_id: ^user.id, status: :draft)
|> Repo.one()
|> Repo.preload([:user, :products])
end

defp handle_existing_order(order, product, product_params) do
quantity = String.to_integer(product_params["quantity"])

Expand Down

0 comments on commit ff39e45

Please sign in to comment.