aboutsummaryrefslogtreecommitdiff
path: root/services/feedback
diff options
context:
space:
mode:
Diffstat (limited to 'services/feedback')
-rw-r--r--services/feedback/feedback.hooks.ts20
1 files changed, 19 insertions, 1 deletions
diff --git a/services/feedback/feedback.hooks.ts b/services/feedback/feedback.hooks.ts
index 56e9000..7ae6c5d 100644
--- a/services/feedback/feedback.hooks.ts
+++ b/services/feedback/feedback.hooks.ts
@@ -1,9 +1,27 @@
+import { populate, discard } from 'feathers-hooks-common';
import requireAuth from '../../hooks/requireAuth';
import signAuthority from '../../hooks/signAuthority';
+import sortByDate from '../../hooks/sortByDate';
+
+
+const populateAuthor = populate({
+ schema: {
+ include: {
+ service: 'users',
+ nameAs: 'author',
+ parentField: 'authorId',
+ childField: '_id'
+ }
+ }
+});
export default {
before: {
- create: [requireAuth, signAuthority]
+ create: [requireAuth, signAuthority],
+ find: sortByDate
+ },
+ after: {
+ all: [populateAuthor, discard('authorId')]
}
};