Skip to content

Commit 2f5bb80

Browse files
committed
biome autofix
1 parent 42ae2a1 commit 2f5bb80

File tree

319 files changed

+8763
-9577
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

319 files changed

+8763
-9577
lines changed

autoadmin-ws-server/src/constants/constants.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const CONSTANTS = Object.freeze({
1919

2020
RES_CACHE_OPTIONS: {
2121
max: 5000,
22-
dispose: function(key, n) {
22+
dispose: (_key, n) => {
2323
n?.send('Connection was closed by timeout');
2424
},
2525
maxAge: 600000,

autoadmin-ws-server/src/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import axios from 'axios';
33
const app = express();
44
import { createServer } from 'http';
55
const httpServer = createServer(app);
6-
const wsServer = createServer((req, res) => {
6+
const wsServer = createServer((_req, res) => {
77
res.writeHead(200);
88
res.end();
99
});
1010
import WebSocket, { WebSocketServer } from 'ws';
11-
const router = Router();
11+
const _router = Router();
1212
import commandRoute from './routes/command.js';
1313
import {
1414
getCacheWsConnection,
@@ -29,7 +29,7 @@ const tokenCacheResult = new LRUCache(CONSTANTS.TOKEN_RESULT_CACHE_OPTIONS);
2929

3030
app.use(json());
3131

32-
app.get('/', (req, res) => {
32+
app.get('/', (_req, res) => {
3333
res.json({ status: CONSTANTS.API_IS_RUNNING });
3434
});
3535

@@ -42,7 +42,7 @@ wsServer.listen(wsPort, () => {
4242
const ws = new WebSocketServer({ server: wsServer });
4343

4444
ws.on('connection', (connection, req) => {
45-
const ip = req.socket.remoteAddress;
45+
const _ip = req.socket.remoteAddress;
4646
// console.log(`Connected ${ip}`);
4747

4848
connection.on('message', async (message) => {

backend/src/app.module.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common';
22
import { APP_GUARD, APP_INTERCEPTOR } from '@nestjs/core';
33
import { ScheduleModule } from '@nestjs/schedule';
4-
import { DataSource } from 'typeorm';
54
import { AppController } from './app.controller.js';
65
import { GlobalDatabaseContext } from './common/application/global-database-context.js';
76
import { BaseType, UseCaseType } from './common/data-injection.tokens.js';
@@ -107,7 +106,6 @@ import { SignInAuditModule } from './entities/user-sign-in-audit/sign-in-audit.m
107106
],
108107
})
109108
export class ApplicationModule implements NestModule {
110-
constructor(private dataSource: DataSource) {}
111109
configure(consumer: MiddlewareConsumer): void {
112110
consumer.apply(AppLoggerMiddleware).forRoutes('*');
113111
}

backend/src/authorization/auth-with-api.middleware.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class AuthWithApiMiddleware implements NestMiddleware {
2727
private readonly userRepository: Repository<UserEntity>,
2828
) {}
2929

30-
async use(req: Request, res: Response, next: (err?: any, res?: any) => void): Promise<void> {
30+
async use(req: Request, _res: Response, next: (err?: any, res?: any) => void): Promise<void> {
3131
try {
3232
await this.authenticateRequest(req);
3333
next();
@@ -61,11 +61,11 @@ export class AuthWithApiMiddleware implements NestMiddleware {
6161
try {
6262
const jwtSecret = process.env.JWT_SECRET;
6363
const data = jwt.verify(tokenFromCookie, jwtSecret);
64-
const userId = data['id'];
64+
const userId = data.id;
6565
if (!userId) {
6666
throw new UnauthorizedException('JWT verification failed');
6767
}
68-
const addedScope: Array<JwtScopesEnum> = data['scope'];
68+
const addedScope: Array<JwtScopesEnum> = data.scope;
6969
if (addedScope && addedScope.length > 0) {
7070
if (addedScope.includes(JwtScopesEnum.TWO_FA_ENABLE)) {
7171
throw new BadRequestException(Messages.TWO_FA_REQUIRED);
@@ -74,14 +74,14 @@ export class AuthWithApiMiddleware implements NestMiddleware {
7474

7575
const payload = {
7676
sub: userId,
77-
email: data['email'],
78-
exp: data['exp'],
79-
iat: data['iat'],
77+
email: data.email,
78+
exp: data.exp,
79+
iat: data.iat,
8080
};
8181
if (!payload || isObjectEmpty(payload)) {
8282
throw new UnauthorizedException('JWT verification failed');
8383
}
84-
req['decoded'] = payload;
84+
req.decoded = payload;
8585
} catch (error) {
8686
Sentry.captureException(error);
8787
throw error;
@@ -106,7 +106,7 @@ export class AuthWithApiMiddleware implements NestMiddleware {
106106
if (!foundUserByApiKey) {
107107
throw new NotFoundException(Messages.NO_AUTH_KEYS_FOUND);
108108
}
109-
req['decoded'] = {
109+
req.decoded = {
110110
sub: foundUserByApiKey.id,
111111
email: foundUserByApiKey.email,
112112
};

backend/src/authorization/auth.middleware.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@ import { JwtScopesEnum } from '../entities/user/enums/jwt-scopes.enum.js';
2121
@Injectable()
2222
export class AuthMiddleware implements NestMiddleware {
2323
public constructor(
24-
@InjectRepository(UserEntity)
25-
private readonly userRepository: Repository<UserEntity>,
24+
@InjectRepository(UserEntity)readonly _userRepository: Repository<UserEntity>,
2625
@InjectRepository(LogOutEntity)
2726
private readonly logOutRepository: Repository<LogOutEntity>,
2827
) {}
29-
async use(req: Request, res: Response, next: (err?: any, res?: any) => void): Promise<void> {
28+
async use(req: Request, _res: Response, next: (err?: any, res?: any) => void): Promise<void> {
3029
let token: string;
3130
try {
3231
token = req.cookies[Constants.JWT_COOKIE_KEY_NAME];
@@ -48,11 +47,11 @@ export class AuthMiddleware implements NestMiddleware {
4847
try {
4948
const jwtSecret = process.env.JWT_SECRET;
5049
const data = jwt.verify(token, jwtSecret);
51-
const userId = data['id'];
50+
const userId = data.id;
5251
if (!userId) {
5352
throw new UnauthorizedException('JWT verification failed');
5453
}
55-
const addedScope: Array<JwtScopesEnum> = data['scope'];
54+
const addedScope: Array<JwtScopesEnum> = data.scope;
5655
if (addedScope && addedScope.length > 0) {
5756
if (addedScope.includes(JwtScopesEnum.TWO_FA_ENABLE)) {
5857
throw new BadRequestException(Messages.TWO_FA_REQUIRED);
@@ -61,14 +60,14 @@ export class AuthMiddleware implements NestMiddleware {
6160

6261
const payload = {
6362
sub: userId,
64-
email: data['email'],
65-
exp: data['exp'],
66-
iat: data['iat'],
63+
email: data.email,
64+
exp: data.exp,
65+
iat: data.iat,
6766
};
6867
if (!payload || isObjectEmpty(payload)) {
6968
throw new UnauthorizedException('JWT verification failed');
7069
}
71-
req['decoded'] = payload;
70+
req.decoded = payload;
7271
next();
7372
} catch (e) {
7473
Sentry.captureException(e);

backend/src/authorization/basic-auth.middleware.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Messages } from '../exceptions/text/messages.js';
55

66
@Injectable()
77
export class BasicAuthMiddleware implements NestMiddleware {
8-
use(req: Request, res: Response, next: (err?: any, res?: any) => void): void {
8+
use(req: Request, _res: Response, next: (err?: any, res?: any) => void): void {
99
const basicAuthLogin = process.env.BASIC_AUTH_LOGIN;
1010
const basicAuthPassword = process.env.BASIC_AUTH_PWD;
1111
const userCredentials = auth(req);

backend/src/authorization/non-scoped-auth.middleware.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class NonScopedAuthMiddleware implements NestMiddleware {
2121
@InjectRepository(LogOutEntity)
2222
private readonly logOutRepository: Repository<LogOutEntity>,
2323
) {}
24-
async use(req: Request, res: Response, next: (err?: any, res?: any) => void): Promise<void> {
24+
async use(req: Request, _res: Response, next: (err?: any, res?: any) => void): Promise<void> {
2525
console.log(`auth middleware triggered ->: ${new Date().toISOString()}`);
2626
let token: string;
2727
try {
@@ -44,21 +44,21 @@ export class NonScopedAuthMiddleware implements NestMiddleware {
4444
try {
4545
const jwtSecret = process.env.JWT_SECRET;
4646
const data = jwt.verify(token, jwtSecret);
47-
const userId = data['id'];
47+
const userId = data.id;
4848
if (!userId) {
4949
throw new UnauthorizedException('JWT verification failed');
5050
}
5151

5252
const payload = {
5353
sub: userId,
54-
email: data['email'],
55-
exp: data['exp'],
56-
iat: data['iat'],
54+
email: data.email,
55+
exp: data.exp,
56+
iat: data.iat,
5757
};
5858
if (!payload || isObjectEmpty(payload)) {
5959
throw new UnauthorizedException('JWT verification failed');
6060
}
61-
req['decoded'] = payload;
61+
req.decoded = payload;
6262
next();
6363
} catch (e) {
6464
Sentry.captureException(e);

backend/src/authorization/saas-auth.middleware.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { extractTokenFromHeader } from './utils/extract-token-from-header.js';
66

77
@Injectable()
88
export class SaaSAuthMiddleware implements NestMiddleware {
9-
use(req: Request, res: Response, next: (err?: any, res?: any) => void): void {
9+
use(req: Request, _res: Response, next: (err?: any, res?: any) => void): void {
1010
console.log(`saas auth middleware triggered ->: ${new Date().toISOString()}`);
1111
const token = extractTokenFromHeader(req);
1212
if (!token) {
@@ -15,13 +15,13 @@ export class SaaSAuthMiddleware implements NestMiddleware {
1515
try {
1616
const jwtSecret = process.env.MICROSERVICE_JWT_SECRET;
1717
const data = jwt.verify(token, jwtSecret);
18-
const requestId = data['request_id'];
18+
const requestId = data.request_id;
1919

2020
if (!requestId) {
2121
throw new UnauthorizedException(Messages.AUTHORIZATION_REJECTED);
2222
}
2323

24-
req['decoded'] = data;
24+
req.decoded = data;
2525
next();
2626
} catch (_e) {
2727
throw new UnauthorizedException(Messages.AUTHORIZATION_REJECTED);

backend/src/authorization/temporary-auth.middleware.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,11 @@ import { Constants } from '../helpers/constants/constants.js';
1919
@Injectable()
2020
export class TemporaryAuthMiddleware implements NestMiddleware {
2121
public constructor(
22-
@InjectRepository(UserEntity)
23-
private readonly userRepository: Repository<UserEntity>,
22+
@InjectRepository(UserEntity)readonly _userRepository: Repository<UserEntity>,
2423
@InjectRepository(LogOutEntity)
2524
private readonly logOutRepository: Repository<LogOutEntity>,
2625
) {}
27-
async use(req: Request, res: Response, next: (err?: any, res?: any) => void): Promise<void> {
26+
async use(req: Request, _res: Response, next: (err?: any, res?: any) => void): Promise<void> {
2827
console.log(`temporary auth middleware triggered ->: ${new Date().toISOString()}`);
2928
let token: string;
3029
try {
@@ -47,20 +46,20 @@ export class TemporaryAuthMiddleware implements NestMiddleware {
4746
try {
4847
const jwtSecret = process.env.TEMPORARY_JWT_SECRET;
4948
const data = jwt.verify(token, jwtSecret);
50-
const userId = data['id'];
49+
const userId = data.id;
5150
if (!userId) {
5251
throw new UnauthorizedException('JWT verification failed');
5352
}
5453
const payload = {
5554
sub: userId,
56-
email: data['email'],
57-
exp: data['exp'],
58-
iat: data['iat'],
55+
email: data.email,
56+
exp: data.exp,
57+
iat: data.iat,
5958
};
6059
if (!payload || isObjectEmpty(payload)) {
6160
throw new UnauthorizedException('JWT verification failed');
6261
}
63-
req['decoded'] = payload;
62+
req.decoded = payload;
6463
next();
6564
} catch (e) {
6665
Sentry.captureException(e);

backend/src/common/application/global-database-context.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -391,11 +391,7 @@ export class GlobalDatabaseContext implements IGlobalDatabaseContext {
391391

392392
public async commitTransaction(): Promise<void> {
393393
if (!this._queryRunner) return;
394-
try {
395394
await this._queryRunner.commitTransaction();
396-
} catch (e) {
397-
throw e;
398-
}
399395
}
400396

401397
public async rollbackTransaction(): Promise<void> {

0 commit comments

Comments
 (0)