Skip to content

Commit 287a8b7

Browse files
authored
Merge pull request #69 from distributive/snapshot
Snapshots now directly expose their card sets/cycles instead of linking to a card pool
2 parents 0e30497 + cdbae12 commit 287a8b7

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

app/resources/api/v3/public/snapshot_resource.rb

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,23 @@ module V3
33
module Public
44
class Api::V3::Public::SnapshotResource < JSONAPI::Resource
55
immutable
6-
7-
attributes :active, :date_start, :updated_at
6+
7+
attributes :active, :card_cycle_ids, :card_set_ids, :date_start, :updated_at
88
key_type :string
99

1010
paginator :none
1111

1212
belongs_to :format
13-
has_one :card_pool
13+
# has_one :card_pool
1414
has_one :restriction
15+
16+
def card_cycle_ids
17+
@model.card_pool.card_pool_card_cycles.pluck(:card_cycle_id)
18+
end
19+
20+
def card_set_ids
21+
@model.card_pool.card_pool_card_sets.pluck(:card_set_id)
22+
end
1523
end
1624
end
1725
end

0 commit comments

Comments
 (0)