Skip to content
This repository was archived by the owner on Jun 27, 2019. It is now read-only.

Commit 69bbcd0

Browse files
Merge branch 'own-data-managing' of github.com:Human-Connection/API into own-data-managing
2 parents 4ed7a4f + 342e24f commit 69bbcd0

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

server/hooks/cleanup-related-items.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ const deleteItem = async (item, connection, hook) => {
2727
} catch (err) {
2828
hook.app.error(`issue while deleting related item '${connection.service}'`);
2929
hook.app.error(query);
30+
hook.app.error(err);
3031
}
31-
3232
};

server/services/shouts/hooks/set-shout-count.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,17 @@ module.exports = () => async (hook) => {
1616
}
1717
});
1818
// update the shout count on the foreign service
19-
await hook.app.service(result.foreignService)
20-
.patch(result.foreignId, {
21-
$set: {
22-
shoutCount: shoutCount.total
23-
}
24-
});
19+
try {
20+
await hook.app.service(result.foreignService)
21+
.patch(result.foreignId, {
22+
$set: {
23+
shoutCount: shoutCount.total
24+
}
25+
});
26+
} catch (err) {
27+
hook.app.error(`issue setting shout count on '${result.foreignService}' with id '${result.foreignId}'`);
28+
hook.app.error(err);
29+
}
2530
});
2631
return hook;
2732
};

server/services/shouts/shouts.hooks.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ module.exports = {
5353
patch: [
5454
setShoutCount()
5555
],
56-
remove: []
56+
remove: [
57+
setShoutCount()
58+
]
5759
},
5860

5961
error: {

0 commit comments

Comments
 (0)