Merge pull request #69 from jedmund/info_endpoints

Add endpoints for getting info about canonical items
This commit is contained in:
Justin Edmund 2023-01-31 22:18:05 -08:00 committed by GitHub
commit 2dd6dbae57
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 61 additions and 0 deletions

View file

@ -0,0 +1,19 @@
# frozen_string_literal: true
module Api
module V1
class CharactersController < Api::V1::ApiController
before_action :set
def show
render json: CharacterBlueprint.render(@character)
end
private
def set
@character = Character.where(granblue_id: params[:id]).first
end
end
end
end

View file

@ -0,0 +1,19 @@
# frozen_string_literal: true
module Api
module V1
class SummonsController < Api::V1::ApiController
before_action :set
def show
render json: SummonBlueprint.render(@summon)
end
private
def set
@summon = Summon.where(granblue_id: params[:id]).first
end
end
end
end

View file

@ -0,0 +1,19 @@
# frozen_string_literal: true
module Api
module V1
class WeaponsController < Api::V1::ApiController
before_action :set
def show
render json: WeaponBlueprint.render(@weapon)
end
private
def set
@weapon = Weapon.where(granblue_id: params[:id]).first
end
end
end
end

View file

@ -11,6 +11,9 @@ Rails.application.routes.draw do
resources :grid_weapons, only: %i[update destroy]
resources :grid_characters, only: %i[update destroy]
resources :grid_summons, only: %i[update destroy]
resources :weapons, only: :show
resources :characters, only: :show
resources :summons, only: :show
resources :favorites, only: [:create]
get 'version', to: 'api#version'

View file

@ -16,6 +16,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_31_084343) do
enable_extension "pg_trgm"
enable_extension "pgcrypto"
enable_extension "plpgsql"
enable_extension "timescaledb"
create_table "app_updates", primary_key: "updated_at", id: :datetime, force: :cascade do |t|
t.string "update_type", null: false