add broadcast message status transition map

be explicit about which transitions we allow. this is not necessarily an exhaustive list of everything we'll allow
This commit is contained in:
Leo Hemsted
2020-07-16 16:02:04 +01:00
parent 4043e8fa5e
commit 483221df7d
3 changed files with 51 additions and 3 deletions

View File

@@ -2176,6 +2176,17 @@ class BroadcastStatusType(db.Model):
PRE_BROADCAST_STATUSES = [DRAFT, PENDING_APPROVAL, REJECTED]
LIVE_STATUSES = [BROADCASTING, COMPLETED, CANCELLED]
# these are only the transitions we expect to administer via the API code.
ALLOWED_STATUS_TRANSITIONS = {
DRAFT: {PENDING_APPROVAL},
PENDING_APPROVAL: {REJECTED, DRAFT, BROADCASTING},
REJECTED: {DRAFT, PENDING_APPROVAL},
BROADCASTING: {COMPLETED, CANCELLED},
COMPLETED: {},
CANCELLED: {},
TECHNICAL_FAILURE: {},
}
name = db.Column(db.String, primary_key=True)