local customprice = {}

customprice.setdb = function(db)
  customprice.db = db
end

customprice.find = function(item_record, user_record, db)
  return customprice.db:findByStructure({type='custom_price', item_id=item_record.id, user_id=user_record_id})[1]
end

customprice.new = function(t, db)
  local customprice_record = {}
  customprice_record.type = 'custom_price'
  customprice_record.user_id = t.user.id
  customprice_record.item_id = t.item.id
  customprice_record.price = t.price
  
  customprice.db:insertrecord(customprice_record)
  
  return customprice_record
end

return customprice