mirror of
https://github.com/GSA/notifications-api.git
synced 2026-07-19 14:04:20 -04:00
Added constraints to services.postage: not nullable and can only containt "first" or "second"
This commit is contained in:
@@ -167,7 +167,6 @@ def dao_create_service(service, user, service_id=None, service_permissions=None)
|
||||
service.active = True
|
||||
service.research_mode = False
|
||||
service.crown = service.organisation_type == 'central'
|
||||
service.postage = 'second'
|
||||
|
||||
for permission in service_permissions:
|
||||
service_permission = ServicePermission(service_id=service.id, permission=permission)
|
||||
@@ -181,7 +180,6 @@ def dao_create_service(service, user, service_id=None, service_permissions=None)
|
||||
@transactional
|
||||
@version_class(Service)
|
||||
def dao_update_service(service):
|
||||
service.postage = service.postage or 'second'
|
||||
db.session.add(service)
|
||||
|
||||
|
||||
|
||||
@@ -353,7 +353,9 @@ class Service(db.Model, Versioned):
|
||||
crown = db.Column(db.Boolean, index=False, nullable=False, default=True)
|
||||
rate_limit = db.Column(db.Integer, index=False, nullable=False, default=3000)
|
||||
contact_link = db.Column(db.String(255), nullable=True, unique=False)
|
||||
postage = db.Column(db.String(255), index=False, nullable=True)
|
||||
postage = db.Column(db.String(255), index=False, nullable=False, default='second')
|
||||
|
||||
CheckConstraint("'postage' in ('first', 'second')")
|
||||
|
||||
organisation = db.relationship(
|
||||
'Organisation',
|
||||
|
||||
Reference in New Issue
Block a user