Sha256: 9e83341955f317a50a7e129c5288e880f218eb729c9022bdbba45a2c03c9eb9a

Contents?: true

Size: 1.5 KB

Versions: 3

Compression:

Stored size: 1.5 KB

Contents

module AtomicAdmin
  class AtomicTenantClientIdStrategyController < ApplicationController
    def pinned_client_id_params
      params.permit(:iss, :client_id, :application_instance_id)
    end

    def find_pinned_client_id
      AtomicTenant::PinnedClientId.find_by(id: params[:id])
    end

    def search 
      page = AtomicTenant::PinnedClientId
        .where(application_instance_id: params[:application_instance_id])
        .order(:id).paginate(page: params[:page], per_page: 30)
      render json: {
        pinned_client_ids: page,
        page: params[:page],
        total_pages: page.total_pages
      }
    end

    # def index
    #   page = AtomicTenant::PinnedClientId.all.order(:id).paginate(page: params[:page], per_page: 30)
    #   render json: {
    #     pinned_client_ids: page,
    #     page: params[:page],
    #     total_pages: page.total_pages
    #   }
    # end

    def create
      result = AtomicTenant::PinnedClientId.create!(pinned_client_id_params)
      render json: { pinned_client_id: result }
    end

    def show
      pinned_client_id = find_pinned_client_id
      render json: {pinned_client_id: pinned_client_id}
    end

    # def update
    #   pinned_client_id = find_pinned_client_id
    #   pinned_client_id.update!(pinned_client_id_params)

    #   render json: {pinned_client_id: find_pinned_client_id}
    # end

    def destroy
      pinned_client_id = find_pinned_client_id
      pinned_client_id.destroy
      render json: { pinned_client_id: pinned_client_id }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
atomic_admin-1.0.0 app/controllers/atomic_admin/atomic_tenant_client_id_strategy_controller.rb
atomic_admin-0.2.0 app/controllers/atomic_admin/atomic_tenant_client_id_strategy_controller.rb
atomic_admin-0.1.0 app/controllers/atomic_admin/atomic_tenant_client_id_strategy_controller.rb