2 Commits

Author SHA1 Message Date
a2cc7a97fd Added comment 2026-03-15 18:57:48 -04:00
7088550184 Removed ItemSyncJob as it was replaced withj QboSyncJob 2026-03-15 17:44:14 -04:00
2 changed files with 2 additions and 32 deletions

View File

@@ -12,6 +12,7 @@ class ItemsController < ApplicationController
before_action :require_login before_action :require_login
before_action :find_item, only: [:show, :edit, :update, :destroy] before_action :find_item, only: [:show, :edit, :update, :destroy]
# Used for autocomplete form
def autocomplete def autocomplete
term = ActiveRecord::Base.sanitize_sql_like(params[:q].to_s) term = ActiveRecord::Base.sanitize_sql_like(params[:q].to_s)
@@ -43,7 +44,7 @@ class ItemsController < ApplicationController
def edit def edit
end end
def index def index
@items = Item.order(:name) @items = Item.order(:name)
end end

View File

@@ -1,31 +0,0 @@
#The MIT License (MIT)
#
#Copyright (c) 2026 rick barrette
#
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
#
#The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
#
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
class ItemSyncJob < ApplicationJob
queue_as :default
retry_on StandardError, wait: 5.minutes, attempts: 5
# Performs a sync of items from QuickBooks Online.
def perform(full_sync: false, id: nil)
log "Starting #{full_sync ? 'full' : 'incremental'} sync for item ##{id || 'all'}..."
service = ItemSyncService.new
if id.present?
service.sync_by_id(id)
else
service.sync(full_sync: full_sync)
end
end
private
def log(msg)
Rails.logger.info "[ItemSyncJob] #{msg}"
end
end