From b5caa8716d0e402feed7fc5926456a215511e469 Mon Sep 17 00:00:00 2001 From: Abdelkader Boudih Date: Fri, 12 Dec 2025 10:12:21 +0100 Subject: [PATCH] feat: expose closed boolean in card JSON API Adds `closed` field to card JSON response, allowing API consumers to detect closed status without parsing the status enum or making additional API calls. --- app/views/cards/_card.json.jbuilder | 1 + test/controllers/cards_controller_test.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/app/views/cards/_card.json.jbuilder b/app/views/cards/_card.json.jbuilder index a1c509a66..e5792f127 100644 --- a/app/views/cards/_card.json.jbuilder +++ b/app/views/cards/_card.json.jbuilder @@ -6,6 +6,7 @@ json.cache! card do json.tags card.tags.pluck(:title).sort + json.closed card.closed? json.golden card.golden? json.last_active_at card.last_active_at.utc json.created_at card.created_at.utc diff --git a/test/controllers/cards_controller_test.rb b/test/controllers/cards_controller_test.rb index 635b2d2e0..c6c56fc83 100644 --- a/test/controllers/cards_controller_test.rb +++ b/test/controllers/cards_controller_test.rb @@ -145,6 +145,7 @@ class CardsControllerTest < ActionDispatch::IntegrationTest assert_response :success assert_equal card.title, @response.parsed_body["title"] + assert_equal card.closed?, @response.parsed_body["closed"] assert_equal 2, @response.parsed_body["steps"].size end