mirror of
https://github.com/elyby/accounts.git
synced 2024-11-30 02:32:26 +05:30
5fc97fdd7a
Reworked webhooks notifications constructors
34 lines
878 B
PHP
34 lines
878 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace common\notifications;
|
|
|
|
use common\models\Account;
|
|
use Webmozart\Assert\Assert;
|
|
|
|
final class AccountDeletedNotification implements NotificationInterface {
|
|
|
|
private Account $account;
|
|
|
|
public function __construct(Account $account) {
|
|
Assert::notNull($account->deleted_at, 'Account must be deleted');
|
|
$this->account = $account;
|
|
}
|
|
|
|
public static function getType(): string {
|
|
return 'account.deletion';
|
|
}
|
|
|
|
public function getPayloads(): array {
|
|
return [
|
|
'id' => $this->account->id,
|
|
'uuid' => $this->account->uuid,
|
|
'username' => $this->account->username,
|
|
'email' => $this->account->email,
|
|
'registered' => date('c', $this->account->created_at),
|
|
'deleted' => date('c', $this->account->deleted_at),
|
|
];
|
|
}
|
|
|
|
}
|