diff options
author | eug-vs <eug-vs@keemail.me> | 2020-06-27 16:26:21 +0300 |
---|---|---|
committer | eug-vs <eug-vs@keemail.me> | 2020-06-27 16:26:21 +0300 |
commit | 8f5f077c318e9b466cc47ebab548ea0cd69052f0 (patch) | |
tree | 302a175ec7e09939c04f73b3ce38953a439b2c28 /services/feed/feed.hooks.ts | |
parent | 69b212128435cab2919f642fd8352b0b6cf93f83 (diff) | |
download | which-api-8f5f077c318e9b466cc47ebab548ea0cd69052f0.tar.gz |
feat: only modify polls order for authorized users
Diffstat (limited to 'services/feed/feed.hooks.ts')
-rw-r--r-- | services/feed/feed.hooks.ts | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/services/feed/feed.hooks.ts b/services/feed/feed.hooks.ts index 0e201db..33c6e71 100644 --- a/services/feed/feed.hooks.ts +++ b/services/feed/feed.hooks.ts @@ -1,6 +1,7 @@ import _ from 'lodash'; import { HookContext } from '@feathersjs/feathers'; - +import { iff, combine } from 'feathers-hooks-common'; +import isAuthenticated from '../../hooks/isAuthenticated'; const raiseNewVerifedPolls = async (context: HookContext): Promise<HookContext> => { // Raise unseen verified polls to the very top @@ -22,7 +23,10 @@ const lowerOldPolls = async (context: HookContext): Promise<HookContext> => { export default { after: { - find: [raiseNewVerifedPolls, lowerOldPolls] + find: [ + iff(isAuthenticated, raiseNewVerifedPolls), + iff(isAuthenticated, lowerOldPolls), + ] } }; |