fix: add @types/jest, fix WsAuthGuard TS error
This commit is contained in:
parent
b93fe016ed
commit
fd916fa4ef
9392
backend/package-lock.json
generated
Normal file
9392
backend/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -37,6 +37,7 @@
|
|||||||
"@nestjs/cli": "^10.0.0",
|
"@nestjs/cli": "^10.0.0",
|
||||||
"@nestjs/testing": "^10.0.0",
|
"@nestjs/testing": "^10.0.0",
|
||||||
"@types/bcrypt": "^5.0.0",
|
"@types/bcrypt": "^5.0.0",
|
||||||
|
"@types/jest": "^30.0.0",
|
||||||
"@types/node": "^20.0.0",
|
"@types/node": "^20.0.0",
|
||||||
"@types/passport-jwt": "^4.0.0",
|
"@types/passport-jwt": "^4.0.0",
|
||||||
"@types/ssh2": "^1.15.0",
|
"@types/ssh2": "^1.15.0",
|
||||||
@ -51,10 +52,16 @@
|
|||||||
"seed": "ts-node prisma/seed.ts"
|
"seed": "ts-node prisma/seed.ts"
|
||||||
},
|
},
|
||||||
"jest": {
|
"jest": {
|
||||||
"moduleFileExtensions": ["js", "json", "ts"],
|
"moduleFileExtensions": [
|
||||||
|
"js",
|
||||||
|
"json",
|
||||||
|
"ts"
|
||||||
|
],
|
||||||
"rootDir": ".",
|
"rootDir": ".",
|
||||||
"testRegex": ".*\\.spec\\.ts$",
|
"testRegex": ".*\\.spec\\.ts$",
|
||||||
"transform": { "^.+\\.ts$": "ts-jest" },
|
"transform": {
|
||||||
|
"^.+\\.ts$": "ts-jest"
|
||||||
|
},
|
||||||
"testEnvironment": "node",
|
"testEnvironment": "node",
|
||||||
"moduleNameMapper": {
|
"moduleNameMapper": {
|
||||||
"^@/(.*)$": "<rootDir>/src/$1"
|
"^@/(.*)$": "<rootDir>/src/$1"
|
||||||
|
|||||||
@ -11,7 +11,7 @@ export class WsAuthGuard {
|
|||||||
const url = new URL(client.url || client._url, 'http://localhost');
|
const url = new URL(client.url || client._url, 'http://localhost');
|
||||||
const token = url.searchParams.get('token');
|
const token = url.searchParams.get('token');
|
||||||
if (!token) throw new WsException('No token');
|
if (!token) throw new WsException('No token');
|
||||||
return this.jwt.verify(token);
|
return this.jwt.verify(token) as { sub: number; email: string };
|
||||||
} catch {
|
} catch {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
12741
frontend/package-lock.json
generated
Normal file
12741
frontend/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user