Mark unexpired distributions as valid
This commit is contained in:
parent
67138fd017
commit
cf589edda0
@ -4,7 +4,14 @@
|
|||||||
|
|
||||||
class TablesArrangementsController < ApplicationController
|
class TablesArrangementsController < ApplicationController
|
||||||
def index
|
def index
|
||||||
render json: TablesArrangement.order(discomfort: :asc).limit(3).as_json(only: %i[id name discomfort])
|
current_digest = Tables::Distribution.digest(current_tenant)
|
||||||
|
|
||||||
|
render json: TablesArrangement
|
||||||
|
.order(discomfort: :asc)
|
||||||
|
.select(:id, :name, :discomfort)
|
||||||
|
.select("digest = '#{current_digest}'::uuid as valid")
|
||||||
|
.limit(3)
|
||||||
|
.as_json(only: %i[id name discomfort valid])
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
@ -18,7 +18,8 @@ RSpec.describe 'tables_arrangements' do
|
|||||||
properties: {
|
properties: {
|
||||||
id: { type: :string, format: :uuid },
|
id: { type: :string, format: :uuid },
|
||||||
name: { type: :string },
|
name: { type: :string },
|
||||||
discomfort: { type: :integer }
|
discomfort: { type: :integer },
|
||||||
|
valid: { type: :boolean }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xit
|
xit
|
||||||
|
Loading…
x
Reference in New Issue
Block a user