Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| RevokeInvitationAction | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
| execute | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace ImovelZapAi\Organizations\Application\Actions; |
| 6 | |
| 7 | use ImovelZapAi\Organizations\Domain\Enums\InvitationStatus; |
| 8 | use ImovelZapAi\Organizations\Infrastructure\Persistence\Eloquent\OrganizationInvitationModel; |
| 9 | use RuntimeException; |
| 10 | |
| 11 | final class RevokeInvitationAction |
| 12 | { |
| 13 | public function execute(string $tenantId, string $invitationId): void |
| 14 | { |
| 15 | $invitation = OrganizationInvitationModel::query() |
| 16 | ->where('tenant_id', $tenantId) |
| 17 | ->whereKey($invitationId) |
| 18 | ->first(); |
| 19 | |
| 20 | if ($invitation === null) { |
| 21 | throw new RuntimeException('Convite não encontrado.'); |
| 22 | } |
| 23 | |
| 24 | $invitation->forceFill(['status' => InvitationStatus::Revoked])->save(); |
| 25 | } |
| 26 | } |