mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-22 08:21:13 -05:00
New notification stats table
- to capture the counts of things that we do - initial commit captures when we create an email or sms DOES NOT know about ultimate success only that we asked our partners to ship the notification Requires some updates when we retry sending in event of error.
This commit is contained in:
@@ -107,7 +107,30 @@ class ApiKey(db.Model):
|
||||
)
|
||||
|
||||
|
||||
TEMPLATE_TYPES = ['sms', 'email', 'letter']
|
||||
class ServiceNotificationStats(db.Model):
|
||||
__tablename__ = 'service_notification_stats'
|
||||
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
day = db.Column(db.String(255), nullable=False)
|
||||
service_id = db.Column(UUID(as_uuid=True), db.ForeignKey('services.id'), index=True, nullable=False)
|
||||
service = db.relationship('Service', backref=db.backref('service_notification_stats', lazy='dynamic'))
|
||||
emails_requested = db.Column(db.BigInteger, index=False, unique=False, nullable=False)
|
||||
emails_delivered = db.Column(db.BigInteger, index=False, unique=False, nullable=True)
|
||||
emails_error = db.Column(db.BigInteger, index=False, unique=False, nullable=True)
|
||||
sms_requested = db.Column(db.BigInteger, index=False, unique=False, nullable=False)
|
||||
sms_delivered = db.Column(db.BigInteger, index=False, unique=False, nullable=True)
|
||||
sms_error = db.Column(db.BigInteger, index=False, unique=False, nullable=True)
|
||||
|
||||
__table_args__ = (
|
||||
UniqueConstraint('service_id', 'day', name='uix_service_to_day'),
|
||||
)
|
||||
|
||||
|
||||
TEMPLATE_TYPE_SMS = 'sms'
|
||||
TEMPLATE_TYPE_EMAIL = 'email'
|
||||
TEMPLATE_TYPE_LETTER = 'letter'
|
||||
|
||||
TEMPLATE_TYPES = [TEMPLATE_TYPE_SMS, TEMPLATE_TYPE_EMAIL, TEMPLATE_TYPE_LETTER]
|
||||
|
||||
|
||||
class Template(db.Model):
|
||||
|
||||
Reference in New Issue
Block a user