diff --git a/app/controllers/api/my_shows/episodes_controller.rb b/app/controllers/api/my_shows/episodes_controller.rb index 97625b8f..256096ab 100644 --- a/app/controllers/api/my_shows/episodes_controller.rb +++ b/app/controllers/api/my_shows/episodes_controller.rb @@ -22,6 +22,14 @@ def update end end + def destroy + @scheduled_show = @current_radio.scheduled_shows.friendly.find(params[:id]) + authorize! :destroy, @scheduled_show + if @scheduled_show.destroy + render json: @scheduled_show + end + end + private def labels_params ActiveModelSerializers::Deserialization.jsonapi_parse(params, only: [ diff --git a/config/routes.rb b/config/routes.rb index f2db4e64..5aa7d7a2 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -121,7 +121,7 @@ # meant only for consumption by datafruits frontend app namespace :api do resources :my_shows, only: [:index, :create, :update, :destroy, :show] do - resources :episodes, only: [:update], controller: 'my_shows/episodes' + resources :episodes, only: [:update, :destroy], controller: 'my_shows/episodes' end resources :show_series, only: [:index, :show] do resources :episodes, only: [:index, :show], controller: 'show_series/episodes'