diff options
author | eug-vs <eug-vs@keemail.me> | 2020-06-27 00:53:48 +0300 |
---|---|---|
committer | eug-vs <eug-vs@keemail.me> | 2020-06-27 00:53:48 +0300 |
commit | 0a78ac48ed5ae37f88e5f36194953424a5bc18a0 (patch) | |
tree | 64578f493cf220112f53711d0b99f678c79fa6a4 /services | |
parent | 9a488369a481d92fed348df3de71bf612c4183d5 (diff) | |
download | which-api-0a78ac48ed5ae37f88e5f36194953424a5bc18a0.tar.gz |
refactor: move sortByDate hook to global hooks
Diffstat (limited to 'services')
-rw-r--r-- | services/polls/polls.hooks.ts | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/services/polls/polls.hooks.ts b/services/polls/polls.hooks.ts index 524eaee..77fcc7a 100644 --- a/services/polls/polls.hooks.ts +++ b/services/polls/polls.hooks.ts @@ -1,18 +1,12 @@ -import _ from 'lodash'; -import { HookContext } from '@feathersjs/feathers'; import convertPoll from '../../hooks/convertPoll'; - -const sort = async (context: HookContext): Promise<HookContext> => { - _.set(context, 'params.query.$sort', { createdAt: - 1}); - return context; -} +import sortByDate from '../../hooks/sortByDate'; export default { before: { - find: sort + find: sortByDate }, after: { - all: [convertPoll] + all: convertPoll } }; |