mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-04 03:43:07 +00:00
Clean up code.
This commit is contained in:
@@ -97,6 +97,7 @@ abstract class Controller extends BaseController
|
||||
// some date fields:
|
||||
$dates = ['start', 'end', 'date'];
|
||||
foreach ($dates as $field) {
|
||||
$date = null;
|
||||
try {
|
||||
$date = request()->query->get($field);
|
||||
} catch (BadRequestException $e) {
|
||||
|
@@ -44,7 +44,7 @@ class ShowController extends Controller
|
||||
/**
|
||||
* BillController constructor.
|
||||
*
|
||||
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -67,7 +67,7 @@ class ShowController extends Controller
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
|
||||
|
||||
*/
|
||||
public function index(): JsonResponse
|
||||
{
|
||||
@@ -98,7 +98,7 @@ class ShowController extends Controller
|
||||
* @param Bill $bill
|
||||
*
|
||||
* @return JsonResponse
|
||||
|
||||
|
||||
*/
|
||||
public function show(Bill $bill): JsonResponse
|
||||
{
|
||||
|
@@ -44,7 +44,7 @@ class StoreController extends Controller
|
||||
/**
|
||||
* BillController constructor.
|
||||
*
|
||||
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
@@ -41,7 +41,7 @@ class UpdateController extends Controller
|
||||
/**
|
||||
* BillController constructor.
|
||||
*
|
||||
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
@@ -41,7 +41,7 @@ class StoreController extends Controller
|
||||
/**
|
||||
* StoreController constructor.
|
||||
*
|
||||
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
@@ -41,7 +41,7 @@ class UpdateController extends Controller
|
||||
/**
|
||||
* UpdateController constructor.
|
||||
*
|
||||
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
@@ -47,7 +47,7 @@ class UpdateController extends Controller
|
||||
*
|
||||
* BudgetLimitController constructor.
|
||||
*
|
||||
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
@@ -38,7 +38,7 @@ class DestroyController extends Controller
|
||||
/**
|
||||
* CategoryController constructor.
|
||||
*
|
||||
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -62,7 +62,7 @@ class DestroyController extends Controller
|
||||
* @param Category $category
|
||||
*
|
||||
* @return JsonResponse
|
||||
|
||||
|
||||
*/
|
||||
public function destroy(Category $category): JsonResponse
|
||||
{
|
||||
|
@@ -50,7 +50,7 @@ class ListController extends Controller
|
||||
/**
|
||||
* CategoryController constructor.
|
||||
*
|
||||
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -73,7 +73,7 @@ class ListController extends Controller
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
|
||||
|
||||
*/
|
||||
public function attachments(Category $category): JsonResponse
|
||||
{
|
||||
@@ -110,7 +110,7 @@ class ListController extends Controller
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
|
||||
|
||||
*/
|
||||
public function transactions(Request $request, Category $category): JsonResponse
|
||||
{
|
||||
|
@@ -44,7 +44,7 @@ class ShowController extends Controller
|
||||
/**
|
||||
* CategoryController constructor.
|
||||
*
|
||||
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -67,7 +67,7 @@ class ShowController extends Controller
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
|
||||
|
||||
*/
|
||||
public function index(): JsonResponse
|
||||
{
|
||||
@@ -103,7 +103,7 @@ class ShowController extends Controller
|
||||
* @param Category $category
|
||||
*
|
||||
* @return JsonResponse
|
||||
|
||||
|
||||
*/
|
||||
public function show(Category $category): JsonResponse
|
||||
{
|
||||
|
@@ -39,7 +39,7 @@ class DestroyController extends Controller
|
||||
/**
|
||||
* ObjectGroupController constructor.
|
||||
*
|
||||
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -64,7 +64,7 @@ class DestroyController extends Controller
|
||||
*
|
||||
* @param ObjectGroup $objectGroup
|
||||
*
|
||||
|
||||
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function destroy(ObjectGroup $objectGroup): JsonResponse
|
||||
|
@@ -46,7 +46,7 @@ class ShowController extends Controller
|
||||
/**
|
||||
* ObjectGroupController constructor.
|
||||
*
|
||||
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -73,7 +73,7 @@ class ShowController extends Controller
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
|
||||
|
||||
*/
|
||||
public function index(Request $request): JsonResponse
|
||||
{
|
||||
|
@@ -42,7 +42,7 @@ class UpdateController extends Controller
|
||||
/**
|
||||
* ObjectGroupController constructor.
|
||||
*
|
||||
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
@@ -41,7 +41,7 @@ class StoreController extends Controller
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
@@ -41,7 +41,7 @@ class UpdateController extends Controller
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
@@ -45,7 +45,7 @@ class ShowController extends Controller
|
||||
/**
|
||||
* RuleController constructor.
|
||||
*
|
||||
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -71,7 +71,7 @@ class ShowController extends Controller
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
|
||||
|
||||
*/
|
||||
public function index(): JsonResponse
|
||||
{
|
||||
@@ -108,7 +108,7 @@ class ShowController extends Controller
|
||||
* @param Rule $rule
|
||||
*
|
||||
* @return JsonResponse
|
||||
|
||||
|
||||
*/
|
||||
public function show(Rule $rule): JsonResponse
|
||||
{
|
||||
|
@@ -44,7 +44,7 @@ class ListController extends Controller
|
||||
/**
|
||||
* RuleGroupController constructor.
|
||||
*
|
||||
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -70,7 +70,7 @@ class ListController extends Controller
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
|
||||
|
||||
*/
|
||||
public function rules(RuleGroup $group): JsonResponse
|
||||
{
|
||||
|
@@ -43,7 +43,7 @@ class StoreController extends Controller
|
||||
/**
|
||||
* RuleGroupController constructor.
|
||||
*
|
||||
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
@@ -39,7 +39,7 @@ class DestroyController extends Controller
|
||||
/**
|
||||
* TagController constructor.
|
||||
*
|
||||
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -66,7 +66,7 @@ class DestroyController extends Controller
|
||||
* @param Tag $tag
|
||||
*
|
||||
* @return JsonResponse
|
||||
|
||||
|
||||
*/
|
||||
public function destroy(Tag $tag): JsonResponse
|
||||
{
|
||||
|
@@ -50,7 +50,7 @@ class ListController extends Controller
|
||||
/**
|
||||
* TagController constructor.
|
||||
*
|
||||
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -76,7 +76,7 @@ class ListController extends Controller
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
|
||||
|
||||
*/
|
||||
public function attachments(Tag $tag): JsonResponse
|
||||
{
|
||||
@@ -112,7 +112,7 @@ class ListController extends Controller
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
|
||||
|
||||
*/
|
||||
public function transactions(Request $request, Tag $tag): JsonResponse
|
||||
{
|
||||
|
@@ -51,7 +51,7 @@ class ShowController extends Controller
|
||||
/**
|
||||
* CurrencyRepository constructor.
|
||||
*
|
||||
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -75,7 +75,7 @@ class ShowController extends Controller
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @throws JsonException
|
||||
|
||||
|
||||
*/
|
||||
public function index(): JsonResponse
|
||||
{
|
||||
@@ -111,7 +111,7 @@ class ShowController extends Controller
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @throws JsonException
|
||||
|
||||
|
||||
*/
|
||||
public function show(TransactionCurrency $currency): JsonResponse
|
||||
{
|
||||
@@ -137,7 +137,7 @@ class ShowController extends Controller
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @throws JsonException
|
||||
|
||||
|
||||
*/
|
||||
public function showDefault(): JsonResponse
|
||||
{
|
||||
|
@@ -50,7 +50,7 @@ class UpdateController extends Controller
|
||||
/**
|
||||
* CurrencyRepository constructor.
|
||||
*
|
||||
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -76,7 +76,7 @@ class UpdateController extends Controller
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @throws JsonException
|
||||
|
||||
|
||||
*/
|
||||
public function disable(TransactionCurrency $currency): JsonResponse
|
||||
{
|
||||
@@ -109,7 +109,7 @@ class UpdateController extends Controller
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
|
||||
|
||||
*/
|
||||
public function makeDefault(TransactionCurrency $currency): JsonResponse
|
||||
{
|
||||
@@ -142,7 +142,7 @@ class UpdateController extends Controller
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @throws JsonException
|
||||
|
||||
|
||||
*/
|
||||
public function enable(TransactionCurrency $currency): JsonResponse
|
||||
{
|
||||
|
@@ -37,7 +37,7 @@ class DestroyController extends Controller
|
||||
/**
|
||||
* TransactionLinkController constructor.
|
||||
*
|
||||
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -65,7 +65,7 @@ class DestroyController extends Controller
|
||||
* @param TransactionJournalLink $link
|
||||
*
|
||||
* @return JsonResponse
|
||||
|
||||
|
||||
*/
|
||||
public function destroy(TransactionJournalLink $link): JsonResponse
|
||||
{
|
||||
|
@@ -44,7 +44,7 @@ class ShowController extends Controller
|
||||
/**
|
||||
* TransactionLinkController constructor.
|
||||
*
|
||||
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -73,7 +73,7 @@ class ShowController extends Controller
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
|
||||
|
||||
*/
|
||||
public function index(Request $request): JsonResponse
|
||||
{
|
||||
@@ -114,7 +114,7 @@ class ShowController extends Controller
|
||||
* @param TransactionJournalLink $journalLink
|
||||
*
|
||||
* @return JsonResponse
|
||||
|
||||
|
||||
*/
|
||||
public function show(TransactionJournalLink $journalLink): JsonResponse
|
||||
{
|
||||
|
@@ -28,7 +28,6 @@ use FireflyIII\Api\V1\Controllers\Controller;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\LinkType;
|
||||
use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface;
|
||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
use FireflyIII\Support\Http\Api\TransactionFilter;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
@@ -41,7 +40,6 @@ class DestroyController extends Controller
|
||||
use TransactionFilter;
|
||||
|
||||
private LinkTypeRepositoryInterface $repository;
|
||||
private UserRepositoryInterface $userRepository;
|
||||
|
||||
/**
|
||||
* LinkTypeController constructor.
|
||||
@@ -54,9 +52,8 @@ class DestroyController extends Controller
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
$this->repository = app(LinkTypeRepositoryInterface::class);
|
||||
$this->userRepository = app(UserRepositoryInterface::class);
|
||||
$user = auth()->user();
|
||||
$this->repository = app(LinkTypeRepositoryInterface::class);
|
||||
$this->repository->setUser($user);
|
||||
|
||||
return $next($request);
|
||||
@@ -74,7 +71,6 @@ class DestroyController extends Controller
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
|
||||
*/
|
||||
public function destroy(LinkType $linkType): JsonResponse
|
||||
{
|
||||
|
@@ -50,7 +50,7 @@ class ListController extends Controller
|
||||
/**
|
||||
* LinkTypeController constructor.
|
||||
*
|
||||
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -76,7 +76,7 @@ class ListController extends Controller
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
|
||||
|
||||
*/
|
||||
public function transactions(Request $request, LinkType $linkType): JsonResponse
|
||||
{
|
||||
|
@@ -50,7 +50,7 @@ class ShowController extends Controller
|
||||
/**
|
||||
* LinkTypeController constructor.
|
||||
*
|
||||
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -74,7 +74,7 @@ class ShowController extends Controller
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
|
||||
|
||||
*/
|
||||
public function index(): JsonResponse
|
||||
{
|
||||
@@ -110,7 +110,7 @@ class ShowController extends Controller
|
||||
* @param LinkType $linkType
|
||||
*
|
||||
* @return JsonResponse
|
||||
|
||||
|
||||
*/
|
||||
public function show(LinkType $linkType): JsonResponse
|
||||
{
|
||||
|
@@ -49,7 +49,7 @@ class StoreController extends Controller
|
||||
/**
|
||||
* LinkTypeController constructor.
|
||||
*
|
||||
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
@@ -41,7 +41,7 @@ class MessageController extends Controller
|
||||
private WebhookRepositoryInterface $repository;
|
||||
|
||||
/**
|
||||
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
@@ -92,6 +92,7 @@ class Controller extends BaseController
|
||||
|
||||
// some date fields:
|
||||
foreach ($dates as $field) {
|
||||
$date = null;
|
||||
try {
|
||||
$date = request()->query->get($field);
|
||||
} catch (BadRequestException $e) {
|
||||
|
Reference in New Issue
Block a user