mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-14 16:13:54 +00:00
Expand API and routes.
This commit is contained in:
@@ -33,6 +33,7 @@ use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
use FireflyIII\Services\Internal\Destroy\CurrencyDestroyService;
|
||||
use FireflyIII\Services\Internal\Update\CurrencyUpdateService;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
|
||||
@@ -341,6 +342,25 @@ class CurrencyRepository implements CurrencyRepositoryInterface
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of exchange rates with this currency.
|
||||
*
|
||||
* @param TransactionCurrency $currency
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function getExchangeRates(TransactionCurrency $currency): Collection
|
||||
{
|
||||
/** @var CurrencyExchangeRate $rate */
|
||||
return $this->user->currencyExchangeRates()
|
||||
->where(
|
||||
function (Builder $query) use ($currency) {
|
||||
$query->where('from_currency_id', $currency->id);
|
||||
$query->orWhere('to_currency_id', $currency->id);
|
||||
}
|
||||
)->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
|
@@ -37,16 +37,16 @@ interface CurrencyRepositoryInterface
|
||||
/**
|
||||
* @param TransactionCurrency $currency
|
||||
*
|
||||
* @return bool
|
||||
* @return int
|
||||
*/
|
||||
public function currencyInUse(TransactionCurrency $currency): bool;
|
||||
public function countJournals(TransactionCurrency $currency): int;
|
||||
|
||||
/**
|
||||
* @param TransactionCurrency $currency
|
||||
*
|
||||
* @return int
|
||||
* @return bool
|
||||
*/
|
||||
public function countJournals(TransactionCurrency $currency): int;
|
||||
public function currencyInUse(TransactionCurrency $currency): bool;
|
||||
|
||||
/**
|
||||
* @param TransactionCurrency $currency
|
||||
@@ -176,6 +176,15 @@ interface CurrencyRepositoryInterface
|
||||
*/
|
||||
public function getExchangeRate(TransactionCurrency $fromCurrency, TransactionCurrency $toCurrency, Carbon $date): ?CurrencyExchangeRate;
|
||||
|
||||
/**
|
||||
* Return a list of exchange rates with this currency.
|
||||
*
|
||||
* @param TransactionCurrency $currency
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function getExchangeRates(TransactionCurrency $currency): Collection;
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
|
Reference in New Issue
Block a user