mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
merge: ST5 alert response model
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
use Appwrite\Utopia\Response;
|
||||
use Appwrite\Utopia\Response\Model\Account;
|
||||
use Appwrite\Utopia\Response\Model\Alert;
|
||||
use Appwrite\Utopia\Response\Model\AlgoArgon2;
|
||||
use Appwrite\Utopia\Response\Model\AlgoBcrypt;
|
||||
use Appwrite\Utopia\Response\Model\AlgoMd5;
|
||||
@@ -237,6 +238,7 @@ Response::setModel(new BaseList('Column Indexes List', Response::MODEL_COLUMN_IN
|
||||
Response::setModel(new BaseList('Users List', Response::MODEL_USER_LIST, 'users', Response::MODEL_USER));
|
||||
Response::setModel(new BaseList('Sessions List', Response::MODEL_SESSION_LIST, 'sessions', Response::MODEL_SESSION));
|
||||
Response::setModel(new BaseList('Identities List', Response::MODEL_IDENTITY_LIST, 'identities', Response::MODEL_IDENTITY));
|
||||
Response::setModel(new BaseList('Alerts List', Response::MODEL_ALERT_LIST, 'alerts', Response::MODEL_ALERT));
|
||||
Response::setModel(new BaseList('Logs List', Response::MODEL_LOG_LIST, 'logs', Response::MODEL_LOG));
|
||||
Response::setModel(new BaseList('Files List', Response::MODEL_FILE_LIST, 'files', Response::MODEL_FILE));
|
||||
Response::setModel(new BaseList('Buckets List', Response::MODEL_BUCKET_LIST, 'buckets', Response::MODEL_BUCKET));
|
||||
@@ -362,6 +364,7 @@ Response::setModel(new Account());
|
||||
Response::setModel(new Preferences());
|
||||
Response::setModel(new Session());
|
||||
Response::setModel(new Identity());
|
||||
Response::setModel(new Alert());
|
||||
Response::setModel(new Token());
|
||||
Response::setModel(new JWT());
|
||||
Response::setModel(new Locale());
|
||||
|
||||
@@ -67,6 +67,10 @@ class Response extends SwooleResponse
|
||||
public const MODEL_ROW = 'row';
|
||||
public const MODEL_ROW_LIST = 'rowList';
|
||||
|
||||
// Alerts
|
||||
public const MODEL_ALERT = 'alert';
|
||||
public const MODEL_ALERT_LIST = 'alertList';
|
||||
|
||||
// Database Attributes
|
||||
public const MODEL_ATTRIBUTE = 'attribute';
|
||||
public const MODEL_ATTRIBUTE_LIST = 'attributeList';
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
namespace Appwrite\Utopia\Response\Model;
|
||||
|
||||
use Appwrite\Utopia\Response;
|
||||
use Appwrite\Utopia\Response\Model;
|
||||
|
||||
class Alert extends Model
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this
|
||||
->addRule('$id', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Alert ID.',
|
||||
'default' => '',
|
||||
'example' => '5e5ea5c16897e',
|
||||
])
|
||||
->addRule('$createdAt', [
|
||||
'type' => self::TYPE_DATETIME,
|
||||
'description' => 'Alert creation date in ISO 8601 format.',
|
||||
'default' => '',
|
||||
'example' => self::TYPE_DATETIME_EXAMPLE,
|
||||
])
|
||||
->addRule('$updatedAt', [
|
||||
'type' => self::TYPE_DATETIME,
|
||||
'description' => 'Alert update date in ISO 8601 format.',
|
||||
'default' => '',
|
||||
'example' => self::TYPE_DATETIME_EXAMPLE,
|
||||
])
|
||||
->addRule('messageId', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Stable message ID used for dedup.',
|
||||
'default' => '',
|
||||
'example' => 'session.create',
|
||||
'required' => false,
|
||||
])
|
||||
->addRule('type', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Alert type: info, warning, error.',
|
||||
'default' => 'info',
|
||||
'example' => 'info',
|
||||
])
|
||||
->addRule('channel', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Channel: email, sms, push, console, webhook.',
|
||||
'default' => '',
|
||||
'example' => 'email',
|
||||
])
|
||||
->addRule('userId', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'User this alert is addressed to.',
|
||||
'default' => '',
|
||||
'example' => '5e5bb8c16897e',
|
||||
'required' => false,
|
||||
])
|
||||
->addRule('teamId', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Team this alert is addressed to.',
|
||||
'default' => '',
|
||||
'example' => '5e5bb8c16897e',
|
||||
'required' => false,
|
||||
])
|
||||
->addRule('projectId', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Project the alert pertains to.',
|
||||
'default' => '',
|
||||
'example' => '5e5bb8c16897e',
|
||||
'required' => false,
|
||||
])
|
||||
->addRule('title', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Alert title.',
|
||||
'default' => '',
|
||||
'example' => 'New sign-in detected',
|
||||
])
|
||||
->addRule('body', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Alert body.',
|
||||
'default' => '',
|
||||
'example' => 'A new device signed in to your account.',
|
||||
])
|
||||
->addRule('read', [
|
||||
'type' => self::TYPE_BOOLEAN,
|
||||
'description' => 'Whether the alert has been read.',
|
||||
'default' => false,
|
||||
'example' => false,
|
||||
'required' => false,
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName(): string
|
||||
{
|
||||
return 'Alert';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType(): string
|
||||
{
|
||||
return Response::MODEL_ALERT;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user