Sha256: e4d21e625eeb79a8ba223c81ba959e4d8c0f5a60482ec7163c38995c0c4fd178
Contents?: true
Size: 931 Bytes
Versions: 1
Compression:
Stored size: 931 Bytes
Contents
# frozen_string_literal: true require 'trailblazer/dsl' module Pragma module Operation # Finds all records of the requested resource, authorizes them, paginates them and decorates # them. # # @author Alessandro Desantis class Index < Pragma::Operation::Base step Macro::Classes() step :retrieve! step :scope! step Macro::Pagination(), fail_fast: true step Macro::Decorator(name: :collection), fail_fast: true step :respond! def retrieve!(options) options['model'] = options['model.class'].all end def scope!(options, current_user:, model:, **) options['model'] = options['policy.default.scope.class'].new(current_user, model).resolve end def respond!(options, model:, **) options['result.response'] = Response::Ok.new( entity: options['result.decorator.collection'] ) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pragma-2.0.0 | lib/pragma/operation/index.rb |