<commit_before>from modularodm import fields

from framework.mongo import StoredObject, ObjectId
from modularodm.exceptions import ValidationValueError

from website.project.model import Node
from website.notifications.constants import NOTIFICATION_TYPES


def validate_subscription_type(value):
    if value not in NOTIFICATION_TYPES:
        raise ValidationValueError


class NotificationSubscription(StoredObject):
    _id = fields.StringField(primary=True)  # pxyz_wiki_updated, uabc_comment_replies

    event_name = fields.StringField()      # wiki_updated, comment_replies
    owner = fields.AbstractForeignField()

    # Notification types
    none = fields.ForeignField('user', list=True)
    email_digest = fields.ForeignField('user', list=True)
    email_transactional = fields.ForeignField('user', list=True)<commit_msg>Restore backrefs to NotificationSubscription class<commit_after>from modularodm import fields

from framework.mongo import StoredObject, ObjectId
from modularodm.exceptions import ValidationValueError

from website.project.model import Node
from website.notifications.constants import NOTIFICATION_TYPES


def validate_subscription_type(value):
    if value not in NOTIFICATION_TYPES:
        raise ValidationValueError


class NotificationSubscription(StoredObject):
    _id = fields.StringField(primary=True)  # pxyz_wiki_updated, uabc_comment_replies

    event_name = fields.StringField()      # wiki_updated, comment_replies
    owner = fields.AbstractForeignField()

    # Notification types
    none = fields.ForeignField('user', list=True, backref='none')
    email_digest = fields.ForeignField('user', list=True, backref='email_digest')
    email_transactional = fields.ForeignField('user', list=True, backref='email_transactional')
{'fraction_non_alphanumeric': 0.07328072153325817, 'fraction_numerical': 0.0, 'mean_word_length': 5.7748091603053435, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4098421', 'n_tokens_mistral': 499, 'n_tokens_neox': 483, 'n_words': 112}