diff --git a/app/controllers/pet_types_controller.rb b/app/controllers/pet_types_controller.rb index aaacb189..ed30e051 100644 --- a/app/controllers/pet_types_controller.rb +++ b/app/controllers/pet_types_controller.rb @@ -1,37 +1,4 @@ class PetTypesController < ApplicationController - def index - color = Color.find params[:color_id] - pet_types = color.pet_types.includes(pet_states: [:swf_assets]). - includes(:species) - - # This is a relatively big request, for relatively static data. Let's - # consider it fresh for 10min (so new pet releases show up quickly), but - # it's also okay for the client to quickly serve the cached copy then - # reload in the background, if it's been less than a day. - expires_in 10.minutes, stale_while_revalidate: 1.day, public: true - - # We dive deep to get all the right fields for appearance data, cuz this - # endpoint is primarily used to power the preview on the item page! - render json: pet_types.map { |pt| - pt.as_json( - only: [:id, :body_id], - include: { - species: {only: [:id], methods: [:name, :human_name]}, - canonical_pet_state: { - only: [:id], - methods: [:pose], - include: { - swf_assets: { - only: [:id, :known_glitches], - methods: [:zone, :restricted_zones, :urls], - }, - }, - }, - }, - ) - } - end - def show @pet_type = PetType. where(species_id: params[:species_id]). diff --git a/config/routes.rb b/config/routes.rb index 9edf4575..62684d73 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -33,9 +33,6 @@ OpenneoImpressItems::Application.routes.draw do end resources :alt_styles, path: 'alt-styles', only: [:index] end - resources :colors, only: [] do - resources :pet_types, only: [:index] - end resources :alt_styles, path: 'alt-styles', only: [:index] # Loading and modeling pets!