-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add two endpoints to check if user donated to reward
- Loading branch information
Showing
6 changed files
with
79 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
/* | ||
* This file is part of the Goteo Package. | ||
* | ||
* (c) Platoniq y Fundación Goteo <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the README.md | ||
* and LICENSE files that was distributed with this source code. | ||
*/ | ||
|
||
namespace App\UseCase; | ||
|
||
use App\Repository\InvestRepository; | ||
use App\Repository\UserRepository; | ||
|
||
class GetUserActiveInvestedRewardUseCase | ||
{ | ||
private UserRepository $userRepository; | ||
private InvestRepository $investRepository; | ||
|
||
public function __construct( | ||
UserRepository $userRepository, | ||
InvestRepository $investRepository | ||
) { | ||
$this->userRepository = $userRepository; | ||
$this->investRepository = $investRepository; | ||
} | ||
|
||
public function execute( | ||
int $rewardId, | ||
string $userId, | ||
): bool { | ||
$user = $this->userRepository->findById($userId); | ||
|
||
return $this->investRepository->hasUserInvestedInRewardLastMonth($user, $rewardId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters