Skip to content

Commit 258da22

Browse files
committed
WIP narrative insert text API support
1 parent 28c9898 commit 258da22

10 files changed

+946
-2
lines changed

app/controllers/cards_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ class CardsController < ApplicationController
55
def index
66
add_total_stat(params)
77
cards = CardResource.all(params)
8+
debugger
89
respond_with(cards)
910
end
1011

app/resources/card_resource.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ class CardResource < ApplicationResource # rubocop:disable Metrics/ClassLength
5959
end
6060
attribute :card_set_names, :array_of_strings
6161
attribute :designed_by, :string
62+
attribute :narrative_text, :string
6263
attribute :printings_released_by, :array_of_strings
6364
attribute :pronouns, :string
6465
attribute :pronunciation_approximation, :string

app/resources/printing_resource.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ class PrintingResource < ApplicationResource # rubocop:disable Metrics/ClassLeng
7777
end
7878
attribute :card_set_names, :array_of_strings
7979
attribute :designed_by, :string
80+
attribute :narrative_text, :string
8081
attribute :released_by, :string
8182
attribute :printings_released_by, :array_of_strings
8283
attribute :pronouns, :string
@@ -186,7 +187,8 @@ def images(id, face_index = nil)
186187
'tiny' => "#{url_prefix}/tiny/#{id}#{face_suffix}.jpg",
187188
'small' => "#{url_prefix}/small/#{id}#{face_suffix}.jpg",
188189
'medium' => "#{url_prefix}/medium/#{id}#{face_suffix}.jpg",
189-
'large' => "#{url_prefix}/large/#{id}#{face_suffix}.jpg"
190+
'large' => "#{url_prefix}/large/#{id}#{face_suffix}.jpg",
191+
'narrative' => "#{url_prefix}/large/#{id}#{face_suffix}-narrative.jpg"
190192
}
191193
}
192194
end
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class AddNarrativeToCards < ActiveRecord::Migration[7.2]
2+
def change
3+
add_column :cards, :narrative_text, :string
4+
end
5+
end
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class UpdateUnifiedCardsToVersion10 < ActiveRecord::Migration[7.2]
2+
def change
3+
update_view :unified_cards,
4+
version: 10,
5+
revert_to_version: 9,
6+
materialized: true
7+
end
8+
end
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class UpdateUnifiedPrintingsToVersion12 < ActiveRecord::Migration[7.2]
2+
def change
3+
update_view :unified_printings,
4+
version: 12,
5+
revert_to_version: 11,
6+
materialized: true
7+
end
8+
end

db/schema.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema[7.1].define(version: 2025_01_05_055917) do
13+
ActiveRecord::Schema[7.2].define(version: 2025_06_23_035928) do
1414
# These are extensions that must be enabled in order to support this database
1515
enable_extension "pgcrypto"
1616
enable_extension "plpgsql"
@@ -144,6 +144,7 @@
144144
t.string "pronunciation_approximation"
145145
t.string "pronunciation_ipa"
146146
t.string "layout_id", default: "normal", null: false
147+
t.string "narrative_text"
147148
t.index ["card_type_id"], name: "index_cards_on_card_type_id"
148149
t.index ["faction_id"], name: "index_cards_on_faction_id"
149150
t.index ["side_id"], name: "index_cards_on_side_id"
@@ -594,6 +595,7 @@
594595
c.influence_limit,
595596
c.memory_cost,
596597
c.minimum_deck_size,
598+
c.narrative_text,
597599
c.pronouns,
598600
c.pronunciation_approximation,
599601
c.pronunciation_ipa,
@@ -913,6 +915,7 @@
913915
c.link_provided,
914916
c.memory_cost,
915917
c.mu_provided,
918+
c.narrative_text,
916919
c.num_printed_subroutines,
917920
c.on_encounter_effect,
918921
c.performs_trace,

0 commit comments

Comments
 (0)