mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-25 08:43:55 -04:00
Update models to remove postage constraints and add new postage types
This commit is contained in:
@@ -901,13 +901,6 @@ class TemplateBase(db.Model):
|
|||||||
hidden = db.Column(db.Boolean, nullable=False, default=False)
|
hidden = db.Column(db.Boolean, nullable=False, default=False)
|
||||||
subject = db.Column(db.Text)
|
subject = db.Column(db.Text)
|
||||||
postage = db.Column(db.String, nullable=True)
|
postage = db.Column(db.String, nullable=True)
|
||||||
CheckConstraint("""
|
|
||||||
CASE WHEN template_type = 'letter' THEN
|
|
||||||
postage is not null and postage in ('first', 'second')
|
|
||||||
ELSE
|
|
||||||
postage is null
|
|
||||||
END
|
|
||||||
""")
|
|
||||||
|
|
||||||
@declared_attr
|
@declared_attr
|
||||||
def service_id(cls):
|
def service_id(cls):
|
||||||
@@ -1353,10 +1346,14 @@ DVLA_RESPONSE_STATUS_SENT = 'Sent'
|
|||||||
|
|
||||||
FIRST_CLASS = 'first'
|
FIRST_CLASS = 'first'
|
||||||
SECOND_CLASS = 'second'
|
SECOND_CLASS = 'second'
|
||||||
POSTAGE_TYPES = [FIRST_CLASS, SECOND_CLASS]
|
EUROPE = 'europe'
|
||||||
|
REST_OF_WORLD = 'rest-of-world'
|
||||||
|
POSTAGE_TYPES = [FIRST_CLASS, SECOND_CLASS, EUROPE, REST_OF_WORLD]
|
||||||
RESOLVE_POSTAGE_FOR_FILE_NAME = {
|
RESOLVE_POSTAGE_FOR_FILE_NAME = {
|
||||||
FIRST_CLASS: 1,
|
FIRST_CLASS: 1,
|
||||||
SECOND_CLASS: 2
|
SECOND_CLASS: 2,
|
||||||
|
EUROPE: 'E',
|
||||||
|
REST_OF_WORLD: 'N',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1431,13 +1428,6 @@ class Notification(db.Model):
|
|||||||
document_download_count = db.Column(db.Integer, nullable=True)
|
document_download_count = db.Column(db.Integer, nullable=True)
|
||||||
|
|
||||||
postage = db.Column(db.String, nullable=True)
|
postage = db.Column(db.String, nullable=True)
|
||||||
CheckConstraint("""
|
|
||||||
CASE WHEN notification_type = 'letter' THEN
|
|
||||||
postage is not null and postage in ('first', 'second')
|
|
||||||
ELSE
|
|
||||||
postage is null
|
|
||||||
END
|
|
||||||
""")
|
|
||||||
|
|
||||||
__table_args__ = (
|
__table_args__ = (
|
||||||
db.ForeignKeyConstraint(
|
db.ForeignKeyConstraint(
|
||||||
@@ -1698,13 +1688,6 @@ class NotificationHistory(db.Model, HistoryModel):
|
|||||||
created_by_id = db.Column(UUID(as_uuid=True), nullable=True)
|
created_by_id = db.Column(UUID(as_uuid=True), nullable=True)
|
||||||
|
|
||||||
postage = db.Column(db.String, nullable=True)
|
postage = db.Column(db.String, nullable=True)
|
||||||
CheckConstraint("""
|
|
||||||
CASE WHEN notification_type = 'letter' THEN
|
|
||||||
postage is not null and postage in ('first', 'second')
|
|
||||||
ELSE
|
|
||||||
postage is null
|
|
||||||
END
|
|
||||||
""")
|
|
||||||
|
|
||||||
document_download_count = db.Column(db.Integer, nullable=True)
|
document_download_count = db.Column(db.Integer, nullable=True)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user