-
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.
- Loading branch information
1 parent
4fdaa65
commit 48ce26b
Showing
9 changed files
with
132 additions
and
2 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
69 changes: 69 additions & 0 deletions
69
apps/govquests-api/rails_app/app/controllers/quests_controller.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,69 @@ | ||
# app/controllers/quests_controller.rb | ||
class QuestsController < ApplicationController | ||
def index | ||
quests = [ | ||
{ | ||
img_url: "https://file.coinexstatic.com/2023-11-16/BB3FDB00283C55B4C36B94CFAC0C3271.png", | ||
title: "Governance 101", | ||
reward_type: "OP", | ||
intro: "First things first: understand what are the Optimism Values and what is expect | ||
of you in this important role.", | ||
steps: [ | ||
{ | ||
content: "Code of Conduct", | ||
duration: 15, | ||
status: "start" | ||
}, | ||
{ | ||
content: "Optimistic Vision", | ||
duration: 10, | ||
status: "start" | ||
|
||
}, | ||
{ | ||
content: "Working Constitution", | ||
duration: 15, | ||
status: "start" | ||
}, | ||
{ | ||
content: "Delegate Expectations", | ||
duration: 12, | ||
status: "start" | ||
}, | ||
] | ||
}, | ||
{ | ||
img_url: "https://file.coinexstatic.com/2023-11-16/BB3FDB00283C55B4C36B94CFAC0C3271.png", | ||
title: "Governance 101", | ||
reward_type: "POINTS", | ||
intro: "First things first: understand what are the Optimism Values and what is expect | ||
of you in this important role.", | ||
steps: [ | ||
{ | ||
content: "Code of Conduct", | ||
duration: 15, | ||
status: "start" | ||
}, | ||
{ | ||
content: "Optimistic Vision", | ||
duration: 15, | ||
status: "start" | ||
|
||
}, | ||
{ | ||
content: "Working Constitution", | ||
duration: 20, | ||
status: "start" | ||
}, | ||
{ | ||
content: "Delegate Expectations", | ||
duration: 25, | ||
status: "start" | ||
}, | ||
] | ||
}, | ||
] | ||
|
||
render json: quests | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class Quest < ApplicationRecord | ||
validates :img_url, presence: true | ||
validates :title, presence: true | ||
validates :reward_type, presence: true | ||
validates :intro, presence: true | ||
|
||
serialize :steps, Array | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,5 @@ | |
|
||
# Defines the root path route ("/") | ||
# root "posts#index" | ||
get 'quests', to: 'quests#index' | ||
end |
13 changes: 13 additions & 0 deletions
13
apps/govquests-api/rails_app/db/migrate/20241001131854_create_quests.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,13 @@ | ||
class CreateQuests < ActiveRecord::Migration[8.0] | ||
def change | ||
create_table :quests do |t| | ||
t.string :img_url | ||
t.string :title | ||
t.string :reward_type | ||
t.text :intro | ||
t.text :steps | ||
|
||
t.timestamps | ||
end | ||
end | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
apps/govquests-api/rails_app/test/controllers/quest_controller_test.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,7 @@ | ||
require "test_helper" | ||
|
||
class QuestControllerTest < ActionDispatch::IntegrationTest | ||
# test "the truth" do | ||
# assert true | ||
# 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html | ||
|
||
one: | ||
img_url: MyString | ||
title: MyString | ||
reward_type: MyString | ||
intro: MyText | ||
steps: MyText | ||
|
||
two: | ||
img_url: MyString | ||
title: MyString | ||
reward_type: MyString | ||
intro: MyText | ||
steps: MyText |
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,7 @@ | ||
require "test_helper" | ||
|
||
class QuestTest < ActiveSupport::TestCase | ||
# test "the truth" do | ||
# assert true | ||
# end | ||
end |