-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: try to create badge on track / quest created
- Loading branch information
1 parent
6a20a26
commit 190299a
Showing
5 changed files
with
27 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 1 addition & 8 deletions
9
apps/govquests-api/rails_app/app/read_models/questing/on_track_created.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,11 @@ | ||
module Questing | ||
class OnTrackCreated | ||
def call(event) | ||
track = TrackReadModel.create!( | ||
TrackReadModel.create!( | ||
track_id: event.data[:track_id], | ||
display_data: event.data[:display_data], | ||
quest_ids: event.data[:quest_ids] | ||
) | ||
|
||
badge_id = SecureRandom.uuid | ||
Rewarding::BadgeReadModel.create!( | ||
badge_id: badge_id, | ||
display_data: event.data[:badge_display_data], | ||
badgeable: track | ||
) | ||
end | ||
end | ||
end |
12 changes: 12 additions & 0 deletions
12
apps/govquests-api/rails_app/app/read_models/rewarding/on_quest_created.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module Rewarding | ||
class OnQuestCreated | ||
def call(event) | ||
BadgeReadModel.create!( | ||
badge_id: SecureRandom.uuid, | ||
display_data: event.data[:badge_display_data], | ||
badgeable_type: "Questing::QuestReadModel", | ||
badgeable_id: event.data[:quest_id] | ||
) | ||
end | ||
end | ||
end |
12 changes: 12 additions & 0 deletions
12
apps/govquests-api/rails_app/app/read_models/rewarding/on_track_created.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module Rewarding | ||
class OnTrackCreated | ||
def call(event) | ||
BadgeReadModel.create!( | ||
badge_id: SecureRandom.uuid, | ||
display_data: event.data[:badge_display_data], | ||
badgeable_type: "Questing::TrackReadModel", | ||
badgeable_id: event.data[:track_id] | ||
) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters