|
|
@@ -31,25 +31,6 @@ const responseSchemas = {
|
|
31
|
31
|
error: errorSchema.single,
|
|
32
|
32
|
}
|
|
33
|
33
|
|
|
34
|
|
-const notifyMembers = (profileId, targetId, noticationCb, h) => {
|
|
35
|
|
- noticationCb(
|
|
36
|
|
- `${profileId}.stonk`,
|
|
37
|
|
- {
|
|
38
|
|
- name: `${targetId} Match Fffound`,
|
|
39
|
|
- type: 'info',
|
|
40
|
|
- },
|
|
41
|
|
- h,
|
|
42
|
|
- )
|
|
43
|
|
- noticationCb(
|
|
44
|
|
- `${targetId}.stonk`,
|
|
45
|
|
- {
|
|
46
|
|
- name: `${profileId} Match Fffound`,
|
|
47
|
|
- type: 'info',
|
|
48
|
|
- },
|
|
49
|
|
- h,
|
|
50
|
|
- )
|
|
51
|
|
-}
|
|
52
|
|
-
|
|
53
|
34
|
module.exports = {
|
|
54
|
35
|
method: 'POST',
|
|
55
|
36
|
path: '/{profile_id}/join',
|
|
|
@@ -92,18 +73,29 @@ module.exports = {
|
|
92
|
73
|
groupingToWrite,
|
|
93
|
74
|
role,
|
|
94
|
75
|
)
|
|
95
|
|
-
|
|
|
76
|
+ // console.log(memberships)
|
|
96
|
77
|
const hasMatch = memberships.every(
|
|
97
|
|
- membership => membership.is_active == true,
|
|
|
78
|
+ membership => membership && membership.is_active == true,
|
|
98
|
79
|
)
|
|
99
|
|
- if (hasMatch) {
|
|
100
|
|
- notifyMembers(
|
|
101
|
|
- profileId,
|
|
102
|
|
- res.target_id,
|
|
103
|
|
- request.server.notify,
|
|
104
|
|
- h,
|
|
105
|
|
- )
|
|
106
|
|
- }
|
|
|
80
|
+ request.server.methods.notify(
|
|
|
81
|
+ `${profileId}.stonk`,
|
|
|
82
|
+ {
|
|
|
83
|
+ name: `${res.target_id} Match Fffound`,
|
|
|
84
|
+ type: 'info',
|
|
|
85
|
+ },
|
|
|
86
|
+ h,
|
|
|
87
|
+ )
|
|
|
88
|
+ request.server.methods.notify(
|
|
|
89
|
+ `${res.target_id}.stonk`,
|
|
|
90
|
+ {
|
|
|
91
|
+ name: `${profileId} Match Fffound`,
|
|
|
92
|
+ type: 'info',
|
|
|
93
|
+ },
|
|
|
94
|
+ h,
|
|
|
95
|
+ )
|
|
|
96
|
+ console.log('hasMatch :>> ', hasMatch)
|
|
|
97
|
+ console.log('memberships :>> ', memberships)
|
|
|
98
|
+
|
|
107
|
99
|
return h
|
|
108
|
100
|
.response({
|
|
109
|
101
|
ok: true,
|