Mark unexpired distributions as valid

This commit is contained in:
Manuel Bustillo 2025-01-26 12:39:25 +01:00
parent 67138fd017
commit cf589edda0
2 changed files with 10 additions and 2 deletions

View File

@ -4,7 +4,14 @@
class TablesArrangementsController < ApplicationController
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
def show

View File

@ -18,7 +18,8 @@ RSpec.describe 'tables_arrangements' do
properties: {
id: { type: :string, format: :uuid },
name: { type: :string },
discomfort: { type: :integer }
discomfort: { type: :integer },
valid: { type: :boolean }
}
}
xit