Skip to content

Commit

Permalink
Merge pull request #2368 from cloudnativedaysjp/feat/add-sponsor-info
Browse files Browse the repository at this point in the history
セッションチェックイン画面でスポンサー名を表示するため、APIにsponsorフィールドを追加する
  • Loading branch information
jacopen authored Aug 25, 2024
2 parents 6c1d39d + b4cf8c8 commit 090c3c7
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/views/api/v1/talks/index.json.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ json.array!(@talks) do |talk|
json.allowShowingVideo(talk.allowed_showing_video?)
json.offlineParticipationCount(talk.offline_participation_size)
json.onlineParticipationCount(talk.online_participation_size)
json.sponsor(talk.sponsor.present? ? { id: talk.sponsor.id, name: talk.sponsor.name } : nil)
end
1 change: 1 addition & 0 deletions app/views/api/v1/talks/show.json.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ json.slotNum(@talk.slot_number.to_i)
json.allowShowingVideo(@talk.allowed_showing_video?)
json.offlineParticipationCount(@talk.offline_participation_size)
json.onlineParticipationCount(@talk.online_participation_size)
json.sponsor(@talk.sponsor.present? ? { id: @talk.sponsor.id, name: @talk.sponsor.name } : nil)
8 changes: 8 additions & 0 deletions schemas/swagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,14 @@ components:
type: number
onlineParticipationCount:
type: number
sponsor:
type: object
nullable: true
properties:
id:
type: number
name:
type: string
example:
- id: 1
trackId: 2
Expand Down
1 change: 1 addition & 0 deletions spec/factories/talks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@
type { 'SponsorSession' }
start_time { '12:30' }
end_time { '12:40' }
abstract { 'あいうえおかきくけこさしすせそ' }
conference_id { 1 }
conference_day_id { 1 }
talk_difficulty_id { 1 }
Expand Down
17 changes: 17 additions & 0 deletions spec/requests/api/v1/talk_show_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,22 @@
expect(response.body).to(include('"conferenceDayDate":null'))
end
end

describe 'talk belongs to sponsor' do
let!(:event) { create(:cndt2020) }
let!(:sponsor) { create(:sponsor) }
let!(:talk) { create(:sponsor_session, sponsor_id: sponsor.id) }

it 'confirm json schema' do
get "/api/v1/talks/#{talk.id}"
assert_response_schema_confirm(200)
expect(response.body).to(include('スポンサー1株式会社'))
end

it 'succeed request' do
get "/api/v1/talks/#{talk.id}"
expect(response.status).to(eq(200))
end
end
end
end

0 comments on commit 090c3c7

Please sign in to comment.