mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-16 09:22:33 +00:00
Expand test coverage and improve transaction management code.
This commit is contained in:
@@ -54,6 +54,8 @@ use stdClass;
|
||||
*/
|
||||
class JournalRepository implements JournalRepositoryInterface
|
||||
{
|
||||
|
||||
|
||||
/** @var User */
|
||||
private $user;
|
||||
|
||||
@@ -67,7 +69,25 @@ class JournalRepository implements JournalRepositoryInterface
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Search in journal descriptions.
|
||||
*
|
||||
* @param string $search
|
||||
* @return Collection
|
||||
*/
|
||||
public function searchJournalDescriptions(string $search): Collection
|
||||
{
|
||||
$query = $this->user->transactionJournals()
|
||||
->orderBy('date', 'DESC');
|
||||
if ('' !== $query) {
|
||||
$query->where('description', 'LIKE', sprintf('%%%s%%', $search));
|
||||
}
|
||||
|
||||
return $query->get();
|
||||
}
|
||||
|
||||
/** @noinspection MoreThanThreeArgumentsInspection */
|
||||
|
||||
/**
|
||||
* @param TransactionJournal $journal
|
||||
* @param TransactionType $type
|
||||
|
@@ -41,6 +41,14 @@ use Illuminate\Support\MessageBag;
|
||||
interface JournalRepositoryInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* Search in journal descriptions.
|
||||
*
|
||||
* @param string $search
|
||||
* @return Collection
|
||||
*/
|
||||
public function searchJournalDescriptions(string $search): Collection;
|
||||
|
||||
/**
|
||||
* Get all transaction journals with a specific type, regardless of user.
|
||||
*
|
||||
|
Reference in New Issue
Block a user