Coverage for portality/models/notifications.py: 100%
52 statements
« prev ^ index » next coverage.py v6.4.2, created at 2022-07-22 15:59 +0100
« prev ^ index » next coverage.py v6.4.2, created at 2022-07-22 15:59 +0100
1from portality.dao import DomainObject
2from portality.lib import dates
5class Notification(DomainObject):
6 """~~Notification:Model->DomainObject:Model~~"""
7 __type__ = "notification"
9 def __init__(self, **kwargs):
10 super(Notification, self).__init__(**kwargs)
12 @property
13 def who(self):
14 return self.data.get("who")
16 @who.setter
17 def who(self, account_id):
18 self.data["who"] = account_id
20 @property
21 def short(self):
22 return self.data.get("short")
24 @short.setter
25 def short(self, message):
26 self.data["short"] = message
28 @property
29 def long(self):
30 return self.data.get("long")
32 @long.setter
33 def long(self, message):
34 self.data["long"] = message
36 @property
37 def seen_date(self):
38 return self.data.get("seen_date")
40 @seen_date.setter
41 def seen_date(self, date):
42 self.data["seen_date"] = date
44 def is_seen(self):
45 return "seen_date" in self.data
47 def set_seen(self):
48 self.seen_date = dates.now()
50 @property
51 def action(self):
52 return self.data.get("action")
54 @action.setter
55 def action(self, action_url):
56 self.data["action"] = action_url
58 @property
59 def classification(self):
60 return self.data.get("classification")
62 @classification.setter
63 def classification(self, classification):
64 self.data["classification"] = classification
66 @property
67 def created_by(self):
68 return self.data.get("created_by")
70 @created_by.setter
71 def created_by(self, consumer_id):
72 self.data["created_by"] = consumer_id