From 6b1d8203c64b3acfe30c6b354c2329e4d771d452 Mon Sep 17 00:00:00 2001 From: eason <85663565+mango766@users.noreply.github.com> Date: Fri, 22 May 2026 16:11:09 +0800 Subject: [PATCH] fix: remove unused working hours endpoint (#13839) Fixes #13752 Removes the standalone `working_hours` API endpoint instead of fixing only the callback typo in `WorkingHoursController`. ## Why The route is not used by the dashboard. The supported product flow already updates business hours through `PATCH /api/v1/accounts/:account_id/inboxes/:id`. The standalone endpoint was already unusable in practice: - The controller callback pointed to the wrong method. - Fixing that callback alone would still leave the endpoint blocked by missing `WorkingHourPolicy` authorization. - Keeping the route would preserve unsupported API surface without making the product flow better. ## What this change does - Removes `PATCH/PUT /api/v1/accounts/:account_id/working_hours/:id`. - Deletes `Api::V1::Accounts::WorkingHoursController`. - Leaves the inbox working-hours update path unchanged. Compatibility note: this removes an undocumented endpoint that was already unusable in practice. Working-hours updates should continue to go through the supported inbox update API. ## Validation - Ran `bin/rails routes -g working_hours` and confirmed the standalone working-hours API route is no longer present. - Searched for remaining `WorkingHoursController` and `resources :working_hours` references. --------- Co-authored-by: easonysliu Co-authored-by: Sojan Jose --- .../v1/accounts/working_hours_controller.rb | 18 ------------------ config/routes.rb | 2 -- 2 files changed, 20 deletions(-) delete mode 100644 app/controllers/api/v1/accounts/working_hours_controller.rb diff --git a/app/controllers/api/v1/accounts/working_hours_controller.rb b/app/controllers/api/v1/accounts/working_hours_controller.rb deleted file mode 100644 index 96d98293a..000000000 --- a/app/controllers/api/v1/accounts/working_hours_controller.rb +++ /dev/null @@ -1,18 +0,0 @@ -class Api::V1::Accounts::WorkingHoursController < Api::V1::Accounts::BaseController - before_action :check_authorization - before_action :fetch_webhook, only: [:update] - - def update - @working_hour.update!(working_hour_params) - end - - private - - def working_hour_params - params.require(:working_hour).permit(:inbox_id, :open_hour, :open_minutes, :close_hour, :close_minutes, :closed_all_day) - end - - def fetch_working_hour - @working_hour = Current.account.working_hours.find(params[:id]) - end -end diff --git a/config/routes.rb b/config/routes.rb index e7f8a4745..3d2d68269 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -378,8 +378,6 @@ Rails.application.routes.draw do end end end - resources :working_hours, only: [:update] - resources :portals do member do patch :archive