mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-21 16:01:15 -05:00
create new table annual_billing
This commit is contained in:
@@ -1462,3 +1462,23 @@ class NotificationEmailReplyTo(db.Model):
|
||||
nullable=False,
|
||||
primary_key=True
|
||||
)
|
||||
|
||||
|
||||
class AnnualBilling(db.Model):
|
||||
__tablename__ = "annual_billing"
|
||||
id = db.Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
||||
service_id = db.Column(UUID(as_uuid=True), db.ForeignKey('services.id'), unique=False, index=True, nullable=False)
|
||||
financial_year_start = db.Column(db.Integer, nullable=False, default=True)
|
||||
free_sms_fragment_limit = db.Column(db.Integer, nullable=False, index=False, unique=False)
|
||||
updated_at = db.Column(db.DateTime, nullable=True, onupdate=datetime.datetime.utcnow)
|
||||
created_at = db.Column(db.DateTime, nullable=False, default=datetime.datetime.utcnow)
|
||||
|
||||
def serialize(self):
|
||||
return {
|
||||
'id': str(self.id),
|
||||
'service_id': str(self.service_id),
|
||||
'free_sms_fragment_limit': str(self.free_sms_fragment_limit),
|
||||
'financial_year_start': str(self.financial_year_start),
|
||||
'created_at': self.created_at.strftime(DATETIME_FORMAT),
|
||||
'updated_at': self.updated_at.strftime(DATETIME_FORMAT) if self.updated_at else None
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user