@live-change/notification-service 0.9.30 → 0.9.32
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.
- package/config.js +20 -0
- package/definition.js +0 -7
- package/index.js +1 -0
- package/notification.js +5 -2
- package/package.json +3 -3
- package/settings.js +1 -1
package/config.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import definition from './definition.js'
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
contactTypes,
|
|
5
|
+
notificationTypes,
|
|
6
|
+
defaultSettings
|
|
7
|
+
} = definition.config
|
|
8
|
+
|
|
9
|
+
definition.clientConfig = {
|
|
10
|
+
contactTypes,
|
|
11
|
+
notificationTypes,
|
|
12
|
+
defaultSettings
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const config = {
|
|
16
|
+
contactTypes,
|
|
17
|
+
notificationTypes
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default config
|
package/definition.js
CHANGED
|
@@ -9,11 +9,4 @@ const definition = app.createServiceDefinition({
|
|
|
9
9
|
use: [ userService, relationsPlugin ]
|
|
10
10
|
})
|
|
11
11
|
|
|
12
|
-
const config = definition.config
|
|
13
|
-
|
|
14
|
-
definition.clientConfig = {
|
|
15
|
-
contactTypes: config.contactTypes,
|
|
16
|
-
notificationTypes: config.notificationTypes
|
|
17
|
-
}
|
|
18
|
-
|
|
19
12
|
export default definition
|
package/index.js
CHANGED
package/notification.js
CHANGED
|
@@ -212,7 +212,7 @@ definition.trigger({
|
|
|
212
212
|
},
|
|
213
213
|
...config.fields
|
|
214
214
|
},
|
|
215
|
-
async execute(params , { service }, emit) {
|
|
215
|
+
async execute(params , { service, trigger }, emit) {
|
|
216
216
|
const { sessionOrUserType, sessionOrUser, notificationType } = params
|
|
217
217
|
if(!sessionOrUserType || !sessionOrUser) throw new Error("session or user required")
|
|
218
218
|
const notification = app.generateUid()
|
|
@@ -224,8 +224,11 @@ definition.trigger({
|
|
|
224
224
|
notification,
|
|
225
225
|
data: { ...data, sessionOrUserType, sessionOrUser, time, readState: 'new' }
|
|
226
226
|
})
|
|
227
|
-
await
|
|
227
|
+
await trigger({ type: 'notificationCreated' }, {
|
|
228
228
|
notification,
|
|
229
|
+
sessionOrUser,
|
|
230
|
+
sessionOrUserType,
|
|
231
|
+
time,
|
|
229
232
|
...data
|
|
230
233
|
})
|
|
231
234
|
return notification
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-change/notification-service",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.32",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"url": "https://www.viamage.com/"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@live-change/framework": "^0.9.
|
|
24
|
+
"@live-change/framework": "^0.9.32"
|
|
25
25
|
},
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "41022fc283020e2da3e82aa27274401052d2379a",
|
|
27
27
|
"type": "module"
|
|
28
28
|
}
|
package/settings.js
CHANGED
|
@@ -10,7 +10,7 @@ async function clientOwnsContact({ user }, { contactType, contact }) {
|
|
|
10
10
|
const [service, model] = contactType.split('_')
|
|
11
11
|
if(!config.contactTypes.includes(service)) return false
|
|
12
12
|
const contactData = await app.dao.get(['database', 'tableObject', app.databaseName, contactType, contact ])
|
|
13
|
-
return contactData.user
|
|
13
|
+
return contactData.user === user
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
const NotificationSetting = definition.model({
|