We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7f9df85 commit 2437607Copy full SHA for 2437607
services/polls/polls.hooks.ts
@@ -1,6 +1,16 @@
1
+import _ from 'lodash';
2
+import { HookContext } from '@feathersjs/feathers';
3
import convertPoll from '../../hooks/convertPoll';
4
5
+const sort = async (context: HookContext): Promise<HookContext> => {
6
+ _.set(context, 'params.query.$sort', { createdAt: - 1});
7
+ return context;
8
+}
9
+
10
export default {
11
+ before: {
12
+ find: sort
13
+ },
14
after: {
15
all: [convertPoll]
16
}
0 commit comments