From cdc7aa031477894e18973a8893d648514f9e6a73 Mon Sep 17 00:00:00 2001 From: talhaahsan Date: Wed, 6 Mar 2024 01:46:52 -0600 Subject: [PATCH 1/3] initial changes for supporting pronouns for cards --- app/resources/api/v3/public/card_resource.rb | 3 +- .../20240305053943_add_pronouns_to_cards.rb | 5 + ...72527_update_unified_cards_to_version_5.rb | 9 + ...3_update_unified_printings_to_version_7.rb | 9 + db/schema.rb | 5 +- db/views/unified_cards_v05.sql | 338 ++++++++++++++++++ db/views/unified_printings_v07.sql | 288 +++++++++++++++ lib/tasks/cards.rake | 1 + 8 files changed, 656 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20240305053943_add_pronouns_to_cards.rb create mode 100644 db/migrate/20240306072527_update_unified_cards_to_version_5.rb create mode 100644 db/migrate/20240306072723_update_unified_printings_to_version_7.rb create mode 100644 db/views/unified_cards_v05.sql create mode 100644 db/views/unified_printings_v07.sql diff --git a/app/resources/api/v3/public/card_resource.rb b/app/resources/api/v3/public/card_resource.rb index 6d2edabe..114d85e8 100644 --- a/app/resources/api/v3/public/card_resource.rb +++ b/app/resources/api/v3/public/card_resource.rb @@ -14,6 +14,7 @@ class Api::V3::Public::CardResource < JSONAPI::Resource attributes :card_subtype_ids, :display_subtypes, :attribution, :updated_at attributes :format_ids, :card_pool_ids, :snapshot_ids, :card_cycle_ids, :card_set_ids attributes :designed_by, :printings_released_by + attributes :pronouns # Synthesized attributes attributes :card_abilities, :latest_printing_id, :restrictions @@ -53,7 +54,7 @@ def restrictions filters :title, :card_type_id, :side_id, :faction_id, :advancement_requirement filters :agenda_points, :base_link, :cost, :deck_limit, :influence_cost filters :influence_limit, :memory_cost, :minimum_deck_size, :strength, :trash_cost, :is_unique - filters :designed_by + filters :designed_by, :pronouns filter :search, apply: ->(records, value, _options) { query_builder = CardSearchQueryBuilder.new(value[0]) diff --git a/db/migrate/20240305053943_add_pronouns_to_cards.rb b/db/migrate/20240305053943_add_pronouns_to_cards.rb new file mode 100644 index 00000000..80811ebf --- /dev/null +++ b/db/migrate/20240305053943_add_pronouns_to_cards.rb @@ -0,0 +1,5 @@ +class AddPronounsToCards < ActiveRecord::Migration[7.1] + def change + add_column :cards, :pronouns, :string + end +end diff --git a/db/migrate/20240306072527_update_unified_cards_to_version_5.rb b/db/migrate/20240306072527_update_unified_cards_to_version_5.rb new file mode 100644 index 00000000..1335c665 --- /dev/null +++ b/db/migrate/20240306072527_update_unified_cards_to_version_5.rb @@ -0,0 +1,9 @@ +class UpdateUnifiedCardsToVersion5 < ActiveRecord::Migration[7.1] + def change + + update_view :unified_cards, + version: 5, + revert_to_version: 4, + materialized: true + end +end diff --git a/db/migrate/20240306072723_update_unified_printings_to_version_7.rb b/db/migrate/20240306072723_update_unified_printings_to_version_7.rb new file mode 100644 index 00000000..48002f3e --- /dev/null +++ b/db/migrate/20240306072723_update_unified_printings_to_version_7.rb @@ -0,0 +1,9 @@ +class UpdateUnifiedPrintingsToVersion7 < ActiveRecord::Migration[7.1] + def change + + update_view :unified_printings, + version: 7, + revert_to_version: 6, + materialized: true + end +end diff --git a/db/schema.rb b/db/schema.rb index fda0e26f..45e43e02 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2024_01_28_224447) do +ActiveRecord::Schema[7.1].define(version: 2024_03_06_072723) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -121,6 +121,7 @@ t.boolean "trash_ability", default: false t.string "attribution" t.string "designed_by" + t.string "pronouns" t.index ["card_type_id"], name: "index_cards_on_card_type_id" t.index ["faction_id"], name: "index_cards_on_faction_id" t.index ["side_id"], name: "index_cards_on_side_id" @@ -482,6 +483,7 @@ c.influence_limit, c.memory_cost, c.minimum_deck_size, + c.pronouns, c.strength, c.stripped_text, c.text, @@ -673,6 +675,7 @@ c.num_printed_subroutines, c.on_encounter_effect, c.performs_trace, + c.pronouns, c.recurring_credits_provided, c.side_id, c.strength, diff --git a/db/views/unified_cards_v05.sql b/db/views/unified_cards_v05.sql new file mode 100644 index 00000000..60fa6680 --- /dev/null +++ b/db/views/unified_cards_v05.sql @@ -0,0 +1,338 @@ +WITH card_cycles_summary AS ( + SELECT + c.id, + ARRAY_AGG( + cc.id ORDER BY cc.id + ) as card_cycle_ids, + ARRAY_AGG( + LOWER(cc.name) ORDER BY LOWER(cc.name) + ) as card_cycle_names + FROM + cards c + JOIN printings p ON c.id = p.card_id + JOIN card_sets cs ON p.card_set_id = cs.id + JOIN card_cycles cc ON cc.id = cs.card_cycle_id + GROUP BY + c.id +), +printing_releasers AS ( + SELECT + card_id, + ARRAY_AGG(DISTINCT released_by ORDER BY released_by) as releasers + FROM + printings + GROUP BY + card_id +), +card_sets_summary AS ( + SELECT + c.id, + ARRAY_AGG( + cs.id ORDER BY cs.id + ) as card_set_ids, + ARRAY_AGG( + LOWER(cs.name) ORDER BY LOWER(cs.name) + ) as card_set_names + FROM + cards c + JOIN printings p ON c.id = p.card_id + JOIN card_sets cs ON p.card_set_id = cs.id + GROUP BY + c.id +), +card_subtype_ids AS ( + SELECT + card_id, + ARRAY_AGG( + card_subtype_id + ORDER BY + 1 + ) as card_subtype_ids + FROM + cards_card_subtypes + GROUP BY + card_id +), +card_subtype_names AS ( + SELECT + ccs.card_id, + -- lower used for filtering + ARRAY_AGG( + LOWER(cs.name) ORDER BY LOWER(cs.name) + ) as lower_card_subtype_names, + -- proper case used for display + ARRAY_AGG( + cs.name ORDER BY cs.name + ) as card_subtype_names + FROM + cards_card_subtypes ccs + JOIN card_subtypes cs ON ccs.card_subtype_id = cs.id + GROUP BY + ccs.card_id +), +card_printing_ids AS ( + SELECT + card_id, + ARRAY_AGG( + id ORDER BY date_release DESC + ) as printing_ids + FROM + printings + GROUP BY + card_id +), +card_release_dates AS ( + SELECT + card_id, + MIN(date_release) as date_release + FROM + printings + GROUP BY + card_id +), +card_restriction_ids AS ( + SELECT + card_id, + ARRAY_AGG( + restriction_id ORDER BY restriction_id + ) as restriction_ids + FROM + unified_restrictions + WHERE + in_restriction + GROUP BY + 1 +), +restrictions_banned_summary AS ( + SELECT + card_id, + ARRAY_AGG( + restriction_id ORDER BY restriction_id + ) as restrictions_banned + FROM + restrictions_cards_banned + GROUP BY + card_id +), +restrictions_global_penalty_summary AS ( + SELECT + card_id, + ARRAY_AGG( + restriction_id ORDER BY restriction_id + ) as restrictions_global_penalty + FROM + restrictions_cards_global_penalty + GROUP BY + card_id +), +restrictions_points_summary AS ( + SELECT + card_id, + ARRAY_AGG( + CONCAT(restriction_id, '=', CAST (value AS text)) + ORDER BY CONCAT(restriction_id, '=', CAST (value AS text)) + ) as restrictions_points + FROM + restrictions_cards_points + GROUP BY + card_id +), +restrictions_restricted_summary AS ( + SELECT + card_id, + ARRAY_AGG( + restriction_id ORDER BY restriction_id + ) as restrictions_restricted + FROM + restrictions_cards_restricted + GROUP BY + card_id +), +restrictions_universal_faction_cost_summary AS ( + SELECT + card_id, + ARRAY_AGG( + CONCAT(restriction_id, '=', CAST (value AS text)) + ORDER BY CONCAT(restriction_id, '=', CAST (value AS text)) + ) as restrictions_universal_faction_cost + FROM + restrictions_cards_universal_faction_cost + GROUP BY + card_id +), +format_ids AS ( + SELECT + cpc.card_id, + ARRAY_AGG( + DISTINCT s.format_id ORDER BY s.format_id + ) as format_ids + FROM + card_pools_cards cpc + JOIN snapshots s ON cpc.card_pool_id = s.card_pool_id + GROUP BY + cpc.card_id +), +card_pool_ids AS ( + SELECT + cpc.card_id, + ARRAY_AGG( + DISTINCT s.card_pool_id ORDER BY s.card_pool_id + ) as card_pool_ids + FROM + card_pools_cards cpc + JOIN snapshots s ON cpc.card_pool_id = s.card_pool_id + GROUP BY + cpc.card_id +), +snapshot_ids AS ( + SELECT + cpc.card_id, + ARRAY_AGG( + DISTINCT s.id ORDER BY s.id + ) as snapshot_ids + FROM + card_pools_cards cpc + JOIN snapshots s ON cpc.card_pool_id = s.card_pool_id + GROUP BY + cpc.card_id +) +SELECT + c.id as id, + c.title, + c.stripped_title, + c.card_type_id, + c.side_id, + c.faction_id, + c.advancement_requirement, + c.agenda_points, + c.base_link, + c.cost, + c.deck_limit, + c.influence_cost, + c.influence_limit, + c.memory_cost, + c.minimum_deck_size, + c.pronouns, + c.strength, + c.stripped_text, + c.text, + c.trash_cost, + c.is_unique, + c.display_subtypes, + c.attribution, + c.created_at, + c.updated_at, + c.additional_cost, + c.advanceable, + c.gains_subroutines, + c.interrupt, + c.link_provided, + c.mu_provided, + c.num_printed_subroutines, + c.on_encounter_effect, + c.performs_trace, + c.recurring_credits_provided, + c.rez_effect, + c.trash_ability, + COALESCE(csi.card_subtype_ids, ARRAY [] :: text []) as card_subtype_ids, + COALESCE(csn.lower_card_subtype_names, ARRAY [] :: text []) as lower_card_subtype_names, + COALESCE(csn.card_subtype_names, ARRAY [] :: text []) as card_subtype_names, + p.printing_ids, + ARRAY_LENGTH(p.printing_ids, 1) AS num_printings, + ccs.card_cycle_ids, + ccs.card_cycle_names, + css.card_set_ids, + css.card_set_names, + COALESCE(r.restriction_ids, ARRAY [] :: text []) as restriction_ids, + r.restriction_ids IS NOT NULL as in_restriction, + COALESCE(r_b.restrictions_banned, ARRAY [] :: text []) as restrictions_banned, + COALESCE( + r_g_p.restrictions_global_penalty, + ARRAY [] :: text [] + ) as restrictions_global_penalty, + COALESCE(r_p.restrictions_points, ARRAY [] :: text []) as restrictions_points, + COALESCE(r_r.restrictions_restricted, ARRAY [] :: text []) as restrictions_restricted, + COALESCE( + r_u_f_c.restrictions_universal_faction_cost, + ARRAY [] :: text [] + ) as restrictions_universal_faction_cost, + COALESCE(f.format_ids, ARRAY [] :: text []) as format_ids, + COALESCE(cpc.card_pool_ids, ARRAY [] :: text []) as card_pool_ids, + COALESCE(s.snapshot_ids, ARRAY [] :: text []) as snapshot_ids, + crd.date_release, + c.designed_by, + pr.releasers as printings_released_by +FROM + cards c + JOIN card_printing_ids p ON c.id = p.card_id + JOIN card_cycles_summary ccs ON c.id = ccs.id + JOIN card_sets_summary css ON c.id = css.id + INNER JOIN printing_releasers pr ON c.id = pr.card_id + LEFT JOIN card_subtype_ids csi ON c.id = csi.card_id + LEFT JOIN card_subtype_names csn ON c.id = csn.card_id + LEFT JOIN card_restriction_ids r ON c.id = r.card_id + LEFT JOIN restrictions_banned_summary r_b ON c.id = r_b.card_id + LEFT JOIN restrictions_global_penalty_summary r_g_p ON c.id = r_g_p.card_id + LEFT JOIN restrictions_points_summary r_p ON c.id = r_p.card_id + LEFT JOIN restrictions_restricted_summary r_r ON c.id = r_r.card_id + LEFT JOIN restrictions_universal_faction_cost_summary r_u_f_c ON c.id = r_u_f_c.card_id + LEFT JOIN format_ids f ON c.id = f.card_id + LEFT JOIN card_pool_ids cpc ON c.id = cpc.card_id + LEFT JOIN snapshot_ids s ON c.id = s.card_id + LEFT JOIN card_release_dates crd ON c.id = crd.card_id +GROUP BY + c.id, + c.title, + c.stripped_title, + c.card_type_id, + c.side_id, + c.faction_id, + c.advancement_requirement, + c.agenda_points, + c.base_link, + c.cost, + c.deck_limit, + c.influence_cost, + c.influence_limit, + c.memory_cost, + c.minimum_deck_size, + c.strength, + c.stripped_text, + c.text, + c.trash_cost, + c.is_unique, + c.display_subtypes, + c.attribution, + c.created_at, + c.updated_at, + c.additional_cost, + c.advanceable, + c.gains_subroutines, + c.interrupt, + c.link_provided, + c.mu_provided, + c.num_printed_subroutines, + c.on_encounter_effect, + c.performs_trace, + c.recurring_credits_provided, + c.rez_effect, + c.trash_ability, + csi.card_subtype_ids, + csn.lower_card_subtype_names, + csn.card_subtype_names, + p.printing_ids, + ccs.card_cycle_ids, + ccs.card_cycle_names, + css.card_set_ids, + css.card_set_names, + r.restriction_ids, + r_b.restrictions_banned, + r_g_p.restrictions_global_penalty, + r_p.restrictions_points, + r_r.restrictions_restricted, + r_u_f_c.restrictions_universal_faction_cost, + f.format_ids, + cpc.card_pool_ids, + s.snapshot_ids, + crd.date_release, + pr.releasers; diff --git a/db/views/unified_printings_v07.sql b/db/views/unified_printings_v07.sql new file mode 100644 index 00000000..0c014a49 --- /dev/null +++ b/db/views/unified_printings_v07.sql @@ -0,0 +1,288 @@ +WITH +card_cycles_summary AS ( + SELECT + c.id, + ARRAY_AGG( + cc.id ORDER BY cc.id + ) as card_cycle_ids, + ARRAY_AGG( + LOWER(cc.name) ORDER BY LOWER(cc.name) + ) as card_cycle_names + FROM + cards c + JOIN printings p ON c.id = p.card_id + JOIN card_sets cs ON p.card_set_id = cs.id + JOIN card_cycles cc ON cc.id = cs.card_cycle_id + GROUP BY + c.id +), +card_sets_summary AS ( + SELECT + c.id, + ARRAY_AGG( + cs.id ORDER BY cs.id + ) as card_set_ids, + ARRAY_AGG( + LOWER(cs.name) ORDER BY LOWER(cs.name) + ) as card_set_names + FROM + cards c + JOIN printings p ON c.id = p.card_id + JOIN card_sets cs ON p.card_set_id = cs.id + GROUP BY + c.id +), +card_subtype_ids AS ( + SELECT + card_id, + ARRAY_AGG(card_subtype_id ORDER BY 1) as card_subtype_ids + FROM + cards_card_subtypes + GROUP BY + card_id +), +card_subtype_names AS ( + SELECT + ccs.card_id, + -- lower used for filtering + ARRAY_AGG(LOWER(cs.name) ORDER BY LOWER(cs.name)) as lower_card_subtype_names, + -- proper case used for display + ARRAY_AGG( + cs.name ORDER BY cs.name + ) as card_subtype_names + FROM + cards_card_subtypes ccs + JOIN card_subtypes cs ON ccs.card_subtype_id = cs.id + GROUP BY + ccs.card_id +), +card_printing_ids AS ( + SELECT + card_id, + ARRAY_AGG(id ORDER BY date_release DESC) as printing_ids + FROM + printings + GROUP BY + card_id +), +printing_releasers AS ( + SELECT + card_id, + ARRAY_AGG(DISTINCT released_by ORDER BY released_by) as releasers + FROM + printings + GROUP BY + card_id +), +illustrators AS ( + SELECT + ip.printing_id, + ARRAY_AGG(ip.illustrator_id ORDER BY ip.illustrator_id) as illustrator_ids, + ARRAY_AGG(i.name ORDER BY i.name) as illustrator_names + FROM + illustrators_printings ip JOIN illustrators i ON ip.illustrator_id = i.id + GROUP BY + ip.printing_id +), +card_restriction_ids AS ( + SELECT + card_id, + ARRAY_AGG( + restriction_id ORDER BY restriction_id + ) as restriction_ids + FROM + unified_restrictions + WHERE + in_restriction + GROUP BY + 1 +), +restrictions_banned_summary AS ( + SELECT + card_id, + ARRAY_AGG( + restriction_id ORDER BY restriction_id + ) as restrictions_banned + FROM + restrictions_cards_banned + GROUP BY + card_id +), +restrictions_global_penalty_summary AS ( + SELECT + card_id, + ARRAY_AGG( + restriction_id ORDER BY restriction_id + ) as restrictions_global_penalty + FROM + restrictions_cards_global_penalty + GROUP BY + card_id +), +restrictions_points_summary AS ( + SELECT + card_id, + ARRAY_AGG( + CONCAT(restriction_id, '=', CAST (value AS text)) + ORDER BY CONCAT(restriction_id, '=', CAST (value AS text)) + ) as restrictions_points + FROM + restrictions_cards_points + GROUP BY + card_id +), +restrictions_restricted_summary AS ( + SELECT + card_id, + ARRAY_AGG( + restriction_id ORDER BY restriction_id + ) as restrictions_restricted + FROM + restrictions_cards_restricted + GROUP BY + card_id +), +restrictions_universal_faction_cost_summary AS ( + SELECT + card_id, + ARRAY_AGG( + CONCAT(restriction_id, '=', CAST (value AS text)) + ORDER BY CONCAT(restriction_id, '=', CAST (value AS text)) + ) as restrictions_universal_faction_cost + FROM + restrictions_cards_universal_faction_cost + GROUP BY + card_id +), +format_ids AS ( + SELECT + cpc.card_id, + ARRAY_AGG( + DISTINCT s.format_id ORDER BY s.format_id + ) as format_ids + FROM + card_pools_cards cpc + JOIN snapshots s ON cpc.card_pool_id = s.card_pool_id + GROUP BY + cpc.card_id +), +card_pool_ids AS ( + SELECT + cpc.card_id, + ARRAY_AGG( + DISTINCT s.card_pool_id ORDER BY s.card_pool_id + ) as card_pool_ids + FROM + card_pools_cards cpc + JOIN snapshots s ON cpc.card_pool_id = s.card_pool_id + GROUP BY + cpc.card_id +), +snapshot_ids AS ( + SELECT + cpc.card_id, + ARRAY_AGG( + DISTINCT s.id ORDER BY s.id + ) as snapshot_ids + FROM + card_pools_cards cpc + JOIN snapshots s ON cpc.card_pool_id = s.card_pool_id + GROUP BY + cpc.card_id +) +SELECT + p.id, + p.card_id, + cc.id as card_cycle_id, + cc.name as card_cycle_name, + p.card_set_id, + cs.name as card_set_name, + p.flavor, + p.display_illustrators, + p.position, + p.position_in_set, + p.quantity, + p.date_release, + p.created_at, + p.updated_at, + c.additional_cost, + c.advanceable, + c.advancement_requirement, + c.agenda_points, + c.base_link, + c.card_type_id, + c.cost, + c.faction_id, + c.gains_subroutines, + c.influence_cost, + c.interrupt, + c.is_unique, + c.link_provided, + c.memory_cost, + c.mu_provided, + c.num_printed_subroutines, + c.on_encounter_effect, + c.performs_trace, + c.pronouns, + c.recurring_credits_provided, + c.side_id, + c.strength, + c.stripped_text, + c.stripped_title, + c.trash_ability, + c.trash_cost, + COALESCE(csi.card_subtype_ids, ARRAY [] :: text []) as card_subtype_ids, + COALESCE(csn.lower_card_subtype_names, ARRAY [] :: text []) as lower_card_subtype_names, + COALESCE(csn.card_subtype_names, ARRAY [] :: text []) as card_subtype_names, + cp.printing_ids, + p.id = cp.printing_ids[1] AS is_latest_printing, + ARRAY_LENGTH(cp.printing_ids, 1) AS num_printings, + COALESCE(ccs.card_cycle_ids, ARRAY [] :: text []) as card_cycle_ids, + COALESCE(ccs.card_cycle_names, ARRAY [] :: text []) as card_cycle_names, + COALESCE(css.card_set_ids, ARRAY [] :: text []) as card_set_ids, + COALESCE(css.card_set_names, ARRAY [] :: text []) as card_set_names, + COALESCE(i.illustrator_ids, ARRAY [] :: text []) as illustrator_ids, + COALESCE(i.illustrator_names, ARRAY [] :: text []) as illustrator_names, + COALESCE(r.restriction_ids, ARRAY [] :: text []) as restriction_ids, + r.restriction_ids IS NOT NULL as in_restriction, + COALESCE(r_b.restrictions_banned, ARRAY [] :: text []) as restrictions_banned, + COALESCE(r_g_p.restrictions_global_penalty, ARRAY [] :: text []) as restrictions_global_penalty, + COALESCE(r_p.restrictions_points, ARRAY [] :: text []) as restrictions_points, + COALESCE(r_r.restrictions_restricted, ARRAY [] :: text []) as restrictions_restricted, + COALESCE(r_u_f_c.restrictions_universal_faction_cost, ARRAY [] :: text []) as restrictions_universal_faction_cost, + COALESCE(f.format_ids, ARRAY [] :: text []) as format_ids, + COALESCE(cpc.card_pool_ids, ARRAY [] :: text []) as card_pool_ids, + COALESCE(s.snapshot_ids, ARRAY [] :: text []) as snapshot_ids, + c.attribution, + c.deck_limit, + c.display_subtypes, + c.influence_limit, + c.minimum_deck_size, + c.rez_effect, + c.text, + c.title, + c.designed_by, + p.released_by, + pr.releasers as printings_released_by +FROM + printings p + INNER JOIN cards c ON p.card_id = c.id + JOIN card_cycles_summary ccs ON c.id = ccs.id + JOIN card_sets_summary css ON c.id = css.id + INNER JOIN card_sets cs ON p.card_set_id = cs.id + INNER JOIN card_cycles cc ON cs.card_cycle_id = cc.id + LEFT JOIN card_subtype_ids csi ON c.id = csi.card_id + LEFT JOIN card_subtype_names csn ON c.id = csn.card_id + INNER JOIN card_printing_ids cp ON p.card_id = cp.card_id + INNER JOIN printing_releasers pr ON p.card_id = pr.card_id + LEFT JOIN illustrators i ON p.id = i.printing_id + LEFT JOIN card_restriction_ids r ON p.card_id = r.card_id + LEFT JOIN restrictions_banned_summary r_b ON p.card_id = r_b.card_id + LEFT JOIN restrictions_global_penalty_summary r_g_p ON p.card_id = r_g_p.card_id + LEFT JOIN restrictions_points_summary r_p ON p.card_id = r_p.card_id + LEFT JOIN restrictions_restricted_summary r_r ON p.card_id = r_r.card_id + LEFT JOIN restrictions_universal_faction_cost_summary r_u_f_c ON p.card_id = r_u_f_c.card_id + LEFT JOIN format_ids f ON p.card_id = f.card_id + LEFT JOIN card_pool_ids cpc ON p.card_id = cpc.card_id + LEFT JOIN snapshot_ids s ON p.card_id = s.card_id +; diff --git a/lib/tasks/cards.rake b/lib/tasks/cards.rake index f37d52d9..1c17f70b 100644 --- a/lib/tasks/cards.rake +++ b/lib/tasks/cards.rake @@ -99,6 +99,7 @@ namespace :cards do influence_limit: card["influence_limit"], memory_cost: card["memory_cost"], minimum_deck_size: card["minimum_deck_size"], + pronouns: card["pronouns"], title: card["title"], stripped_title: card["stripped_title"], stripped_text: card["stripped_text"], From ce7b9c41214566de3d827cab87ba493b795cb484 Mon Sep 17 00:00:00 2001 From: talhaahsan Date: Wed, 6 Mar 2024 21:46:19 -0600 Subject: [PATCH 2/3] added printing pronouns --- app/resources/api/v3/public/printing_resource.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/resources/api/v3/public/printing_resource.rb b/app/resources/api/v3/public/printing_resource.rb index b924e24c..9cb411ff 100644 --- a/app/resources/api/v3/public/printing_resource.rb +++ b/app/resources/api/v3/public/printing_resource.rb @@ -22,7 +22,7 @@ class Api::V3::Public::PrintingResource < JSONAPI::Resource attributes :title, :trash_cost, :printing_ids, :num_printings, :is_latest_printing, :restriction_ids, :in_restriction attributes :format_ids, :card_pool_ids, :snapshot_ids attributes :card_cycle_ids, :card_set_ids, :attribution - attributes :released_by, :printings_released_by, :designed_by + attributes :released_by, :printings_released_by, :designed_by, :pronouns # Synthesized attributes attributes :card_abilities, :images, :latest_printing_id, :restrictions From c45da85e3b8b58b88d53c838e514f6d14e5afe69 Mon Sep 17 00:00:00 2001 From: talhaahsan Date: Wed, 6 Mar 2024 22:58:43 -0600 Subject: [PATCH 3/3] missed a line for filtering --- app/resources/api/v3/public/printing_resource.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/resources/api/v3/public/printing_resource.rb b/app/resources/api/v3/public/printing_resource.rb index 9cb411ff..f3e1eb3e 100644 --- a/app/resources/api/v3/public/printing_resource.rb +++ b/app/resources/api/v3/public/printing_resource.rb @@ -66,7 +66,8 @@ def restrictions filters :title, :card_type_id, :side_id, :faction_id, :advancement_requirement filters :agenda_points, :base_link, :cost, :deck_limit, :influence_cost, :influence_limit filters :memory_cost, :minimum_deck_size, :strength, :trash_cost, :is_unique, :is_latest_printing - + filters :pronouns + filter :search, apply: ->(records, value, _options) { query_builder = PrintingSearchQueryBuilder.new(value[0]) if query_builder.parse_error.nil?