chatwoot-develop/app/controllers/api/v1/accounts/captain/pricings_controller.rb
Rodrigo Borba 968ae6a314
Some checks failed
Build and Push to GHCR (multi-arch) / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Build and Push to GHCR (multi-arch) / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Build and Push to GHCR (multi-arch) / merge (push) Has been cancelled
ajuste no tabela de preços
2026-01-23 00:30:11 -03:00

20 lines
526 B
Ruby

class Api::V1::Accounts::Captain::PricingsController < Api::V1::Accounts::BaseController
before_action :fetch_pricings, only: [:index]
def index
render json: @pricings
end
private
def fetch_pricings
@pricings = current_account.captain_pricings
return unless params[:query].present?
# Fuzzy search using ILIKE for case-insensitive matching
# We wrap the query in % for wildcard matching on both sides
@pricings = @pricings.where('suite_category ILIKE ?', "%#{params[:query]}%")
end
end