mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Rework the webhooks table, allow to update exists webhooks
This commit is contained in:
@@ -4,7 +4,6 @@ declare(strict_types=1);
|
||||
namespace common\models;
|
||||
|
||||
use yii\behaviors\TimestampBehavior;
|
||||
use yii\db\ActiveQueryInterface;
|
||||
use yii\db\ActiveRecord;
|
||||
|
||||
/**
|
||||
@@ -12,18 +11,16 @@ use yii\db\ActiveRecord;
|
||||
* @property int $id
|
||||
* @property string $url
|
||||
* @property string|null $secret
|
||||
* @property string[] $events
|
||||
* @property int $created_at
|
||||
*
|
||||
* Relations:
|
||||
* @property WebHookEvent[] $events
|
||||
*
|
||||
* Behaviors:
|
||||
* @mixin TimestampBehavior
|
||||
*/
|
||||
class WebHook extends ActiveRecord {
|
||||
|
||||
public static function tableName(): string {
|
||||
return '{{%webhooks}}';
|
||||
return 'webhooks';
|
||||
}
|
||||
|
||||
public function behaviors(): array {
|
||||
@@ -35,8 +32,4 @@ class WebHook extends ActiveRecord {
|
||||
];
|
||||
}
|
||||
|
||||
public function getEvents(): ActiveQueryInterface {
|
||||
return $this->hasMany(WebHookEvent::class, ['webhook_id' => 'id']);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,27 +0,0 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace common\models;
|
||||
|
||||
use yii\db\ActiveQueryInterface;
|
||||
use yii\db\ActiveRecord;
|
||||
|
||||
/**
|
||||
* Fields:
|
||||
* @property int $webhook_id
|
||||
* @property string $event_type
|
||||
*
|
||||
* Relations:
|
||||
* @property WebHook $webhook
|
||||
*/
|
||||
class WebHookEvent extends ActiveRecord {
|
||||
|
||||
public static function tableName(): string {
|
||||
return '{{%webhooks_events}}';
|
||||
}
|
||||
|
||||
public function getWebhook(): ActiveQueryInterface {
|
||||
return $this->hasOne(WebHook::class, ['id' => 'webhook_id']);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user