aboutsummaryrefslogtreecommitdiff
path: root/services/votes/votes.hooks.ts
blob: 7d0b3bace3d56ffc5fdd0f1c6ade560e969a5dbe (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]
  }
};