summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2016-11-03 23:14:58 +0100
committeremkael <emkael@tlen.pl>2016-11-03 23:14:58 +0100
commit94e03b260197122ae8f6d7dfedfb2a191fdae273 (patch)
tree068ce58e2ab24bf4f7c5d9158da7ae4585c66b58
parentd0dc1a56c91a6c257cb5c89286679952f7656ed9 (diff)
* model for mail queue
-rw-r--r--app/backend/rcal/model.py21
-rw-r--r--app/frontend/model/MailQueue.php35
2 files changed, 54 insertions, 2 deletions
diff --git a/app/backend/rcal/model.py b/app/backend/rcal/model.py
index 4e2644e..61f0047 100644
--- a/app/backend/rcal/model.py
+++ b/app/backend/rcal/model.py
@@ -3,7 +3,7 @@ from sqlalchemy import Column, ForeignKey, Table
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
from sqlalchemy.types import (TIMESTAMP, Boolean, DateTime, Integer, String,
- TypeDecorator)
+ Text, TypeDecorator)
from sqlalchemy_utils import types
@@ -181,4 +181,21 @@ class UserAuthKey(BASE):
order_by='UserAuthKey.id')
-__all__ = ('Calendar', 'Entry', 'Category', 'User', 'UserAuthKey')
+
+class MailQueue(BASE):
+ __tablename__ = 'mail_queue'
+
+ id = Column(Integer, primary_key=True)
+ subject = Column(String(255))
+ html_body = Column(Text)
+ text_body = Column(Text)
+ recipient_name = Column(String(255))
+ recipient_mail = Column(String(255))
+ is_sent = Column(Boolean, nullable=False,
+ default=False, server_default='0', index=True)
+ send_attempts = Column(Integer, nullable=False,
+ default=0, server_default='0', index=True)
+ create_time = Column(UTCDateTime, index=True)
+ last_attempt_time = Column(UTCDateTime, index=True)
+
+__all__ = ('Calendar', 'Entry', 'Category', 'User', 'UserAuthKey', 'MailQueue')
diff --git a/app/frontend/model/MailQueue.php b/app/frontend/model/MailQueue.php
new file mode 100644
index 0000000..d7110f2
--- /dev/null
+++ b/app/frontend/model/MailQueue.php
@@ -0,0 +1,35 @@
+<?php
+
+Prado::using('Application.db.ActiveRecord');
+
+class MailQueue extends ActiveRecord {
+
+ const TABLE = 'mail_queue';
+
+ public $ID;
+ public $Subject;
+ public $HtmlBody;
+ public $TextBody;
+ public $RecipientName;
+ public $RecipientMail;
+ public $IsSent = FALSE;
+ public $SendAttempts = 0;
+ public $CreateTime;
+ public $LastAttemptTime;
+
+ public static $COLUMN_MAPPING = [
+ 'id' => 'ID',
+ 'subject' => 'Subject',
+ 'html_body' => 'HtmlBody',
+ 'text_body' => 'TextBody',
+ 'recipient_name' => 'RecipientName',
+ 'recipient_mail' => 'RecipientMail',
+ 'is_sent' => 'IsSent',
+ 'send_attempts' => 'SendAttempts',
+ 'create_time' => 'CreateTime',
+ 'last_attempt_time' => 'LastAttemptTime'
+ ];
+
+}
+
+?>