Skip to content

Commit

Permalink
Create log event on create order import
Browse files Browse the repository at this point in the history
  • Loading branch information
joaquinco committed Mar 6, 2025
1 parent 560fdfc commit 5a904da
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
27 changes: 20 additions & 7 deletions app/controllers/order_imports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,26 @@ def create_params
end

def create_order_import!
OrderImport.create!(
create_params.merge(
created_by: session_user.id,
upload_file: stored_file,
facility: @current_facility,
),
)
OrderImport.transaction do
order_import = OrderImport.create!(
create_params.merge(
created_by: session_user.id,
upload_file: stored_file,
facility: @current_facility,
),
)
LogEvent.log(
@current_facility,
:create_order_import,
current_user,
metadata: {
order_import_id: order_import.id,
filename: stored_file.name,
}
)

order_import
end
end

def import_exception_alert(exception)
Expand Down
1 change: 1 addition & 0 deletions config/locales/views/admin/en.log_events.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ en:
facility:
activate: Turned on all relays
deactivate: Turned off all relays
order_import_created: Bulk Order Import created
price_group:
create: Price Group created
delete: Price Group deleted
Expand Down

0 comments on commit 5a904da

Please sign in to comment.