@ -5,6 +5,11 @@ class CombatsController < ApplicationController
winner: { only: CreaturesController::SHOWABLE_ATTRIBUTES },
}
def index
@combats = Combat.all
render json: @combats.as_json(include: COMBATS_RENDER_CONFIG)
end
def create
left_fighter = Creature.find(params[:left_fighter_id])
right_fighter = Creature.find(params[:right_fighter_id])
@ -10,6 +10,7 @@ Rails.application.routes.draw do
delete '/creatures/:id', to: 'creatures#destroy'
# Combats
get '/combats', to: 'combats#index'
post '/combats', to: 'combats#create'
# Defines the root path route ("/")