project model update
This commit is contained in:
parent
52d93fd4af
commit
1fb492ff47
|
@ -167,6 +167,49 @@ class Project extends Model
|
|||
'example' => new \stdClass(),
|
||||
'array' => true,
|
||||
])
|
||||
->addRule('smtpEnabled', [
|
||||
'type' => self::TYPE_BOOLEAN,
|
||||
'description' => 'Status for custom SMTP',
|
||||
'default' => false,
|
||||
'example' => false,
|
||||
'array' => false
|
||||
])
|
||||
->addRule('smtpSender', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'SMTP sender email',
|
||||
'default' => '',
|
||||
'example' => 'john@appwrite.io',
|
||||
])
|
||||
->addRule('smtpHost', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'SMTP server host name',
|
||||
'default' => '',
|
||||
'example' => 'mail.appwrite.io',
|
||||
])
|
||||
->addRule('smtpPort', [
|
||||
'type' => self::TYPE_INTEGER,
|
||||
'description' => 'SMTP server port',
|
||||
'default' => '',
|
||||
'example' => 25,
|
||||
])
|
||||
->addRule('smtpUsername', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'SMTP server username',
|
||||
'default' => '',
|
||||
'example' => 'emailuser',
|
||||
])
|
||||
->addRule('smtpPassword', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'SMTP server password',
|
||||
'default' => '',
|
||||
'example' => 'securepassword',
|
||||
])
|
||||
->addRule('smtpSecure', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'SMTP server secure protocol',
|
||||
'default' => '',
|
||||
'example' => 'tls',
|
||||
])
|
||||
;
|
||||
|
||||
$services = Config::getParam('services', []);
|
||||
|
@ -232,6 +275,16 @@ class Project extends Model
|
|||
*/
|
||||
public function filter(Document $document): Document
|
||||
{
|
||||
// SMTP
|
||||
$smtp = $document->getAttribute('smtp', []);
|
||||
$document->setAttribute('smtpEnabled', $smtp['enabled'] ?? false);
|
||||
$document->setAttribute('smtpSender', $smtp['sender'] ?? '');
|
||||
$document->setAttribute('smtpHost', $smtp['host'] ?? '');
|
||||
$document->setAttribute('smtpPort', $smtp['port'] ?? '');
|
||||
$document->setAttribute('smtpUsername', $smtp['username'] ?? '');
|
||||
$document->setAttribute('smtpPassword', $smtp['password'] ?? '');
|
||||
$document->setAttribute('smtpSecure', $smtp['secure'] ?? '');
|
||||
|
||||
// Services
|
||||
$values = $document->getAttribute('services', []);
|
||||
$services = Config::getParam('services', []);
|
||||
|
|
Loading…
Reference in a new issue