diff --git a/app/dao/users_dao.py b/app/dao/users_dao.py index 44098b1a6..f50b70c45 100644 --- a/app/dao/users_dao.py +++ b/app/dao/users_dao.py @@ -31,7 +31,10 @@ def save_user_attribute(usr, update_dict=None): def save_model_user( - user, update_dict=None, password=None, validated_email_access=False + user, + update_dict=None, + password=None, + validated_email_access=False, ): if password: user.password = password diff --git a/app/models.py b/app/models.py index 4f228ed17..8144bc873 100644 --- a/app/models.py +++ b/app/models.py @@ -137,7 +137,7 @@ class User(db.Model): state = db.Column(db.String, nullable=False, default="pending") platform_admin = db.Column(db.Boolean, nullable=False, default=False) current_session_id = db.Column(UUID(as_uuid=True), nullable=True) - auth_type = enum_column(AuthType, index=True, nullable=False, default=AuthType.SMS) + auth_type = enum_column(AuthType, index=True, nullable=False, default=AuthType.SMS.value) email_access_validated_at = db.Column( db.DateTime, index=False, @@ -310,7 +310,7 @@ class EmailBranding(db.Model): BrandType, index=True, nullable=False, - default=BrandType.ORG, + default=BrandType.ORG.value, ) def serialize(self): @@ -1130,7 +1130,7 @@ class TemplateBase(db.Model): TemplateProcessType, index=True, nullable=False, - default=TemplateProcessType.NORMAL, + default=TemplateProcessType.NORMAL.value, ) redact_personalisation = association_proxy( @@ -1385,7 +1385,7 @@ class Job(db.Model): JobStatus, index=True, nullable=False, - default=JobStatus.PENDING, + default=JobStatus.PENDING.value, ) archived = db.Column(db.Boolean, nullable=False, default=False) @@ -1453,7 +1453,7 @@ class NotificationAllTimeView(db.Model): NotificationStatus, name="notification_status", nullable=True, - default=NotificationStatus.CREATED, + default=NotificationStatus.CREATED.value, key="status", ) reference = db.Column(db.String) @@ -1511,7 +1511,7 @@ class Notification(db.Model): NotificationStatus, name="notification_status", nullable=True, - default=NotificationStatus.CREATED, + default=NotificationStatus.CREATED.value, key="status", ) reference = db.Column(db.String, nullable=True, index=True) @@ -1788,7 +1788,7 @@ class NotificationHistory(db.Model, HistoryModel): NotificationStatus, name="notification_status", nullable=True, - default=NotificationStatus.CREATED, + default=NotificationStatus.CREATED.value, key="status", ) reference = db.Column(db.String, nullable=True, index=True) @@ -1856,11 +1856,11 @@ class InvitedUser(db.Model): status = enum_column( InvitedUserStatus, nullable=False, - default=InvitedUserStatus.PENDING, + default=InvitedUserStatus.PENDING.value, ) permissions = db.Column(db.String, nullable=False) - auth_type = enum_column(AuthType, index=True, nullable=False, default=AuthType.SMS) - folder_permissions = db.Column(JSONB(none_as_null=True), nullable=False, default=[]) + auth_type = enum_column(AuthType, index=True, nullable=False, default=AuthType.SMS.value) + folder_permissions = db.Column(JSONB(none_as_null=True), nullable=False, default=list) # would like to have used properties for this but haven't found a way to make them # play nice with marshmallow yet @@ -1894,7 +1894,7 @@ class InvitedOrganizationUser(db.Model): status = enum_column( InvitedUserStatus, nullable=False, - default=InvitedUserStatus.PENDING, + default=InvitedUserStatus.PENDING.value, ) def serialize(self):