Skip to content

Commit

Permalink
add feedback support
Browse files Browse the repository at this point in the history
  • Loading branch information
danReynolds committed Feb 13, 2018
1 parent 01721c2 commit 7a89bcd
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 1 deletion.
24 changes: 24 additions & 0 deletions app/controllers/feedback_controller.rb
@@ -0,0 +1,24 @@
class FeedbackController < ApplicationController
def feature
Feedback.create(
message: feedback_params[:resolvedQuery],
feedback_type: Feedback::FEEDBACK_TYPES[:FEATURE]
)

render status: :ok
end

def bug
Feedback.create(
message: feedback_params[:resolvedQuery],
feedback_type: Feedback::FEEDBACK_TYPES[:BUG]
)
render status: :ok
end

private

def feedback_params
params.require(:result).permit(:resolvedQuery)
end
end
6 changes: 6 additions & 0 deletions app/models/feedback.rb
@@ -0,0 +1,6 @@
class Feedback < ActiveRecord::Base
FEEDBACK_TYPES = {
BUG: :BUG,
FEATURE: :FEATURE,
}
end
5 changes: 5 additions & 0 deletions config/routes.rb
Expand Up @@ -9,6 +9,11 @@
post :patch, to: 'application#patch'
post :reset, to: 'application#reset'

namespace :feedback do
post :bug
post :feature
end

namespace :champions do
post :title
post :ally_tips
Expand Down
9 changes: 9 additions & 0 deletions db/migrate/20180213073704_create_feedback.rb
@@ -0,0 +1,9 @@
class CreateFeedback < ActiveRecord::Migration[5.0]
def change
create_table :feedbacks do |t|
t.timestamps
t.string :message
t.string :feedback_type
end
end
end
9 changes: 8 additions & 1 deletion db/schema.rb
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20171028221812) do
ActiveRecord::Schema.define(version: 20180213073704) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand All @@ -25,6 +25,13 @@
t.index ["summoner_performance_id"], name: "index_bans_on_summoner_performance_id", unique: true, using: :btree
end

create_table "feedbacks", force: :cascade do |t|
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "message"
t.string "feedback_type"
end

create_table "matches", force: :cascade do |t|
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
Expand Down

0 comments on commit 7a89bcd

Please sign in to comment.