-
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.
Merge pull request #5 from bleu/luiz/op-294-create-quest-endpoint
feat: create mocked quest endpoint
- Loading branch information
Showing
22 changed files
with
545 additions
and
148 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
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
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
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
182 changes: 182 additions & 0 deletions
182
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,182 @@ | ||
# app/controllers/quests_controller.rb | ||
class QuestsController < ApplicationController | ||
def index | ||
quests = [ | ||
{ | ||
id: "1", | ||
img_url: "https://file.coinexstatic.com/2023-11-16/BB3FDB00283C55B4C36B94CFAC0C3271.png", | ||
title: "Governance 101", | ||
status: "start", | ||
rewards: [ | ||
{ | ||
type: "Points", | ||
amount: 50 | ||
}, | ||
{ | ||
type: "OP", | ||
amount: 2 | ||
} | ||
], | ||
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, | ||
}, | ||
{ | ||
content: "Optimistic Vision", | ||
duration: 10, | ||
}, | ||
{ | ||
content: "Working Constitution", | ||
duration: 15, | ||
}, | ||
{ | ||
content: "Delegate Expectations", | ||
duration: 12, | ||
}, | ||
] | ||
}, | ||
{ | ||
id: "2", | ||
img_url: "https://file.coinexstatic.com/2023-11-16/BB3FDB00283C55B4C36B94CFAC0C3271.png", | ||
title: "Governance 101", | ||
status: "start", | ||
rewards: [ | ||
{ | ||
type: "Points", | ||
amount: 100 | ||
} | ||
], | ||
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, | ||
}, | ||
{ | ||
content: "Optimistic Vision", | ||
duration: 15, | ||
|
||
}, | ||
{ | ||
content: "Working Constitution", | ||
duration: 20, | ||
}, | ||
{ | ||
content: "Delegate Expectations", | ||
duration: 25, | ||
}, | ||
] | ||
}, | ||
{ | ||
id: "3", | ||
img_url: "https://file.coinexstatic.com/2023-11-16/BB3FDB00283C55B4C36B94CFAC0C3271.png", | ||
title: "Governance 101", | ||
status: "start", | ||
rewards: [ | ||
{ | ||
type: "Points", | ||
amount: 50 | ||
}, | ||
{ | ||
type: "OP", | ||
amount: 2 | ||
} | ||
], | ||
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, | ||
}, | ||
{ | ||
content: "Optimistic Vision", | ||
duration: 10, | ||
|
||
}, | ||
{ | ||
content: "Working Constitution", | ||
duration: 15, | ||
}, | ||
{ | ||
content: "Delegate Expectations", | ||
duration: 12, | ||
}, | ||
] | ||
}, | ||
{ | ||
id: "4", | ||
img_url: "https://file.coinexstatic.com/2023-11-16/BB3FDB00283C55B4C36B94CFAC0C3271.png", | ||
title: "Governance 101", | ||
status: "start", | ||
rewards: [ | ||
{ | ||
type: "Points", | ||
amount: 100 | ||
} | ||
], | ||
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, | ||
}, | ||
{ | ||
content: "Optimistic Vision", | ||
duration: 15, | ||
|
||
}, | ||
{ | ||
content: "Working Constitution", | ||
duration: 20, | ||
}, | ||
{ | ||
content: "Delegate Expectations", | ||
duration: 25, | ||
}, | ||
] | ||
}, | ||
] | ||
|
||
render json: quests | ||
end | ||
def show | ||
quest = { | ||
img_url: "https://file.coinexstatic.com/2023-11-16/BB3FDB00283C55B4C36B94CFAC0C3271.png", | ||
title: "Governance 101", | ||
status: "start", | ||
rewards: [ | ||
{ | ||
type: "Points", | ||
amount: 50 | ||
}, | ||
{ | ||
type: "OP", | ||
amount: 2 | ||
} | ||
], | ||
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, | ||
}, | ||
{ | ||
content: "Optimistic Vision", | ||
duration: 10, | ||
}, | ||
{ | ||
content: "Working Constitution", | ||
duration: 15, | ||
}, | ||
{ | ||
content: "Delegate Expectations", | ||
duration: 12, | ||
}, | ||
] | ||
} | ||
|
||
render json: quest | ||
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
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" | ||
resources :quests | ||
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.
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,4 +1,3 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = {}; | ||
|
||
export default nextConfig; |
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
Oops, something went wrong.