From 643a6b76b3a54eb07c227ae91dd24ef4a39bc0c2 Mon Sep 17 00:00:00 2001 From: Bivekich Date: Wed, 6 Aug 2025 02:31:22 +0300 Subject: [PATCH] Fix TypeScript compilation errors and update .gitignore --- .gitignore | 3 +++ backend/src/app.module.ts | 2 +- backend/src/config/typeorm.config.ts | 14 +++++++------- backend/src/modules/messages/messages.resolver.ts | 2 +- backend/src/modules/users/users.service.ts | 2 +- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 319d423..49e124c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,9 @@ node_modules/ dist/ build/ +# Generated files +backend/src/schema.gql + # Environment files .env .env.local diff --git a/backend/src/app.module.ts b/backend/src/app.module.ts index 29be5ed..8b4d1c6 100644 --- a/backend/src/app.module.ts +++ b/backend/src/app.module.ts @@ -26,7 +26,7 @@ import { MessagesModule } from './modules/messages/messages.module'; TypeOrmModule.forRoot({ type: 'postgres', host: process.env.DATABASE_HOST || 'localhost', - port: parseInt(process.env.DATABASE_PORT, 10) || 5432, + port: parseInt(process.env.DATABASE_PORT || '5432', 10), username: process.env.DATABASE_USERNAME || 'postgres', password: process.env.DATABASE_PASSWORD || 'postgres', database: process.env.DATABASE_NAME || 'prism_messenger', diff --git a/backend/src/config/typeorm.config.ts b/backend/src/config/typeorm.config.ts index 882a885..4fa03a7 100644 --- a/backend/src/config/typeorm.config.ts +++ b/backend/src/config/typeorm.config.ts @@ -3,13 +3,13 @@ import { ConfigService } from '@nestjs/config'; export const getTypeOrmConfig = (configService: ConfigService): TypeOrmModuleOptions => ({ type: 'postgres', - host: configService.get('DATABASE_HOST') || 'localhost', - port: configService.get('DATABASE_PORT') || 5432, - username: configService.get('DATABASE_USERNAME') || 'postgres', - password: configService.get('DATABASE_PASSWORD') || 'postgres', - database: configService.get('DATABASE_NAME') || 'prism_messenger', + host: configService.get('DATABASE_HOST') || 'localhost', + port: configService.get('DATABASE_PORT') || 5432, + username: configService.get('DATABASE_USERNAME') || 'postgres', + password: configService.get('DATABASE_PASSWORD') || 'postgres', + database: configService.get('DATABASE_NAME') || 'prism_messenger', entities: [__dirname + '/../**/*.entity{.ts,.js}'], migrations: [__dirname + '/../migrations/*{.ts,.js}'], - synchronize: configService.get('NODE_ENV') !== 'production', - logging: configService.get('NODE_ENV') !== 'production', + synchronize: configService.get('NODE_ENV') !== 'production', + logging: configService.get('NODE_ENV') !== 'production', }); \ No newline at end of file diff --git a/backend/src/modules/messages/messages.resolver.ts b/backend/src/modules/messages/messages.resolver.ts index 8c2b72a..b728e7e 100644 --- a/backend/src/modules/messages/messages.resolver.ts +++ b/backend/src/modules/messages/messages.resolver.ts @@ -7,7 +7,7 @@ import { GqlAuthGuard } from '../auth/guards/gql-auth.guard'; import { CurrentUser } from '../auth/decorators/current-user.decorator'; import { User } from '../users/entities/user.entity'; -const pubSub = new PubSub(); +const pubSub = new PubSub() as any; @Resolver(() => Message) @UseGuards(GqlAuthGuard) diff --git a/backend/src/modules/users/users.service.ts b/backend/src/modules/users/users.service.ts index aec0b90..1a5c8ba 100644 --- a/backend/src/modules/users/users.service.ts +++ b/backend/src/modules/users/users.service.ts @@ -58,7 +58,7 @@ export class UsersService { async updateOnlineStatus(id: string, isOnline: boolean): Promise { await this.usersRepository.update(id, { isOnline, - lastSeen: isOnline ? null : new Date(), + lastSeen: isOnline ? undefined : new Date(), }); } } \ No newline at end of file