Compare commits

..

2 Commits

5 changed files with 12 additions and 4 deletions

View File

@ -9,10 +9,10 @@ class TablesArrangementsController < ApplicationController
render json: TablesArrangement
.order(valid: :desc)
.order(discomfort: :asc)
.select(:id, :name, :discomfort)
.select(:id, :name, :discomfort, :status)
.select("digest = '#{current_digest}'::uuid as valid")
.limit(20)
.as_json(only: %i[id name discomfort valid])
.as_json(only: %i[id name discomfort valid status])
end
def show

View File

@ -10,6 +10,7 @@
# digest :uuid not null
# discomfort :integer
# name :string not null
# status :string default("complete"), not null
# created_at :datetime not null
# updated_at :datetime not null
# wedding_id :uuid not null

View File

@ -0,0 +1,5 @@
class AddStatusColumnToTablesArrangements < ActiveRecord::Migration[8.0]
def change
add_column :tables_arrangements, :status, :string, default: :complete, null: false
end
end

3
db/schema.rb generated
View File

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[8.0].define(version: 2025_06_08_181054) do
ActiveRecord::Schema[8.0].define(version: 2025_08_01_102437) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_catalog.plpgsql"
@ -216,6 +216,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_08_181054) do
t.string "name", null: false
t.uuid "wedding_id", null: false
t.uuid "digest", default: -> { "gen_random_uuid()" }, null: false
t.string "status", default: "complete", null: false
t.index ["wedding_id"], name: "index_tables_arrangements_on_wedding_id"
end

View File

@ -19,7 +19,8 @@ RSpec.describe 'tables_arrangements' do
id: { type: :string, format: :uuid },
name: { type: :string },
discomfort: { type: :integer },
valid: { type: :boolean }
valid: { type: :boolean },
status: { type: :string, enum: %w[complete in_progress] }
}
}
xit