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.
Default project is assigned to events by default. For sentry events project id is taken from projectId param in sentry.event.store route. Events can by filtered by setting projectId in events.type route.
- Loading branch information
Showing
47 changed files
with
439 additions
and
60 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace App\Commands; | ||
|
||
use App\Contracts\Query\Query; | ||
|
||
class FindAllProjects implements Query | ||
{ | ||
} |
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,13 @@ | ||
<?php | ||
|
||
namespace App\Commands; | ||
|
||
use App\Contracts\Query\Query; | ||
|
||
class FindProjectByName implements Query | ||
{ | ||
public function __construct( | ||
public string $name | ||
) { | ||
} | ||
} |
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
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
24 changes: 24 additions & 0 deletions
24
app/Modules/Project/Application/Queries/FindAllProjects/Handler.php
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,24 @@ | ||
<?php | ||
|
||
namespace Modules\Project\Application\Queries\FindAllProjects; | ||
|
||
use App\Commands\FindAllProjects; | ||
use App\Contracts\Query\QueryHandler; | ||
use Modules\Project\Application\Resources\ProjectCollection; | ||
use Modules\Project\Domain\ProjectRepository; | ||
|
||
class Handler implements QueryHandler | ||
{ | ||
public function __construct( | ||
private ProjectRepository $projects | ||
) { | ||
} | ||
|
||
#[\App\Attributes\QueryBus\QueryHandler] | ||
public function __invoke(FindAllProjects $query): iterable | ||
{ | ||
return ProjectCollection::make( | ||
$this->projects->findAll() | ||
); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
app/Modules/Project/Application/Queries/FindByName/Handler.php
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,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Modules\Project\Application\Queries\FindByName; | ||
|
||
use App\Commands\FindProjectByName; | ||
use App\Contracts\Query\QueryHandler; | ||
use App\Exceptions\EntityNotFoundException; | ||
use Modules\Project\Application\Resources\ProjectResource; | ||
use Modules\Project\Domain\ProjectRepository; | ||
|
||
class Handler implements QueryHandler | ||
{ | ||
public function __construct(private ProjectRepository $projectRepository) | ||
{ | ||
} | ||
|
||
#[\App\Attributes\QueryBus\QueryHandler] | ||
public function __invoke(FindProjectByName $query): ProjectResource | ||
{ | ||
$project = $this->projectRepository->findOne(['name' => $query->name]); | ||
if (! $project) { | ||
throw new EntityNotFoundException( | ||
sprintf('Project with given name [%s] was not found.', $query->name) | ||
); | ||
} | ||
|
||
return new ProjectResource($project); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
app/Modules/Project/Application/Resources/ProjectCollection.php
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 | ||
|
||
namespace Modules\Project\Application\Resources; | ||
|
||
use Illuminate\Http\Resources\Json\ResourceCollection; | ||
|
||
class ProjectCollection extends ResourceCollection | ||
{ | ||
public $collects = ProjectResource::class; | ||
} |
16 changes: 16 additions & 0 deletions
16
app/Modules/Project/Application/Resources/ProjectResource.php
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,16 @@ | ||
<?php | ||
|
||
namespace Modules\Project\Application\Resources; | ||
|
||
use Illuminate\Http\Resources\Json\JsonResource; | ||
|
||
class ProjectResource extends JsonResource | ||
{ | ||
public function toArray($request): array | ||
{ | ||
return [ | ||
'id' => $this->getId(), | ||
'name' => $this->getName(), | ||
]; | ||
} | ||
} |
Oops, something went wrong.