11import * as jwt from "jsonwebtoken" ;
22
3- import metrics from "../metrics" ;
3+ // import metrics from "../metrics";
44import { prisma } from "../prisma" ;
55
66/**
@@ -11,7 +11,7 @@ import { prisma } from "../prisma";
1111 * @returns void
1212 */
1313export async function authenticateToken ( req : any , res : any , next : any ) {
14- metrics . increment ( "functions.jwt.authenticateToken" ) ;
14+ // metrics.increment("functions.jwt.authenticateToken");
1515
1616 const authHeader = req . headers [ "authorization" ] ;
1717 const token = authHeader && authHeader . split ( " " ) [ 1 ] ;
@@ -28,7 +28,7 @@ export async function authenticateToken(req: any, res: any, next: any) {
2828 } else {
2929 return user ;
3030 }
31- } ,
31+ }
3232 ) ;
3333
3434 let user = await prisma . user . findUnique ( {
@@ -46,7 +46,7 @@ export async function authenticateToken(req: any, res: any, next: any) {
4646 return res
4747 . status ( 403 )
4848 . json (
49- "Your user has been deleted. Please contact support if you believe this is an error or need to reactivate your account." ,
49+ "Your user has been deleted. Please contact support if you believe this is an error or need to reactivate your account."
5050 ) ;
5151 }
5252
@@ -61,17 +61,17 @@ export async function authenticateToken(req: any, res: any, next: any) {
6161 */
6262export async function generateAccessToken ( user : any ) {
6363 const tsStart = Date . now ( ) ;
64- metrics . increment ( "functions.jwt.generateAccessToken" ) ;
64+ // metrics.increment("functions.jwt.generateAccessToken");
6565
6666 let token = jwt . sign (
6767 {
6868 id : user . id ,
6969 uuid : user . uuid ,
7070 } ,
71- process . env . JWT_SECRET ! ,
71+ process . env . JWT_SECRET !
7272 ) ;
7373 const tsEnd = Date . now ( ) ;
74- metrics . timing ( "functions.jwt.generateAccessToken" , tsEnd - tsStart ) ;
74+ // metrics.timing("functions.jwt.generateAccessToken", tsEnd - tsStart);
7575 return token ;
7676}
7777
@@ -84,7 +84,7 @@ export async function generateAccessToken(user: any) {
8484 */
8585export async function getUserInfo ( prisma : any , res : any , req : any ) {
8686 const tsStart = Date . now ( ) ;
87- metrics . increment ( "functions.jwt.getUserInfo" ) ;
87+ // metrics.increment("functions.jwt.getUserInfo");
8888
8989 const authHeader = req . headers [ "authorization" ] ;
9090 const token = authHeader && authHeader . split ( " " ) [ 1 ] ;
@@ -104,18 +104,18 @@ export async function getUserInfo(prisma: any, res: any, req: any) {
104104 } ) ;
105105
106106 const tsEnd = Date . now ( ) ;
107- metrics . timing ( "functions.jwt.getUserInfo" , tsEnd - tsStart ) ;
107+ // metrics.timing("functions.jwt.getUserInfo", tsEnd - tsStart);
108108
109109 return user ;
110110}
111111
112112export async function getPermissionLevel ( prisma : any , res : any , req : any ) {
113113 const tsStart = Date . now ( ) ;
114- metrics . increment ( "functions.jwt.getPermissionLevel" ) ;
114+ // metrics.increment("functions.jwt.getPermissionLevel");
115115
116116 const info = await getUserInfo ( prisma , res , req ) ;
117117 // console.log(info);
118118
119119 const tsEnd = Date . now ( ) ;
120- metrics . timing ( "functions.jwt.getPermissionLevel" , tsEnd - tsStart ) ;
120+ // metrics.timing("functions.jwt.getPermissionLevel", tsEnd - tsStart);
121121}
0 commit comments