1
0
Fork 0
forked from OpenNeo/impress

Remove unused /colors/pet_types route

I built this API endpoint in anticipation of a change I never actually
made! I'll just remove it for now, leaning toward cleanuppery over
holding onto something I'm not sure about.
This commit is contained in:
Emi Matchu 2024-02-24 15:51:31 -08:00
parent 829d960d70
commit 600cb6b2ea
2 changed files with 0 additions and 36 deletions

View file

@ -1,37 +1,4 @@
class PetTypesController < ApplicationController 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 def show
@pet_type = PetType. @pet_type = PetType.
where(species_id: params[:species_id]). where(species_id: params[:species_id]).

View file

@ -33,9 +33,6 @@ OpenneoImpressItems::Application.routes.draw do
end end
resources :alt_styles, path: 'alt-styles', only: [:index] resources :alt_styles, path: 'alt-styles', only: [:index]
end end
resources :colors, only: [] do
resources :pet_types, only: [:index]
end
resources :alt_styles, path: 'alt-styles', only: [:index] resources :alt_styles, path: 'alt-styles', only: [:index]
# Loading and modeling pets! # Loading and modeling pets!