starting to layout acceptance from gatherpage

This commit is contained in:
Absurdon 2017-04-27 02:41:55 +02:00 committed by Ari Timonen
parent 059be8a76a
commit 7b98117b7b
2 changed files with 33 additions and 0 deletions

View file

@ -0,0 +1,32 @@
class Api::V1::GathersController < Api::V1::BaseController
def create
# gather = createFromParams
#
# unless gather
# render json: { errors: ['Invalid Data']}, status: :bad_request
# return
# end
render text: createFromParams.inspect
end
private
def createFromParams
@gan = params[:gather]
unless checkAuth
return nil
end
Gather.transaction do
gather = Gather.create(category_id: 18, status: Gather::STATE_FINISHED, created_at: Time.zone.parse(@gan[:done][:time]) )
end
end
def checkAuth
params[:sign] == Digest::SHA2.hexdigest( @gan.to_json + ENV['APP_SECRET'])
end
end

View file

@ -10,6 +10,7 @@ Ensl::Application.routes.draw do
resources :teams, only: [:show]
resources :servers, only: [:index]
resources :maps, only: [:index]
resources :gathers, only: [:create]
end
end