mirror of
https://github.com/rickbarrette/redmine_qbo_lineitems.git
synced 2026-04-02 07:01:59 -04:00
use set ID like we do with the other entities
This commit is contained in:
@@ -11,8 +11,9 @@
|
|||||||
class Item < ApplicationRecord
|
class Item < ApplicationRecord
|
||||||
belongs_to :issue
|
belongs_to :issue
|
||||||
|
|
||||||
validates :description, presence: true
|
validates_presence_of :id, :description
|
||||||
validates :unit_price, numericality: { greater_than_or_equal_to: 0 }
|
validates :unit_price, numericality: { greater_than_or_equal_to: 0 }
|
||||||
|
self.primary_key = :id
|
||||||
|
|
||||||
# Sync all employees, typically triggered by a scheduled task or manual sync request
|
# Sync all employees, typically triggered by a scheduled task or manual sync request
|
||||||
def self.sync
|
def self.sync
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class ItemSyncService < SyncServiceBase
|
|||||||
|
|
||||||
# Map relevant attributes from the QBO Employee to the local Employee model
|
# Map relevant attributes from the QBO Employee to the local Employee model
|
||||||
def process_attributes(local, remote)
|
def process_attributes(local, remote)
|
||||||
local.qbo_id = remote.id
|
local.id = remote.id
|
||||||
local.description = remote.description
|
local.description = remote.description
|
||||||
local.unit_price = remote.unit_price
|
local.unit_price = remote.unit_price
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
class CreateItems < ActiveRecord::Migration[7.0]
|
class CreateItems < ActiveRecord::Migration[7.0]
|
||||||
def change
|
def change
|
||||||
create_table :items do |t|
|
create_table :items do |t|
|
||||||
t.integer :qbo_id, null: false
|
|
||||||
t.text :description, null: false
|
t.text :description, null: false
|
||||||
t.decimal :unit_price,
|
t.decimal :unit_price,
|
||||||
precision: 15,
|
precision: 15,
|
||||||
|
|||||||
Reference in New Issue
Block a user