This repository has been archived by the owner on May 20, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Covers with tests all controllers - Disables Event sourcing - Adds laravel attribute routes - Redesigned all controllers - Adds user module fixes #45
- Loading branch information
1 parent
9830d82
commit 821d6f2
Showing
85 changed files
with
1,584 additions
and
478 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Contracts\EventSource; | ||
|
||
use EventSauce\EventSourcing\Serialization\SerializablePayload; | ||
|
||
interface Event extends SerializablePayload | ||
{ | ||
|
||
} |
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,10 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Exceptions; | ||
|
||
class EntityNotFoundException extends \DomainException | ||
{ | ||
|
||
} |
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,67 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Infrastructure\CycleOrm\Auth; | ||
|
||
use Cycle\ORM\ORMInterface; | ||
use Cycle\ORM\RepositoryInterface; | ||
use Cycle\ORM\TransactionInterface; | ||
use Illuminate\Contracts\Auth\Authenticatable; | ||
use Illuminate\Contracts\Hashing\Hasher; | ||
use Illuminate\Support\Str; | ||
|
||
final class UserProvider implements \Illuminate\Contracts\Auth\UserProvider | ||
{ | ||
public function __construct( | ||
private ORMInterface $orm, | ||
private TransactionInterface $transaction, | ||
private string $model, | ||
private Hasher $hasher | ||
) { | ||
} | ||
|
||
public function retrieveById($identifier) | ||
{ | ||
return $this->getRepository()->findByPK($identifier); | ||
} | ||
|
||
public function retrieveByToken($identifier, $token) | ||
{ | ||
return $this->getRepository()->findOne([ | ||
'uuid' => $identifier, | ||
'remember_token' => $token, | ||
]); | ||
} | ||
|
||
public function updateRememberToken(Authenticatable $user, $token) | ||
{ | ||
// TODO: use command handler | ||
|
||
$user->setRememberToken($token); | ||
$this->transaction->persist($user); | ||
$this->transaction->run(); | ||
} | ||
|
||
public function retrieveByCredentials(array $credentials) | ||
{ | ||
$criteria = []; | ||
foreach ($credentials as $key => $value) { | ||
if (!Str::contains($key, 'password')) { | ||
$criteria[$key] = $value; | ||
} | ||
} | ||
|
||
return $this->getRepository()->findOne($criteria); | ||
} | ||
|
||
public function validateCredentials(Authenticatable $user, array $credentials) | ||
{ | ||
return $this->hasher->check($credentials['password'], $user->getAuthPassword()); | ||
} | ||
|
||
protected function getRepository(): RepositoryInterface | ||
{ | ||
return $this->orm->getRepository($this->model); | ||
} | ||
} |
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
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
Oops, something went wrong.