module Admin class StorageLocationsController < ApplicationController before_action :set_storage_location, only: [:show, :edit, :update, :destroy] def index @storage_locations = StorageLocation.all end def show end def new @storage_location = StorageLocation.new end def create @storage_location = StorageLocation.new(storage_location_params) if @storage_location.save redirect_to [:admin, @storage_location], notice: "Storage location was successfully created." else render :new, status: :unprocessable_entity end end def edit end def update if @storage_location.update(storage_location_params) redirect_to [:admin, @storage_location], notice: "Storage location was successfully updated." else render :edit, status: :unprocessable_entity end end def destroy @storage_location.destroy redirect_to admin_storage_locations_url, notice: "Storage location was successfully destroyed." end def scan # Placeholder for scan functionality redirect_to [:admin, @storage_location], notice: "Scan functionality will be implemented." end def scan_status # Placeholder for scan status render json: { status: "idle" } end private def set_storage_location @storage_location = StorageLocation.find(params[:id]) end def storage_location_params params.require(:storage_location).permit(:name, :path, :location_type, :writable, :enabled, :scan_subdirectories, :priority, :settings) end end end