diff --git a/src/lib/util/extract-user.ts b/src/lib/util/extract-user.ts index 84ba126ce5..d58e8d8946 100644 --- a/src/lib/util/extract-user.ts +++ b/src/lib/util/extract-user.ts @@ -7,3 +7,10 @@ export function extractUsernameFromUser(user: IUser): string { export function extractUsername(req: IAuthRequest): string { return extractUsernameFromUser(req.user); } + +export const extractUserId = (req: IAuthRequest) => req.user.id; + +export const extractUserInfo = (req: IAuthRequest) => ({ + id: extractUserId(req), + username: extractUsername(req), +});