mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 07:35:34 -05:00
Merge branch 'master' of https://github.com/alphagov/notifications-api into vb-free-sms-limit-history
This commit is contained in:
@@ -321,7 +321,7 @@ class ServiceSmsSender(db.Model):
|
||||
|
||||
id = db.Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
||||
sms_sender = db.Column(db.String(11), nullable=False)
|
||||
service_id = db.Column(UUID(as_uuid=True), db.ForeignKey('services.id'), unique=True, index=True, 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_sms_senders", uselist=True))
|
||||
is_default = db.Column(db.Boolean, nullable=False, default=True)
|
||||
inbound_number_id = db.Column(UUID(as_uuid=True), db.ForeignKey('inbound_numbers.id'),
|
||||
@@ -330,6 +330,17 @@ class ServiceSmsSender(db.Model):
|
||||
created_at = db.Column(db.DateTime, default=datetime.datetime.utcnow, nullable=False)
|
||||
updated_at = db.Column(db.DateTime, nullable=True, onupdate=datetime.datetime.utcnow)
|
||||
|
||||
def serialize(self):
|
||||
return {
|
||||
"id": str(self.id),
|
||||
"sms_sender": self.sms_sender,
|
||||
"service_id": str(self.service_id),
|
||||
"is_default": self.is_default,
|
||||
"inbound_number_id": str(self.inbound_number_id) if self.inbound_number_id else None,
|
||||
"created_at": self.created_at.strftime(DATETIME_FORMAT),
|
||||
"updated_at": self.updated_at.strftime(DATETIME_FORMAT) if self.updated_at else None,
|
||||
}
|
||||
|
||||
|
||||
class ServicePermission(db.Model):
|
||||
__tablename__ = "service_permissions"
|
||||
|
||||
Reference in New Issue
Block a user