More filters, dep upgrades (#873)

pull/874/head
Rick Carlino 2018-05-31 08:54:07 -05:00 committed by GitHub
parent 950ab40223
commit 4d7ef0c6e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 9 deletions

View File

@ -9,13 +9,15 @@ module Points
end
optional do
float :radius
float :x
float :y
float :z
hstore :meta
string :name
string :pointer_type, in: Point::POINTER_KINDS
float :radius
float :x
float :y
float :z
hstore :meta
string :name
string :pointer_type, in: Point::POINTER_KINDS
string :plant_stage, in: CeleryScriptSettingsBag::PLANT_STAGES
string :openfarm_slug
end
def execute

View File

@ -86,7 +86,7 @@
"ts-lint": "^4.5.1",
"ts-loader": "4.3.0",
"tslint": "5.10.0",
"typescript": "2.8.3",
"typescript": "2.8.4",
"url-loader": "1.0.1",
"webpack": "4.10.2",
"webpack-uglify-js-plugin": "1.1.9",

View File

@ -77,5 +77,33 @@ describe Api::PointsController do
expect(json.length).to eq(1)
expect(json.first[:pointer_type]).to eq("Plant")
end
it 'filters by openfarm_slug' do
sign_in user
d = user.device
tomato = FactoryBot.create(:plant, device: d, openfarm_slug: "tomato")
potato = FactoryBot.create(:plant, device: d, openfarm_slug: "potato")
post :search,
body: { openfarm_slug: "tomato" }.to_json,
params: {format: :json }
expect(response.status).to eq(200)
expect(json).to be_kind_of(Array)
expect(json.length).to eq(1)
expect(json.first[:openfarm_slug]).to eq("tomato")
end
it 'filters by plant_stage' do
sign_in user
d = user.device
tomato = FactoryBot.create(:plant, device: d, plant_stage: "planted")
potato = FactoryBot.create(:plant, device: d, plant_stage: "harvested")
post :search,
body: { plant_stage: "harvested" }.to_json,
params: {format: :json }
expect(response.status).to eq(200)
expect(json).to be_kind_of(Array)
expect(json.length).to eq(1)
expect(json.first[:plant_stage]).to eq("harvested")
end
end
end

View File

@ -8309,7 +8309,11 @@ typedarray@^0.0.6:
version "0.0.6"
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
typescript@2.8.3, typescript@^2.0.9, typescript@^2.3.4:
typescript@2.8.4:
version "2.8.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.8.4.tgz#0b1db68e6bdfb0b767fa2ab642136a35b059b199"
typescript@^2.0.9, typescript@^2.3.4:
version "2.8.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.8.3.tgz#5d817f9b6f31bb871835f4edf0089f21abe6c170"