From 51c9616edea508559ff141c19980a5634f315352 Mon Sep 17 00:00:00 2001 From: Rubin Bhandari Date: Sun, 10 Sep 2023 17:28:26 +0545 Subject: [PATCH] fix: clister config --- src/cluster.ts | 10 +++++----- src/modules/auth/auth.controller.ts | 24 +++++++++++------------ src/modules/health/health.controller.ts | 16 +++++++-------- src/modules/profile/profile.controller.ts | 8 ++++---- src/modules/twofa/twofa.controller.ts | 8 ++++---- src/modules/user/user.controller.ts | 18 ++++++++--------- 6 files changed, 42 insertions(+), 42 deletions(-) diff --git a/src/cluster.ts b/src/cluster.ts index 09de6bb5..7d0bcf90 100644 --- a/src/cluster.ts +++ b/src/cluster.ts @@ -12,17 +12,17 @@ export class Cluster { const cpuCount = this.getCpuCount(); if (cluster.isPrimary) { - this.loggerService.log(`Starting cluster with ${cpuCount} workers...`); - this.loggerService.log(`Master server is running on process ${process.pid}`); + this.loggerService.log(`📑 Starting cluster with ${cpuCount} workers...`); + this.loggerService.log(`📑 Master server is running on process ${process.pid}`); for (let index = 0; index < cpuCount; index++) { - this.loggerService.log(`Forking process number ${index + 1}...`); + this.loggerService.log(`📑 Forking process number ${index + 1}...`); cluster.fork(); } cluster.on("exit", (worker) => { - this.loggerService.warn(`Worker ${worker.id} died. `); - this.loggerService.warn("Starting a new worker..."); + this.loggerService.warn(`🚦 Worker ${worker.id} died. `); + this.loggerService.warn("🚦 Starting a new worker..."); cluster.fork(); }); } diff --git a/src/modules/auth/auth.controller.ts b/src/modules/auth/auth.controller.ts index d9c21b68..7ce22968 100644 --- a/src/modules/auth/auth.controller.ts +++ b/src/modules/auth/auth.controller.ts @@ -50,9 +50,9 @@ export class AuthController { @Post("login/magic") @ApiOperation({ summary: "User Login with magic link" }) loginByMagicLink( -@Req() request: Request, -@Res() response: Response, -@Body() dto: MagicLinkLogin, + @Req() request: Request, + @Res() response: Response, + @Body() dto: MagicLinkLogin, ): Observable { return this.authService.validateUser(false, dto.destination).pipe( map((_user) => { @@ -103,9 +103,9 @@ export class AuthController { @Get("google/callback") @UseGuards(AuthGuard("google")) googleAuthRedirect( -@LoggedInUser() -user: OauthResponse, -@Res() response: Response, + @LoggedInUser() + user: OauthResponse, + @Res() response: Response, ) { return this.authService.login({ email: user.email }, false).pipe( map((data) => { @@ -126,9 +126,9 @@ user: OauthResponse, @Get("facebook/callback") @UseGuards(AuthGuard("facebook")) facebookAuthRedirect( -@LoggedInUser() -user: OauthResponse, -@Res() response: Response, + @LoggedInUser() + user: OauthResponse, + @Res() response: Response, ) { return this.authService.login({ email: user.email }, false).pipe( map((data) => { @@ -178,9 +178,9 @@ user: OauthResponse, @ApiOperation({ summary: "Logout user" }) @Post("logout") logout( -@LoggedInUser() user: User, -@Query("from_all", new DefaultValuePipe(false), ParseBoolPipe) fromAll: boolean, -@Body() refreshToken?: RefreshTokenDto, + @LoggedInUser() user: User, + @Query("from_all", new DefaultValuePipe(false), ParseBoolPipe) fromAll: boolean, + @Body() refreshToken?: RefreshTokenDto, ): Observable { return fromAll ? this.authService.logoutFromAll(user) diff --git a/src/modules/health/health.controller.ts b/src/modules/health/health.controller.ts index 14a06319..9da1904f 100644 --- a/src/modules/health/health.controller.ts +++ b/src/modules/health/health.controller.ts @@ -33,18 +33,18 @@ export class HealthController { () => this.http.pingCheck( "swagger", -`${this.configService.get("app.url", { -infer: true, -})}:${this.configService.get("app.port", { infer: true })}/doc`, + `${this.configService.get("app.url", { + infer: true, + })}:${this.configService.get("app.port", { infer: true })}/doc`, ), () => this.http.pingCheck( "routes", -`${this.configService.get("app.url", { -infer: true, -})}:${this.configService.get("app.port", { -infer: true, -})}/${this.configService.get("app.prefix", { infer: true })}/health/test`, + `${this.configService.get("app.url", { + infer: true, + })}:${this.configService.get("app.port", { + infer: true, + })}/${this.configService.get("app.prefix", { infer: true })}/health/test`, ), async () => this.databaseHealth.pingCheck("mikroOrm"), async () => this.memory.checkHeap("memory_heap", 200 * 1024 * 1024), diff --git a/src/modules/profile/profile.controller.ts b/src/modules/profile/profile.controller.ts index c236282e..e476c44a 100644 --- a/src/modules/profile/profile.controller.ts +++ b/src/modules/profile/profile.controller.ts @@ -31,8 +31,8 @@ export class ProfileController { params: ["username"], }) follow( -@LoggedInUser() user: User, -@Param("username") username: string, + @LoggedInUser() user: User, + @Param("username") username: string, ): Observable { return this.profileService.follow(user, username); } @@ -44,8 +44,8 @@ export class ProfileController { params: ["username"], }) unFollow( -@LoggedInUser() user: User, -@Param("username") username: string, + @LoggedInUser() user: User, + @Param("username") username: string, ): Observable { return this.profileService.unFollow(user, username); } diff --git a/src/modules/twofa/twofa.controller.ts b/src/modules/twofa/twofa.controller.ts index 8f3febb2..29c00a6f 100644 --- a/src/modules/twofa/twofa.controller.ts +++ b/src/modules/twofa/twofa.controller.ts @@ -32,8 +32,8 @@ export class TwoFactorController { @Post("authenticate") @UseGuards(AuthGuard("jwt2fa")) authenticate( -@LoggedInUser() user: User, -@Body() twoFaAuthDto: TwofaDto, + @LoggedInUser() user: User, + @Body() twoFaAuthDto: TwofaDto, ): Observable { const isCodeValid = this.twoFactorAuthenticationService.isTwoFactorCodeValid( twoFaAuthDto.code, @@ -49,8 +49,8 @@ export class TwoFactorController { @Auth() @Post("turn-on") turnOnTwoFactorAuthentication( -@LoggedInUser() user: User, -@Body() dto: TwofaDto, + @LoggedInUser() user: User, + @Body() dto: TwofaDto, ): Observable { return this.twoFactorAuthenticationService.turnOnTwoFactorAuthentication(dto.code, user); } diff --git a/src/modules/user/user.controller.ts b/src/modules/user/user.controller.ts index 87e0b9a4..67893f10 100644 --- a/src/modules/user/user.controller.ts +++ b/src/modules/user/user.controller.ts @@ -36,9 +36,9 @@ export class UserController { }) @ApiFile({ fieldName: "avatar", required: true }) // fix this publicRegistration( -@Body() dto: UserRegistrationDto, -@UploadedFile(fileValidatorPipe({})) -image: File, + @Body() dto: UserRegistrationDto, + @UploadedFile(fileValidatorPipe({})) + image: File, ): Observable { return this.userService.create({ ...dto, @@ -66,9 +66,9 @@ image: File, @CheckPolicies(new GenericPolicyHandler(User, Action.Create)) @ApiFile({ fieldName: "avatar", required: true }) create( -@Body() dto: CreateUserDto, -@UploadedFile(fileValidatorPipe({})) -image: File, + @Body() dto: CreateUserDto, + @UploadedFile(fileValidatorPipe({})) + image: File, ): Observable { return this.userService.create({ ...dto, files: image }); } @@ -82,9 +82,9 @@ image: File, }) @CheckPolicies(new GenericPolicyHandler(User, Action.Update)) update( -@UUIDParam("idx") index: string, -@Body() dto: EditUserDto, -@UploadedFile(fileValidatorPipe({ required: false })) image?: File, + @UUIDParam("idx") index: string, + @Body() dto: EditUserDto, + @UploadedFile(fileValidatorPipe({ required: false })) image?: File, ): Observable { return this.userService.update(index, dto, image); }