mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-17 07:08:19 +00:00
Various code cleanup and fixed alignments.
This commit is contained in:
@@ -53,7 +53,7 @@ class TriggerController extends Controller
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
$user = auth()->user();
|
||||
|
||||
$this->ruleGroupRepository = app(RuleGroupRepositoryInterface::class);
|
||||
$this->ruleGroupRepository->setUser($user);
|
||||
@@ -71,14 +71,14 @@ class TriggerController extends Controller
|
||||
*/
|
||||
public function testGroup(TestRequest $request, RuleGroup $group): JsonResponse
|
||||
{
|
||||
$rules = $this->ruleGroupRepository->getActiveRules($group);
|
||||
$rules = $this->ruleGroupRepository->getActiveRules($group);
|
||||
if (0 === $rules->count()) {
|
||||
throw new FireflyException('200023: No rules in this rule group.');
|
||||
}
|
||||
$parameters = $request->getTestParameters();
|
||||
$parameters = $request->getTestParameters();
|
||||
|
||||
/** @var RuleEngineInterface $ruleEngine */
|
||||
$ruleEngine = app(RuleEngineInterface::class);
|
||||
$ruleEngine = app(RuleEngineInterface::class);
|
||||
$ruleEngine->setRules($rules);
|
||||
|
||||
// overrule the rule(s) if necessary.
|
||||
@@ -99,17 +99,17 @@ class TriggerController extends Controller
|
||||
$transactions = $ruleEngine->find();
|
||||
$count = $transactions->count();
|
||||
|
||||
$paginator = new LengthAwarePaginator($transactions, $count, 31337, $this->parameters->get('page'));
|
||||
$paginator = new LengthAwarePaginator($transactions, $count, 31337, $this->parameters->get('page'));
|
||||
$paginator->setPath(route('api.v1.rule-groups.test', [$group->id]).$this->buildParams());
|
||||
|
||||
// resulting list is presented as JSON thing.
|
||||
$manager = $this->getManager();
|
||||
$manager = $this->getManager();
|
||||
|
||||
/** @var TransactionGroupTransformer $transformer */
|
||||
$transformer = app(TransactionGroupTransformer::class);
|
||||
$transformer = app(TransactionGroupTransformer::class);
|
||||
$transformer->setParameters($this->parameters);
|
||||
|
||||
$resource = new FractalCollection($transactions, $transformer, 'transactions');
|
||||
$resource = new FractalCollection($transactions, $transformer, 'transactions');
|
||||
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
||||
|
||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||
@@ -125,7 +125,7 @@ class TriggerController extends Controller
|
||||
*/
|
||||
public function triggerGroup(TriggerRequest $request, RuleGroup $group): JsonResponse
|
||||
{
|
||||
$rules = $this->ruleGroupRepository->getActiveRules($group);
|
||||
$rules = $this->ruleGroupRepository->getActiveRules($group);
|
||||
if (0 === $rules->count()) {
|
||||
throw new FireflyException('200023: No rules in this rule group.');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user