def _to_model_sub_schema(notification_settings_json): notify_sub_schema = NotificationSubSchema() notify_sub_schema.message = notification_settings_json.get('message' or None) notify_sub_schema.data = notification_settings_json.get('data' or {}) notify_sub_schema.channels = notification_settings_json.get('channels' or []) return notify_sub_schema
def _get_notify_field(self, payload): on_complete = NotificationSubSchema() on_complete.channels = [payload.notification_channel] on_complete.data = { 'user': payload.user, 'source_channel': payload.source_channel } notify = NotificationSchema() notify.on_complete = on_complete return notify