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 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Now sentry transaction events are also stored. They are vilible only in performance module. Added ajax pagination to handle listing them.
- Loading branch information
Showing
64 changed files
with
1,303 additions
and
77 deletions.
There are no files selected for viewing
6 changes: 2 additions & 4 deletions
6
app/Application/Commands/FindAllEvents.php → app/Application/Commands/AskEvents.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 |
---|---|---|
@@ -1,17 +1,15 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Commands; | ||
|
||
use App\Contracts\Query\Query; | ||
|
||
final class FindAllEvents implements Query | ||
abstract class AskEvents implements Query | ||
{ | ||
// TODO: use readonly property | ||
public function __construct( | ||
public ?string $type = null, | ||
public ?int $projectId = null, | ||
public ?int $transactionId = null, | ||
) { | ||
} | ||
} |
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,11 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Commands; | ||
|
||
use App\Contracts\Query\Query; | ||
|
||
final class CountEvents extends AskEvents 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,9 @@ | ||
<?php | ||
|
||
namespace App\Commands; | ||
|
||
use App\Contracts\Query\Query; | ||
|
||
class FindAllTransactions 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,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Commands; | ||
|
||
use App\Contracts\Query\Query; | ||
|
||
final class FindEvents extends AskEvents implements Query | ||
{ | ||
// TODO: use readonly property | ||
public function __construct( | ||
public ?string $type = null, | ||
public ?int $projectId = null, | ||
public ?int $transactionId = null, | ||
public ?int $offset = null, | ||
public ?int $limit = null, | ||
) { | ||
parent::__construct($this->type, $this->projectId, $this->transactionId); | ||
} | ||
} |
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 FindTransactionByName 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
24 changes: 24 additions & 0 deletions
24
app/Modules/Events/Application/Queries/CountEvents/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 | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Modules\Events\Application\Queries\CountEvents; | ||
|
||
use App\Commands\CountEvents; | ||
use App\Contracts\Query\QueryHandler; | ||
use Modules\Events\Application\Queries\EventsHandler; | ||
use Modules\Events\Domain\EventRepository; | ||
|
||
class Handler extends EventsHandler implements QueryHandler | ||
{ | ||
public function __construct( | ||
private EventRepository $events | ||
) { | ||
} | ||
|
||
#[\App\Attributes\QueryBus\QueryHandler] | ||
public function __invoke(CountEvents $query): int | ||
{ | ||
return $this->events->count(self::getScopeFromFindEvents($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,26 @@ | ||
<?php | ||
|
||
namespace Modules\Events\Application\Queries; | ||
|
||
use App\Commands\AskEvents; | ||
|
||
abstract class EventsHandler | ||
{ | ||
protected static function getScopeFromFindEvents(AskEvents $query): array | ||
{ | ||
$scope = []; | ||
if ($query->type) { | ||
$scope['type'] = $query->type; | ||
} else { | ||
$scope['type'] = ['<>' => 'sentryTransaction']; | ||
} | ||
if ($query->projectId) { | ||
$scope['project_id'] = $query->projectId; | ||
} | ||
if ($query->transactionId) { | ||
$scope['transaction_id'] = $query->transactionId; | ||
} | ||
|
||
return $scope; | ||
} | ||
} |
36 changes: 0 additions & 36 deletions
36
app/Modules/Events/Application/Queries/FindAllEvents/Handler.php
This file was deleted.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
app/Modules/Events/Application/Queries/FindEvents/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,32 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Modules\Events\Application\Queries\FindEvents; | ||
|
||
use App\Commands\FindEvents; | ||
use App\Contracts\Query\QueryHandler; | ||
use Modules\Events\Application\Queries\EventsHandler; | ||
use Modules\Events\Application\Resources\EventCollection; | ||
use Modules\Events\Domain\EventRepository; | ||
|
||
class Handler extends EventsHandler implements QueryHandler | ||
{ | ||
public function __construct( | ||
private EventRepository $events | ||
) { | ||
} | ||
|
||
#[\App\Attributes\QueryBus\QueryHandler] | ||
public function __invoke(FindEvents $query): iterable | ||
{ | ||
return EventCollection::make( | ||
$this->events->findAll( | ||
self::getScopeFromFindEvents($query), | ||
['date' => 'asc'], | ||
$query->limit, | ||
$query->offset, | ||
) | ||
); | ||
} | ||
} |
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.