Skip to content

Commit f38a1cf

Browse files
committed
feat: upgrade feedback hooks
1 parent da76bb1 commit f38a1cf

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed
Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
1+
import { populate, discard } from 'feathers-hooks-common';
12
import requireAuth from '../../hooks/requireAuth';
23
import signAuthority from '../../hooks/signAuthority';
4+
import sortByDate from '../../hooks/sortByDate';
5+
6+
7+
const populateAuthor = populate({
8+
schema: {
9+
include: {
10+
service: 'users',
11+
nameAs: 'author',
12+
parentField: 'authorId',
13+
childField: '_id'
14+
}
15+
}
16+
});
317

418
export default {
519
before: {
6-
create: [requireAuth, signAuthority]
20+
create: [requireAuth, signAuthority],
21+
find: sortByDate
22+
},
23+
after: {
24+
all: [populateAuthor, discard('authorId')]
725
}
826
};
927

0 commit comments

Comments
 (0)