-
Notifications
You must be signed in to change notification settings - Fork 1
/
users.ts
24 lines (22 loc) · 1.01 KB
/
users.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { default as express } from 'express';
import type * as schema from '../db/schema';
import {
getUserAttributesHandler,
getUsersToGroupsHandler,
getUserHandler,
getUserOptionsHandler,
getUserRegistrationsHandler,
updateUserHandler,
} from '../handlers/users';
import { isLoggedIn } from '../middleware/is-logged-in';
import { NodePgDatabase } from 'drizzle-orm/node-postgres';
const router = express.Router();
export function usersRouter({ dbPool }: { dbPool: NodePgDatabase<typeof schema> }) {
router.get('/', isLoggedIn(dbPool), getUserHandler(dbPool));
router.put('/:userId', isLoggedIn(dbPool), updateUserHandler(dbPool));
router.get('/:userId/users-to-groups', isLoggedIn(dbPool), getUsersToGroupsHandler(dbPool));
router.get('/:userId/attributes', isLoggedIn(dbPool), getUserAttributesHandler(dbPool));
router.get('/:userId/options', isLoggedIn(dbPool), getUserOptionsHandler(dbPool));
router.get('/:userId/registrations', isLoggedIn(dbPool), getUserRegistrationsHandler(dbPool));
return router;
}