This repository has been archived by the owner on Jul 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from herpaderpaldent/dev
Version 1.0.5
- Loading branch information
Showing
11 changed files
with
149 additions
and
37 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: felix | ||
* Date: 05.01.2019 | ||
* Time: 22:53. | ||
*/ | ||
|
||
namespace Herpaderpaldent\Seat\SeatNotifications\Jobs; | ||
|
||
use Herpaderpaldent\Seat\SeatNotifications\Models\RefreshTokenNotification; | ||
use Herpaderpaldent\Seat\SeatNotifications\Notifications\RefreshTokenDeletedNotification; | ||
use Illuminate\Support\Facades\Notification; | ||
use Illuminate\Support\Facades\Redis; | ||
use Seat\Eveapi\Models\RefreshToken; | ||
|
||
class RefreshTokenDeletionDispatcher extends SeatNotificationsJobBase | ||
{ | ||
/** | ||
* @var array | ||
*/ | ||
protected $tags = ['refresh_token_deletion']; | ||
|
||
/** | ||
* @var \Seat\Eveapi\Models\RefreshToken | ||
*/ | ||
private $refresh_token; | ||
|
||
public function __construct(RefreshToken $refresh_token) | ||
{ | ||
$this->refresh_token = $refresh_token; | ||
} | ||
|
||
public function handle() | ||
{ | ||
Redis::funnel('soft_delete:refresh_token_' . $this->refresh_token->user->name)->limit(1)->then(function () { | ||
logger()->info('SoftDelete detected of ' . $this->refresh_token->user->name); | ||
|
||
$recipients = RefreshTokenNotification::all() | ||
->filter(function ($recepient) { | ||
return $recepient->shouldReceive(); | ||
}); | ||
|
||
Notification::send($recipients, (new RefreshTokenDeletedNotification($this->refresh_token))); | ||
}, function () { | ||
|
||
logger()->info('A Soft-Delete job is already running for ' . $this->refresh_token->user->name); | ||
$this->delete(); | ||
}); | ||
} | ||
} |
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,58 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: felix | ||
* Date: 01.09.2018 | ||
* Time: 13:33. | ||
*/ | ||
|
||
namespace Herpaderpaldent\Seat\SeatNotifications\Jobs; | ||
|
||
use Illuminate\Bus\Queueable; | ||
use Illuminate\Contracts\Queue\ShouldQueue; | ||
use Illuminate\Foundation\Bus\Dispatchable; | ||
use Illuminate\Queue\InteractsWithQueue; | ||
use Illuminate\Queue\SerializesModels; | ||
|
||
abstract class SeatNotificationsJobBase implements ShouldQueue | ||
{ | ||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
protected $tags = []; | ||
|
||
/** | ||
* The number of times the job may be attempted. | ||
* | ||
* @var int | ||
*/ | ||
public $tries = 1; | ||
|
||
/** | ||
* Assign this job a tag so that Horizon can categorize and allow | ||
* for specific tags to be monitored. | ||
* | ||
* If a job specifies the tags property, that is added. | ||
* | ||
* @return array | ||
*/ | ||
public function tags(): array | ||
{ | ||
|
||
$tags = ['seatnotifications', 'dispatcher']; | ||
|
||
if (property_exists($this, 'tags')) | ||
return array_merge($this->tags, $tags); | ||
|
||
return $tags; | ||
} | ||
|
||
/** | ||
* Execute the job. | ||
* | ||
* @return void | ||
*/ | ||
abstract public function handle(); | ||
} |
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 |
---|---|---|
|
@@ -6,5 +6,5 @@ | |
* Time: 10:24. | ||
*/ | ||
return [ | ||
'version' => '1.0.3', | ||
'version' => '1.0.5', | ||
]; |
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