Compare commits

..

No commits in common. "bf0e764f65b1ff184a940ccf6c881a7be1069b1b" and "788f63597e84ace8c826761783721a44e494c206" have entirely different histories.

4 changed files with 0 additions and 14 deletions

View file

@ -6,11 +6,6 @@ class ReadingsController < ActionController::API
# @see {https://docutopia.tupale.co/sutty:nodemecu:api}
def create
if reading_params.empty?
head :ok
return
end
Reading.transaction do
reading = raspberry.readings.build reading_params
reading.id = params[:transaction_uuid]
@ -57,8 +52,6 @@ class ReadingsController < ActionController::API
def sensor_params(sensor)
sensor.permit(:timestamp, :type, :value, :unit, :error).tap do |p|
p[:local_type] = p.delete :type
p[:timestamp] = Time.at p[:timestamp]
rescue TypeError
end
end
end

View file

@ -4,6 +4,4 @@ class Arduino < ApplicationRecord
belongs_to :raspberry
belongs_to :reading
has_many :sensors
validates_presence_of :local_id
end

View file

@ -3,7 +3,4 @@
class Raspberry < ApplicationRecord
has_many :readings
has_many :arduinos
validates_presence_of :name
validates_uniqueness_of :name
end

View file

@ -2,6 +2,4 @@
class Sensor < ApplicationRecord
belongs_to :arduino
validates_presence_of :timestamp, :local_type, :value, :unit
end