From 5c4f19f32d07ee13da785a51fc3b994b9336ae83 Mon Sep 17 00:00:00 2001 From: jiyun Date: Wed, 28 Feb 2024 15:33:52 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20module=20=EB=90=98=EB=8A=94=EB=8D=B0?= =?UTF-8?q?=EA=B9=8C=EC=A7=80=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 11 --------- package.json | 1 - src/app.module.ts | 2 +- src/auth/auth.controller.ts | 2 -- src/auth/auth.module.ts | 37 +++--------------------------- src/channels/channels.module.ts | 40 ++++++--------------------------- src/game/game.module.ts | 31 +++++-------------------- src/users/users.module.ts | 16 +++++++------ 8 files changed, 26 insertions(+), 114 deletions(-) diff --git a/package-lock.json b/package-lock.json index b19bf81..b7b0431 100644 --- a/package-lock.json +++ b/package-lock.json @@ -52,7 +52,6 @@ "@types/bcryptjs": "^2.4.6", "@types/jest": "28.1.4", "@types/multer": "^1.4.9", - "@types/socket.io": "^3.0.2", "@types/speakeasy": "^2.0.10", "@types/supertest": "^2.0.11", "@typescript-eslint/eslint-plugin": "^5.0.0", @@ -2618,16 +2617,6 @@ "@types/node": "*" } }, - "node_modules/@types/socket.io": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@types/socket.io/-/socket.io-3.0.2.tgz", - "integrity": "sha512-pu0sN9m5VjCxBZVK8hW37ZcMe8rjn4HHggBN5CbaRTvFwv5jOmuIRZEuddsBPa9Th0ts0SIo3Niukq+95cMBbQ==", - "deprecated": "This is a stub types definition. socket.io provides its own type definitions, so you do not need this installed.", - "dev": true, - "dependencies": { - "socket.io": "*" - } - }, "node_modules/@types/speakeasy": { "version": "2.0.10", "resolved": "https://registry.npmjs.org/@types/speakeasy/-/speakeasy-2.0.10.tgz", diff --git a/package.json b/package.json index 88b38de..f8295b4 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,6 @@ "@types/bcryptjs": "^2.4.6", "@types/jest": "28.1.4", "@types/multer": "^1.4.9", - "@types/socket.io": "^3.0.2", "@types/speakeasy": "^2.0.10", "@types/supertest": "^2.0.11", "@typescript-eslint/eslint-plugin": "^5.0.0", diff --git a/src/app.module.ts b/src/app.module.ts index d95d7fe..f95fd58 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -49,8 +49,8 @@ import userConfig from './config/user.config'; ScheduleModule.forRoot(), AuthModule, UsersModule, - GameModule, ChannelsModule, + GameModule, RedisModule, SwaggerModule, ], diff --git a/src/auth/auth.controller.ts b/src/auth/auth.controller.ts index 8fe9263..1545337 100644 --- a/src/auth/auth.controller.ts +++ b/src/auth/auth.controller.ts @@ -11,7 +11,6 @@ import { AuthGuard } from '@nestjs/passport'; import { ApiOperation, ApiParam, ApiResponse, ApiTags } from '@nestjs/swagger'; import { Response } from 'express'; import { User } from 'src/users/entities/user.entity'; -import { AppService } from '../app.service'; import { SignupRequestDto } from '../users/dto/signup-request.dto'; import { UsersService } from '../users/users.service'; import { AuthService } from './auth.service'; @@ -27,7 +26,6 @@ export class AuthController { private readonly authService: AuthService, private readonly ftAuthService: FtAuthService, private readonly usersService: UsersService, - private readonly AppService: AppService, ) {} @Post('/signin') diff --git a/src/auth/auth.module.ts b/src/auth/auth.module.ts index 4f031d0..422fc3b 100644 --- a/src/auth/auth.module.ts +++ b/src/auth/auth.module.ts @@ -2,62 +2,31 @@ import { Module } from '@nestjs/common'; import { ConfigType } from '@nestjs/config'; import { JwtModule } from '@nestjs/jwt'; import { PassportModule } from '@nestjs/passport'; -import { TypeOrmModule } from '@nestjs/typeorm'; -import { AppService } from 'src/app.service'; -import { Game } from 'src/game/entities/game.entity'; -import { GameRepository } from 'src/game/game.repository'; -import { BlocksRepository } from 'src/users/blocks.repository'; -import { Block } from 'src/users/entities/block.entity'; -import { Friend } from 'src/users/entities/friend.entity'; -import { FriendsRepository } from 'src/users/friends.repository'; -import { ChannelUsersRepository } from '../channels/channel-users.repository'; -import { ChannelsGateway } from '../channels/channels.gateway'; -import { ChannelUser } from '../channels/entities/channel-user.entity'; import jwtConfig from '../config/jwt.config'; -import { GameInvitation } from '../game/entities/game-invitation.entity'; -import { GameInvitationRepository } from '../game/game-invitation.repository'; -import { User } from '../users/entities/user.entity'; -import { UsersRepository } from '../users/users.repository'; -import { UsersService } from '../users/users.service'; import { AuthController } from './auth.controller'; import { AuthService } from './auth.service'; import { FtAuthService } from './ft-auth.service'; import { JwtAccessStrategy } from './jwt-access.strategy'; import { JwtRefreshStrategy } from './jwt-refresh.strategy'; +import { UsersModule } from '../users/users.module'; @Module({ imports: [ - TypeOrmModule.forFeature([ - User, - Game, - GameInvitation, - Friend, - Block, - ChannelUser, - ]), PassportModule, JwtModule.registerAsync({ inject: [jwtConfig.KEY], useFactory: (jwtConfigure: ConfigType) => jwtConfigure, }), + UsersModule, ], controllers: [AuthController], providers: [ AuthService, FtAuthService, - UsersRepository, - UsersService, - GameRepository, - GameInvitationRepository, - FriendsRepository, - BlocksRepository, - ChannelUsersRepository, - FriendsRepository, - AppService, JwtAccessStrategy, JwtRefreshStrategy, ], - exports: [JwtAccessStrategy, JwtRefreshStrategy], + exports: [AuthService, JwtAccessStrategy, JwtRefreshStrategy], }) export class AuthModule {} diff --git a/src/channels/channels.module.ts b/src/channels/channels.module.ts index df474d2..190c309 100644 --- a/src/channels/channels.module.ts +++ b/src/channels/channels.module.ts @@ -1,18 +1,5 @@ import { Module } from '@nestjs/common'; -import { JwtService } from '@nestjs/jwt'; import { TypeOrmModule } from '@nestjs/typeorm'; -import { AuthService } from 'src/auth/auth.service'; -import { Game } from 'src/game/entities/game.entity'; -import { GameRepository } from 'src/game/game.repository'; -import { BlocksRepository } from 'src/users/blocks.repository'; -import { Block } from 'src/users/entities/block.entity'; -import { Friend } from 'src/users/entities/friend.entity'; -import { User } from 'src/users/entities/user.entity'; -import { FriendsRepository } from 'src/users/friends.repository'; -import { UsersRepository } from 'src/users/users.repository'; -import { UsersService } from 'src/users/users.service'; -import { GameInvitation } from '../game/entities/game-invitation.entity'; -import { GameInvitationRepository } from '../game/game-invitation.repository'; import { ChannelInvitationRepository } from './channel-invitation.repository'; import { ChannelUsersRepository } from './channel-users.repository'; import { ChannelsController } from './channels.controller'; @@ -22,36 +9,23 @@ import { ChannelsService } from './channels.service'; import { ChannelInvitation } from './entities/channel-invitation.entity'; import { ChannelUser } from './entities/channel-user.entity'; import { Channel } from './entities/channel.entity'; +import { UsersModule } from '../users/users.module'; +import { AuthModule } from '../auth/auth.module'; @Module({ imports: [ - TypeOrmModule.forFeature([ - Channel, - ChannelUser, - ChannelInvitation, - User, - Game, - GameInvitation, - Friend, - Block, - ]), + TypeOrmModule.forFeature([Channel, ChannelUser, ChannelInvitation]), + AuthModule, + UsersModule, ], controllers: [ChannelsController], providers: [ + ChannelsGateway, ChannelsService, - UsersService, - AuthService, - JwtService, ChannelsRepository, ChannelUsersRepository, ChannelInvitationRepository, - UsersRepository, - ChannelsGateway, - GameRepository, - GameInvitationRepository, - FriendsRepository, - BlocksRepository, ], - exports: [ChannelsGateway], + exports: [ChannelsGateway, ChannelUsersRepository], }) export class ChannelsModule {} diff --git a/src/game/game.module.ts b/src/game/game.module.ts index f8ee171..fe06cf1 100644 --- a/src/game/game.module.ts +++ b/src/game/game.module.ts @@ -4,46 +4,27 @@ import { Game } from './entities/game.entity'; import { GameController } from './game.controller'; import { GameRepository } from './game.repository'; import { GameService } from './game.service'; -import { UsersRepository } from '../users/users.repository'; -import { User } from '../users/entities/user.entity'; import { GameInvitationRepository } from './game-invitation.repository'; import { GameInvitation } from './entities/game-invitation.entity'; import { GameGateway } from './game.gateway'; -import { AuthService } from '../auth/auth.service'; -import { JwtService } from '@nestjs/jwt'; -import { ChannelUsersRepository } from '../channels/channel-users.repository'; -import { FriendsRepository } from '../users/friends.repository'; -import { ChannelUser } from '../channels/entities/channel-user.entity'; -import { Friend } from '../users/entities/friend.entity'; import { ChannelsModule } from '../channels/channels.module'; -import { Block } from '../users/entities/block.entity'; -import { BlocksRepository } from '../users/blocks.repository'; -import { ChannelsGateway } from 'src/channels/channels.gateway'; +import { UsersModule } from '../users/users.module'; +import { AuthModule } from '../auth/auth.module'; @Module({ imports: [ - TypeOrmModule.forFeature([ - Game, - GameInvitation, - User, - ChannelUser, - Friend, - Block, - ]), + TypeOrmModule.forFeature([Game, GameInvitation]), + AuthModule, + UsersModule, ChannelsModule, ], controllers: [GameController], providers: [ GameGateway, GameService, - AuthService, - JwtService, - ChannelUsersRepository, - FriendsRepository, - BlocksRepository, GameRepository, GameInvitationRepository, - UsersRepository, ], + exports: [GameRepository, GameInvitationRepository], }) export class GameModule {} diff --git a/src/users/users.module.ts b/src/users/users.module.ts index 8799a2a..ed0037e 100644 --- a/src/users/users.module.ts +++ b/src/users/users.module.ts @@ -15,27 +15,29 @@ import { UsersRepository } from './users.repository'; import { UsersService } from './users.service'; import { ScheduleModule } from '@nestjs/schedule'; import { AppService } from 'src/app.service'; -import { GameInvitation } from '../game/entities/game-invitation.entity'; -import { GameInvitationRepository } from '../game/game-invitation.repository'; @Module({ imports: [ - TypeOrmModule.forFeature([User, Friend, Block, Game, GameInvitation]), + TypeOrmModule.forFeature([User, Friend, Block, Game]), ScheduleModule.forRoot(), ], controllers: [UsersController], providers: [ + AppService, + RanksService, UsersService, FriendsService, BlocksService, - RanksService, UsersRepository, FriendsRepository, BlocksRepository, GameRepository, - GameInvitationRepository, - AppService, ], - exports: [UsersService], + exports: [ + UsersService, + UsersRepository, + FriendsRepository, + BlocksRepository, + ], }) export class UsersModule {}