aboutsummaryrefslogtreecommitdiff
path: root/services/votes/votes.hooks.ts
blob: 1cf7261cdd18bf8f3f158fe8e07f42f26d4df357 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { HookContext } from '@feathersjs/feathers';
import requireAuth from '../../hooks/requireAuth';

const addUserId = async (context: HookContext): Promise<HookContext> => {
  const { params: { user} } = context;
  context.data.userId = user._id;
  return context;
};

export default {
  before: {
    create: [requireAuth, addUserId]
  }
};