Expand test coverage and improve transaction management code.

This commit is contained in:
James Cole
2019-07-01 20:22:35 +02:00
parent 94acb50a6f
commit 5bbe1eab7c
63 changed files with 1251 additions and 812 deletions

View File

@@ -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

View File

@@ -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.
*