aboutsummaryrefslogtreecommitdiff
path: root/hooks/sortByDate.ts
diff options
context:
space:
mode:
Diffstat (limited to 'hooks/sortByDate.ts')
-rw-r--r--hooks/sortByDate.ts8
1 files changed, 8 insertions, 0 deletions
diff --git a/hooks/sortByDate.ts b/hooks/sortByDate.ts
new file mode 100644
index 0000000..4a20920
--- /dev/null
+++ b/hooks/sortByDate.ts
@@ -0,0 +1,8 @@
+import _ from 'lodash';
+import { HookContext } from '@feathersjs/feathers';
+
+export default async (context: HookContext): Promise<HookContext> => {
+ _.set(context, 'params.query.$sort', { createdAt: - 1});
+ return context;
+}
+