Skip to content

Commit 50664d1

Browse files
committed
Add cards relation and format_id attribute to snapshot resource.
1 parent 0e30497 commit 50664d1

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

app/models/snapshot.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ class Snapshot < ApplicationRecord
44
belongs_to :format
55
belongs_to :card_pool
66
belongs_to :restriction, optional: :true
7+
has_many :cards, through: :card_pool
78
end

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ module Public
44
class Api::V3::Public::SnapshotResource < JSONAPI::Resource
55
immutable
66

7-
attributes :active, :date_start, :updated_at
7+
attributes :format_id, :active, :date_start, :updated_at
88
key_type :string
99

1010
paginator :none
1111

1212
belongs_to :format
1313
has_one :card_pool
1414
has_one :restriction
15+
has_many :cards
1516
end
1617
end
1718
end

0 commit comments

Comments
 (0)