Compare commits
No commits in common. "1f32387f63f0eaa0b4e887553bd061efae7a9b36" and "38d18873b84edab15413212d1f227b2e94b4e392" have entirely different histories.
1f32387f63
...
38d18873b8
@ -11,7 +11,6 @@ use RVR\Repository\CommunityRepository;
|
|||||||
use RVR\Repository\CommunityMemberRepository;
|
use RVR\Repository\CommunityMemberRepository;
|
||||||
use RVR\Repository\CurrencyExchangeRateRepository;
|
use RVR\Repository\CurrencyExchangeRateRepository;
|
||||||
use RVR\Repository\CurrencyRepository;
|
use RVR\Repository\CurrencyRepository;
|
||||||
use RVR\Repository\TransactionRepository;
|
|
||||||
use RVR\Repository\UserRepository;
|
use RVR\Repository\UserRepository;
|
||||||
use SokoWeb\Interfaces\Authentication\IAuthenticationRequired;
|
use SokoWeb\Interfaces\Authentication\IAuthenticationRequired;
|
||||||
use SokoWeb\Interfaces\Response\IContent;
|
use SokoWeb\Interfaces\Response\IContent;
|
||||||
@ -30,8 +29,6 @@ class CommunityController implements IAuthenticationRequired
|
|||||||
|
|
||||||
private CurrencyExchangeRateRepository $currencyExchangeRatesRepository;
|
private CurrencyExchangeRateRepository $currencyExchangeRatesRepository;
|
||||||
|
|
||||||
private TransactionRepository $transactionRepository;
|
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->userRepository = new UserRepository();
|
$this->userRepository = new UserRepository();
|
||||||
@ -39,7 +36,6 @@ class CommunityController implements IAuthenticationRequired
|
|||||||
$this->communityMemberRepository = new CommunityMemberRepository();
|
$this->communityMemberRepository = new CommunityMemberRepository();
|
||||||
$this->currencyRepository = new CurrencyRepository();
|
$this->currencyRepository = new CurrencyRepository();
|
||||||
$this->currencyExchangeRatesRepository = new CurrencyExchangeRateRepository();
|
$this->currencyExchangeRatesRepository = new CurrencyExchangeRateRepository();
|
||||||
$this->transactionRepository = new TransactionRepository();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isAuthenticationRequired(): bool
|
public function isAuthenticationRequired(): bool
|
||||||
@ -224,13 +220,6 @@ class CommunityController implements IAuthenticationRequired
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
\Container::$persistentDataManager->loadRelationsFromDb($communityMember, false, ['user']);
|
|
||||||
if ($this->transactionRepository->isAnyForUser($communityMember->getUser())) {
|
|
||||||
return new JsonContent([
|
|
||||||
'error' => ['errorText' => 'There are transactions where the member is payer or payee!']
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
\Container::$persistentDataManager->deleteFromDb($communityMember);
|
\Container::$persistentDataManager->deleteFromDb($communityMember);
|
||||||
|
|
||||||
return new JsonContent(['success' => true]);
|
return new JsonContent(['success' => true]);
|
||||||
|
@ -4,7 +4,6 @@ use Container;
|
|||||||
use Generator;
|
use Generator;
|
||||||
use RVR\PersistentData\Model\Community;
|
use RVR\PersistentData\Model\Community;
|
||||||
use RVR\PersistentData\Model\Transaction;
|
use RVR\PersistentData\Model\Transaction;
|
||||||
use RVR\PersistentData\Model\User;
|
|
||||||
use SokoWeb\Database\Query\Select;
|
use SokoWeb\Database\Query\Select;
|
||||||
|
|
||||||
class TransactionRepository
|
class TransactionRepository
|
||||||
@ -26,16 +25,6 @@ class TransactionRepository
|
|||||||
return $this->selectAllByCommunity($community)->count();
|
return $this->selectAllByCommunity($community)->count();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isAnyForUser(User $user): bool
|
|
||||||
{
|
|
||||||
$select = new Select(Container::$dbConnection, Transaction::getTable());
|
|
||||||
$select->where('payer_user_id', '=', $user->getId());
|
|
||||||
$select->orWhere('payee_user_id', '=', $user->getId());
|
|
||||||
$select->orWhere('payee_user_id', '=', null);
|
|
||||||
|
|
||||||
return $select->count() > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPagedByCommunity(Community $community, int $start, int $limit, bool $useRelations = false, array $withRelations = []): Generator
|
public function getPagedByCommunity(Community $community, int $start, int $limit, bool $useRelations = false, array $withRelations = []): Generator
|
||||||
{
|
{
|
||||||
$select = new Select(Container::$dbConnection);
|
$select = new Select(Container::$dbConnection);
|
||||||
|
Loading…
Reference in New Issue
Block a user