@plusscommunities/pluss-core-aws 2.1.4-beta.0 → 2.2.2-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const indexQuery = require("../common/indexQuery");
|
|
2
|
+
const deleteRef = require("../common/deleteRef");
|
|
3
|
+
|
|
4
|
+
module.exports = async (entityId, type, site) => {
|
|
5
|
+
console.log("deleteNotificationsByEntity", { entityId, type, site });
|
|
6
|
+
const query = {
|
|
7
|
+
IndexName: "NotificationsIdIndex",
|
|
8
|
+
KeyConditionExpression: "Id = :entityId",
|
|
9
|
+
ExpressionAttributeValues: {
|
|
10
|
+
":entityId": entityId,
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
let toDelete = [];
|
|
15
|
+
const { Items } = await indexQuery("notifications", query);
|
|
16
|
+
console.log("deleteNotificationsByEntity", JSON.stringify(Items, null, 2));
|
|
17
|
+
if (type || site) {
|
|
18
|
+
toDelete = Items.filter(
|
|
19
|
+
(i) => (!type || i.Type === type) && (!site || i.Site === site)
|
|
20
|
+
);
|
|
21
|
+
} else {
|
|
22
|
+
toDelete = Items;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const promises = [];
|
|
26
|
+
toDelete.forEach((i) => {
|
|
27
|
+
promises.push(deleteRef("notifications", "RowId", i.RowId));
|
|
28
|
+
console.log("deleteNotificationsByEntity - deleted", i.RowId);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
return Promise.all(promises);
|
|
32
|
+
};
|
|
@@ -3,126 +3,155 @@ const { getConfig } = require("../config");
|
|
|
3
3
|
|
|
4
4
|
module.exports = (noti) => {
|
|
5
5
|
const thisNoti = { ...noti };
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
eventChangeText = "
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
6
|
+
switch (noti.Type) {
|
|
7
|
+
case "MaintenanceJobStatusChanged":
|
|
8
|
+
thisNoti.Text = `Your request is ${noti.Data.status}`;
|
|
9
|
+
thisNoti.Subtext = noti.Data.title || noti.Data.description;
|
|
10
|
+
thisNoti.Icon = "wrench";
|
|
11
|
+
break;
|
|
12
|
+
case "MaintenanceJobAssigned":
|
|
13
|
+
thisNoti.Text = `You have been assigned a request`;
|
|
14
|
+
thisNoti.Subtext = noti.Data.title || noti.Data.description;
|
|
15
|
+
thisNoti.Icon = "wrench";
|
|
16
|
+
break;
|
|
17
|
+
case "MaintenanceJobUnassigned":
|
|
18
|
+
thisNoti.Text = `A request you were assigned has been reassigned`;
|
|
19
|
+
thisNoti.Subtext = noti.Data.title || noti.Data.description;
|
|
20
|
+
thisNoti.Icon = "wrench";
|
|
21
|
+
break;
|
|
22
|
+
case "MaintenanceJobCommented":
|
|
23
|
+
thisNoti.Text = noti.Data.comment;
|
|
24
|
+
thisNoti.Subtext = noti.Data.title || noti.Data.description;
|
|
25
|
+
thisNoti.Icon = "wrench";
|
|
26
|
+
break;
|
|
27
|
+
case "EntityCommented":
|
|
28
|
+
thisNoti.Text = noti.Data.comment;
|
|
29
|
+
thisNoti.Subtext = noti.Data.title || noti.Data.description;
|
|
30
|
+
thisNoti.Icon = "commenting";
|
|
31
|
+
break;
|
|
32
|
+
case "EventRepChange":
|
|
33
|
+
let eventChangeText = "";
|
|
34
|
+
if (noti.Data.LocationChanged && noti.Data.TimeChanged) {
|
|
35
|
+
eventChangeText = "time and location";
|
|
36
|
+
} else if (noti.Data.LocationChanged) {
|
|
37
|
+
eventChangeText = "location";
|
|
38
|
+
} else if (noti.Data.TimeChanged) {
|
|
39
|
+
eventChangeText = "time";
|
|
40
|
+
}
|
|
41
|
+
thisNoti.Text = `An event you are attending has changed ${eventChangeText}`;
|
|
42
|
+
thisNoti.Subtext = noti.Data.Title;
|
|
43
|
+
thisNoti.Icon = "calendar";
|
|
44
|
+
break;
|
|
45
|
+
case "EventRepRemoved":
|
|
46
|
+
thisNoti.Text = "An event you are attending has been cancelled";
|
|
47
|
+
thisNoti.Subtext = noti.Data.Title;
|
|
48
|
+
thisNoti.TimeText = noti.Data.Time;
|
|
49
|
+
thisNoti.Icon = "calendar-times-o";
|
|
50
|
+
break;
|
|
51
|
+
case "ApproveNewsSubmission":
|
|
52
|
+
thisNoti.Text = "A story you submitted has been approved";
|
|
53
|
+
thisNoti.Subtext = noti.Data.Title;
|
|
54
|
+
thisNoti.Icon = "newspaper-o";
|
|
55
|
+
break;
|
|
56
|
+
case "ApproveEventSubmission":
|
|
57
|
+
thisNoti.Text = "An event you submitted has been approved";
|
|
58
|
+
thisNoti.Subtext = noti.Data.Title;
|
|
59
|
+
thisNoti.Icon = "calendar-check-o";
|
|
60
|
+
break;
|
|
61
|
+
case "EventRegisterFromWaitlist":
|
|
62
|
+
thisNoti.Text =
|
|
63
|
+
"A spot has opened up on an event you were on the waitlist for";
|
|
64
|
+
thisNoti.Subtext = noti.Data.Title;
|
|
65
|
+
thisNoti.Icon = "calendar-plus-o";
|
|
66
|
+
break;
|
|
67
|
+
case "NewsletterPublished":
|
|
68
|
+
thisNoti.Text = `News: ${noti.Data.Title}`;
|
|
69
|
+
thisNoti.Subtext =
|
|
70
|
+
!_.isEmpty(noti.Data.Text) && noti.Data.Text.length > 100
|
|
71
|
+
? `${noti.Data.Text.substring(0, 100)}...`
|
|
72
|
+
: noti.Data.Text;
|
|
73
|
+
thisNoti.Icon = "newspaper-o";
|
|
74
|
+
break;
|
|
75
|
+
case "FormLockoutFailure":
|
|
76
|
+
thisNoti.Text =
|
|
77
|
+
"Someone answered yes to a question on the kiosk and was denied access";
|
|
78
|
+
thisNoti.Icon = "exclamation-triangle";
|
|
79
|
+
break;
|
|
80
|
+
case "FormLockoutSuccess":
|
|
81
|
+
thisNoti.Text =
|
|
82
|
+
"Someone answered no to all questions on the kiosk and was granted access";
|
|
83
|
+
thisNoti.Icon = "check";
|
|
84
|
+
break;
|
|
85
|
+
case "InformationAdded":
|
|
86
|
+
thisNoti.Text = `There is new important information available: ${noti.Data.title}`;
|
|
87
|
+
thisNoti.Icon = "info";
|
|
88
|
+
break;
|
|
89
|
+
case "InformationUpdated":
|
|
90
|
+
thisNoti.Text = `Important information updated: ${noti.Data.title}`;
|
|
91
|
+
thisNoti.Icon = "info";
|
|
92
|
+
break;
|
|
93
|
+
case "PollAdded":
|
|
94
|
+
thisNoti.Text = `There is a new survey available: ${noti.Data.Title}`;
|
|
95
|
+
thisNoti.Icon = "pie-chart";
|
|
96
|
+
break;
|
|
97
|
+
case "OfferAdded":
|
|
98
|
+
thisNoti.Text = `There is a new offer available: ${noti.Data.Title}`;
|
|
99
|
+
thisNoti.Icon = "shopping-bag";
|
|
100
|
+
break;
|
|
101
|
+
case "ServiceAdded":
|
|
102
|
+
thisNoti.Text = `There is a new service available: ${noti.Data.Title}`;
|
|
103
|
+
thisNoti.Icon = "stethoscope";
|
|
104
|
+
break;
|
|
105
|
+
case "EventAdded":
|
|
106
|
+
thisNoti.Text = `There is a new event: ${noti.Data.Title}`;
|
|
107
|
+
thisNoti.Icon = "calendar-plus-o";
|
|
108
|
+
break;
|
|
109
|
+
case "FacilityAdded":
|
|
110
|
+
thisNoti.Text = `There is a new ${getConfig().strings.FACILITY}: ${
|
|
111
|
+
noti.Data.Title
|
|
112
|
+
}`;
|
|
113
|
+
thisNoti.Icon = "building";
|
|
114
|
+
break;
|
|
115
|
+
case "MapAdded":
|
|
116
|
+
thisNoti.Text = `There is a new map: ${noti.Data.title}`;
|
|
117
|
+
thisNoti.Icon = "map-marker";
|
|
118
|
+
break;
|
|
119
|
+
case "ImportantContactAdded":
|
|
120
|
+
thisNoti.Text = `There is a new contact: ${noti.Data.title}`;
|
|
121
|
+
thisNoti.Icon = "address-card-o";
|
|
122
|
+
break;
|
|
123
|
+
case "PersonalDocumentAdded":
|
|
124
|
+
thisNoti.Text = `There is a new document: ${noti.Data.Name}`;
|
|
125
|
+
thisNoti.Icon = "file-o";
|
|
126
|
+
break;
|
|
127
|
+
case "AppointmentAdded":
|
|
128
|
+
thisNoti.Text = noti.Data.message;
|
|
129
|
+
thisNoti.Icon = "calendar-plus-o";
|
|
130
|
+
break;
|
|
131
|
+
case "AppointmentUpdated":
|
|
132
|
+
thisNoti.Text = noti.Data.message;
|
|
133
|
+
thisNoti.Icon = "calendar-check-o";
|
|
134
|
+
break;
|
|
135
|
+
case "AppointmentCancelled":
|
|
136
|
+
thisNoti.Text = noti.Data.message;
|
|
137
|
+
thisNoti.Icon = "calendar-times-o";
|
|
138
|
+
break;
|
|
139
|
+
case "AppointmentReminder":
|
|
140
|
+
thisNoti.Text = noti.Data.message;
|
|
141
|
+
thisNoti.Icon = "bell-o";
|
|
142
|
+
break;
|
|
143
|
+
case "AppointmentFollowup":
|
|
144
|
+
thisNoti.Text = noti.Data.message;
|
|
145
|
+
thisNoti.Icon = "calendar-check-o";
|
|
146
|
+
break;
|
|
147
|
+
case "ScheduledAction":
|
|
148
|
+
thisNoti.Text = noti.Data.message;
|
|
149
|
+
thisNoti.Icon = "bell-o";
|
|
150
|
+
break;
|
|
151
|
+
default:
|
|
152
|
+
thisNoti.Text = "You have received a notification";
|
|
153
|
+
thisNoti.Icon = "bell-o";
|
|
154
|
+
break;
|
|
126
155
|
}
|
|
127
156
|
return thisNoti;
|
|
128
157
|
};
|
package/package.json
CHANGED