From d64c48d8d553d3e895e6fb9a039be6265637d79b Mon Sep 17 00:00:00 2001 From: Rob Zolkos Date: Thu, 16 Apr 2026 15:50:10 -0400 Subject: [PATCH] Return the moved card on PUT /:account_slug/cards/:card_number/board The JSON response was `204 No Content`, which forced clients to make a follow-up GET to see the card on its new board. The Smithy contract the SDKs are generated from already declares `MoveCard` returns a Card, so the server was out of sync with the documented shape. Render `cards/show` for the JSON format so the response carries the moved card (with the new `board` reference). The HTML format is unchanged. Added assertions on the returned body and added an API doc entry for the endpoint, which was previously undocumented. --- app/controllers/cards/boards_controller.rb | 2 +- docs/api/sections/cards.md | 20 +++++++++++++++++++ .../cards/boards_controller_test.rb | 8 +++++++- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/app/controllers/cards/boards_controller.rb b/app/controllers/cards/boards_controller.rb index 3444cd3452..3c26607a56 100644 --- a/app/controllers/cards/boards_controller.rb +++ b/app/controllers/cards/boards_controller.rb @@ -14,7 +14,7 @@ def update respond_to do |format| format.html { redirect_to @card } - format.json { head :no_content } + format.json { render "cards/show" } end end diff --git a/docs/api/sections/cards.md b/docs/api/sections/cards.md index 1597b98e33..800ed82088 100644 --- a/docs/api/sections/cards.md +++ b/docs/api/sections/cards.md @@ -251,6 +251,26 @@ __Response:__ Returns `204 No Content` on success. +## `PUT /:account_slug/cards/:card_number/board` + +Moves a card to a different board. + +| Parameter | Type | Required | Description | +|-----------|------|----------|-------------| +| `board_id` | string | Yes | The ID of the board to move the card to | + +__Request:__ + +```json +{ + "board_id": "03f5v9zkft4hj9qq0lsn9ohcm" +} +``` + +__Response:__ + +Returns `200 OK` with the moved card in the same shape as `GET /:account_slug/cards/:card_number`. The `board` field reflects the new board. + ## `POST /:account_slug/cards/:card_number/triage` Moves a card into a column. diff --git a/test/controllers/cards/boards_controller_test.rb b/test/controllers/cards/boards_controller_test.rb index ebadff9b98..6be06ce823 100644 --- a/test/controllers/cards/boards_controller_test.rb +++ b/test/controllers/cards/boards_controller_test.rb @@ -26,7 +26,13 @@ class Cards::BoardsControllerTest < ActionDispatch::IntegrationTest put card_board_path(card), params: { board_id: new_board.id }, as: :json - assert_response :no_content + assert_response :success assert_equal new_board, card.reload.board + + json = @response.parsed_body + assert_equal card.id, json["id"] + assert_equal card.number, json["number"] + assert_equal card.title, json["title"] + assert_equal new_board.id, json["board"]["id"] end end