mirror of
https://github.com/ENSL/ensl.org.git
synced 2025-01-11 20:30:47 +00:00
starting to layout acceptance from gatherpage
This commit is contained in:
parent
059be8a76a
commit
7b98117b7b
2 changed files with 33 additions and 0 deletions
32
app/controllers/api/v1/gathers_controller.rb
Normal file
32
app/controllers/api/v1/gathers_controller.rb
Normal 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
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue