From 600cb6b2eac6a173805127addb36dd9f9702b5d5 Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Sat, 24 Feb 2024 15:51:31 -0800 Subject: [PATCH] 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. --- app/controllers/pet_types_controller.rb | 33 ------------------------- config/routes.rb | 3 --- 2 files changed, 36 deletions(-) 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!