Mark as deprecated.

This commit is contained in:
James Cole
2025-02-23 12:27:34 +01:00
parent 8d464962a8
commit 60aef0de1a
22 changed files with 88 additions and 52 deletions

View File

@@ -40,6 +40,8 @@ use Illuminate\Support\Facades\DB;
/** /**
* Class AccountRepository * Class AccountRepository
*
* @deprecated
*/ */
class AccountRepository implements AccountRepositoryInterface class AccountRepository implements AccountRepositoryInterface
{ {

View File

@@ -27,11 +27,12 @@ namespace FireflyIII\Repositories\UserGroups\Account;
use FireflyIII\Models\Account; use FireflyIII\Models\Account;
use FireflyIII\Models\TransactionCurrency; use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Models\UserGroup; use FireflyIII\Models\UserGroup;
use FireflyIII\User;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
/** /**
* Interface AccountRepositoryInterface * Interface AccountRepositoryInterface
*
* @deprecated
*/ */
interface AccountRepositoryInterface interface AccountRepositoryInterface
{ {
@@ -82,9 +83,5 @@ interface AccountRepositoryInterface
public function searchAccount(string $query, array $types, int $page, int $limit): Collection; public function searchAccount(string $query, array $types, int $page, int $limit): Collection;
public function setUser(User $user): void;
public function setUserGroup(UserGroup $userGroup): void;
public function update(Account $account, array $data): Account; public function update(Account $account, array $data): Account;
} }

View File

@@ -36,6 +36,8 @@ use Illuminate\Support\Facades\Log;
/** /**
* Class BillRepository * Class BillRepository
*
* @deprecated
*/ */
class BillRepository implements BillRepositoryInterface class BillRepository implements BillRepositoryInterface
{ {

View File

@@ -26,11 +26,12 @@ namespace FireflyIII\Repositories\UserGroups\Bill;
use Carbon\Carbon; use Carbon\Carbon;
use FireflyIII\Models\Bill; use FireflyIII\Models\Bill;
use FireflyIII\User;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
/** /**
* Interface BillRepositoryInterface * Interface BillRepositoryInterface
*
* @deprecated
*/ */
interface BillRepositoryInterface interface BillRepositoryInterface
{ {
@@ -59,8 +60,6 @@ interface BillRepositoryInterface
*/ */
public function nextDateMatch(Bill $bill, Carbon $date): Carbon; public function nextDateMatch(Bill $bill, Carbon $date): Carbon;
public function setUser(User $user): void;
/** /**
* Collect multi-currency of sum of bills already paid. * Collect multi-currency of sum of bills already paid.
*/ */

View File

@@ -32,6 +32,8 @@ use Illuminate\Support\Facades\Log;
/** /**
* Class AvailableBudgetRepository * Class AvailableBudgetRepository
*
* @deprecated
*/ */
class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
{ {

View File

@@ -25,14 +25,13 @@ declare(strict_types=1);
namespace FireflyIII\Repositories\UserGroups\Budget; namespace FireflyIII\Repositories\UserGroups\Budget;
use Carbon\Carbon; use Carbon\Carbon;
use FireflyIII\User;
/** /**
* Interface AvailableBudgetRepositoryInterface * Interface AvailableBudgetRepositoryInterface
*
* @deprecated
*/ */
interface AvailableBudgetRepositoryInterface interface AvailableBudgetRepositoryInterface
{ {
public function getAvailableBudgetWithCurrency(Carbon $start, Carbon $end): array; public function getAvailableBudgetWithCurrency(Carbon $start, Carbon $end): array;
public function setUser(User $user): void;
} }

View File

@@ -29,6 +29,8 @@ use Illuminate\Support\Collection;
/** /**
* Class BudgetRepository * Class BudgetRepository
*
* @deprecated
*/ */
class BudgetRepository implements BudgetRepositoryInterface class BudgetRepository implements BudgetRepositoryInterface
{ {

View File

@@ -24,20 +24,16 @@ declare(strict_types=1);
namespace FireflyIII\Repositories\UserGroups\Budget; namespace FireflyIII\Repositories\UserGroups\Budget;
use FireflyIII\Models\UserGroup;
use FireflyIII\User;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
/** /**
* Interface BudgetRepositoryInterface * Interface BudgetRepositoryInterface
*
* @deprecated
*/ */
interface BudgetRepositoryInterface interface BudgetRepositoryInterface
{ {
public function getActiveBudgets(): Collection; public function getActiveBudgets(): Collection;
public function getBudgets(): Collection; public function getBudgets(): Collection;
public function setUser(User $user): void;
public function setUserGroup(UserGroup $userGroup): void;
} }

View File

@@ -33,6 +33,8 @@ use Illuminate\Support\Collection;
/** /**
* Class OperationsRepository * Class OperationsRepository
*
* @deprecated
*/ */
class OperationsRepository implements OperationsRepositoryInterface class OperationsRepository implements OperationsRepositoryInterface
{ {

View File

@@ -25,11 +25,12 @@ declare(strict_types=1);
namespace FireflyIII\Repositories\UserGroups\Budget; namespace FireflyIII\Repositories\UserGroups\Budget;
use Carbon\Carbon; use Carbon\Carbon;
use FireflyIII\User;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
/** /**
* Interface OperationsRepositoryInterface * Interface OperationsRepositoryInterface
*
* @deprecated
*/ */
interface OperationsRepositoryInterface interface OperationsRepositoryInterface
{ {
@@ -39,6 +40,4 @@ interface OperationsRepositoryInterface
* as possible. Amounts are always negative. * as possible. Amounts are always negative.
*/ */
public function listExpenses(Carbon $start, Carbon $end, ?Collection $accounts = null, ?Collection $budgets = null): array; public function listExpenses(Carbon $start, Carbon $end, ?Collection $accounts = null, ?Collection $budgets = null): array;
public function setUser(User $user): void;
} }

View File

@@ -28,6 +28,11 @@ use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder; use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
/**
* Class CategoryRepository
*
* @deprecated
*/
class CategoryRepository implements CategoryRepositoryInterface class CategoryRepository implements CategoryRepositoryInterface
{ {
use UserGroupTrait; use UserGroupTrait;

View File

@@ -26,6 +26,11 @@ namespace FireflyIII\Repositories\UserGroups\Category;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
/**
* Interface CategoryRepositoryInterface
*
* @deprecated
*/
interface CategoryRepositoryInterface interface CategoryRepositoryInterface
{ {
/** /**

View File

@@ -43,6 +43,8 @@ use Illuminate\Support\Facades\Log;
/** /**
* Class CurrencyRepository * Class CurrencyRepository
*
* @deprecated
*/ */
class CurrencyRepository implements CurrencyRepositoryInterface class CurrencyRepository implements CurrencyRepositoryInterface
{ {

View File

@@ -27,15 +27,17 @@ namespace FireflyIII\Repositories\UserGroups\Currency;
use FireflyIII\Exceptions\FireflyException; use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\TransactionCurrency; use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Models\UserGroup; use FireflyIII\Models\UserGroup;
use FireflyIII\User;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
/**
* Interface CurrencyRepositoryInterface
*
* @deprecated
*/
interface CurrencyRepositoryInterface interface CurrencyRepositoryInterface
{ {
public function currencyInUse(TransactionCurrency $currency): bool; public function currencyInUse(TransactionCurrency $currency): bool;
public function getUserGroup(): UserGroup;
/** /**
* Currency is in use where exactly. * Currency is in use where exactly.
*/ */
@@ -86,14 +88,14 @@ interface CurrencyRepositoryInterface
public function getByIds(array $ids): Collection; public function getByIds(array $ids): Collection;
public function getUserGroup(): UserGroup;
public function isFallbackCurrency(TransactionCurrency $currency): bool; public function isFallbackCurrency(TransactionCurrency $currency): bool;
public function makeDefault(TransactionCurrency $currency): void; public function makeDefault(TransactionCurrency $currency): void;
public function searchCurrency(string $search, int $limit): Collection; public function searchCurrency(string $search, int $limit): Collection;
public function setUser(User $user): void;
/** /**
* @throws FireflyException * @throws FireflyException
*/ */

View File

@@ -31,10 +31,27 @@ use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
/**
* Class ExchangeRateRepository
*
* @deprecated
*/
class ExchangeRateRepository implements ExchangeRateRepositoryInterface class ExchangeRateRepository implements ExchangeRateRepositoryInterface
{ {
use UserGroupTrait; use UserGroupTrait;
#[\Override]
public function deleteRate(CurrencyExchangeRate $rate): void
{
$this->userGroup->currencyExchangeRates()->where('id', $rate->id)->delete();
}
#[\Override]
public function getAll(): Collection
{
return $this->userGroup->currencyExchangeRates()->orderBy('date', 'ASC')->get();
}
#[\Override] #[\Override]
public function getRates(TransactionCurrency $from, TransactionCurrency $to): Collection public function getRates(TransactionCurrency $from, TransactionCurrency $to): Collection
{ {
@@ -71,24 +88,6 @@ class ExchangeRateRepository implements ExchangeRateRepositoryInterface
; ;
} }
#[\Override]
public function deleteRate(CurrencyExchangeRate $rate): void
{
$this->userGroup->currencyExchangeRates()->where('id', $rate->id)->delete();
}
#[\Override]
public function updateExchangeRate(CurrencyExchangeRate $object, string $rate, ?Carbon $date = null): CurrencyExchangeRate
{
$object->rate = $rate;
if (null !== $date) {
$object->date = $date;
}
$object->save();
return $object;
}
#[\Override] #[\Override]
public function storeExchangeRate(TransactionCurrency $from, TransactionCurrency $to, string $rate, Carbon $date): CurrencyExchangeRate public function storeExchangeRate(TransactionCurrency $from, TransactionCurrency $to, string $rate, Carbon $date): CurrencyExchangeRate
{ {
@@ -106,8 +105,14 @@ class ExchangeRateRepository implements ExchangeRateRepositoryInterface
} }
#[\Override] #[\Override]
public function getAll(): Collection public function updateExchangeRate(CurrencyExchangeRate $object, string $rate, ?Carbon $date = null): CurrencyExchangeRate
{ {
return $this->userGroup->currencyExchangeRates()->orderBy('date', 'ASC')->get(); $object->rate = $rate;
if (null !== $date) {
$object->date = $date;
}
$object->save();
return $object;
} }
} }

View File

@@ -29,17 +29,22 @@ use FireflyIII\Models\CurrencyExchangeRate;
use FireflyIII\Models\TransactionCurrency; use FireflyIII\Models\TransactionCurrency;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
/**
* Interface ExchangeRateRepositoryInterface
*
* @deprecated
*/
interface ExchangeRateRepositoryInterface interface ExchangeRateRepositoryInterface
{ {
public function getRates(TransactionCurrency $from, TransactionCurrency $to): Collection; public function deleteRate(CurrencyExchangeRate $rate): void;
public function getAll(): Collection; public function getAll(): Collection;
public function getRates(TransactionCurrency $from, TransactionCurrency $to): Collection;
public function getSpecificRateOnDate(TransactionCurrency $from, TransactionCurrency $to, Carbon $date): ?CurrencyExchangeRate; public function getSpecificRateOnDate(TransactionCurrency $from, TransactionCurrency $to, Carbon $date): ?CurrencyExchangeRate;
public function deleteRate(CurrencyExchangeRate $rate): void; public function storeExchangeRate(TransactionCurrency $from, TransactionCurrency $to, string $rate, Carbon $date): CurrencyExchangeRate;
public function updateExchangeRate(CurrencyExchangeRate $object, string $rate, ?Carbon $date = null): CurrencyExchangeRate; public function updateExchangeRate(CurrencyExchangeRate $object, string $rate, ?Carbon $date = null): CurrencyExchangeRate;
public function storeExchangeRate(TransactionCurrency $from, TransactionCurrency $to, string $rate, Carbon $date): CurrencyExchangeRate;
} }

View File

@@ -30,6 +30,8 @@ use Illuminate\Support\Collection;
/** /**
* Class JournalRepository * Class JournalRepository
*
* @deprecated
*/ */
class JournalRepository implements JournalRepositoryInterface class JournalRepository implements JournalRepositoryInterface
{ {

View File

@@ -24,11 +24,12 @@ declare(strict_types=1);
namespace FireflyIII\Repositories\UserGroups\Journal; namespace FireflyIII\Repositories\UserGroups\Journal;
use FireflyIII\User;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
/** /**
* Interface JournalRepositoryInterface * Interface JournalRepositoryInterface
*
* @deprecated
*/ */
interface JournalRepositoryInterface interface JournalRepositoryInterface
{ {
@@ -36,6 +37,4 @@ interface JournalRepositoryInterface
* Search in journal descriptions. * Search in journal descriptions.
*/ */
public function searchJournalDescriptions(array $query, int $limit): Collection; public function searchJournalDescriptions(array $query, int $limit): Collection;
public function setUser(User $user): void;
} }

View File

@@ -30,6 +30,8 @@ use Illuminate\Support\Collection;
/** /**
* Class PiggyBankRepository * Class PiggyBankRepository
*
* @deprecated
*/ */
class PiggyBankRepository implements PiggyBankRepositoryInterface class PiggyBankRepository implements PiggyBankRepositoryInterface
{ {

View File

@@ -28,6 +28,8 @@ use Illuminate\Support\Collection;
/** /**
* Interface PiggyBankRepositoryInterface * Interface PiggyBankRepositoryInterface
*
* @deprecated
*/ */
interface PiggyBankRepositoryInterface interface PiggyBankRepositoryInterface
{ {

View File

@@ -30,6 +30,8 @@ use Illuminate\Support\Collection;
/** /**
* Class TagRepository * Class TagRepository
*
* @deprecated
*/ */
class TagRepository implements TagRepositoryInterface class TagRepository implements TagRepositoryInterface
{ {

View File

@@ -26,6 +26,11 @@ namespace FireflyIII\Repositories\UserGroups\Tag;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
/**
* Interface TagRepositoryInterface
*
* @deprecated
*/
interface TagRepositoryInterface interface TagRepositoryInterface
{ {
/** /**