Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: module 되는데까지 정리 #106

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ import userConfig from './config/user.config';
ScheduleModule.forRoot(),
AuthModule,
UsersModule,
GameModule,
ChannelsModule,
GameModule,
RedisModule,
SwaggerModule,
],
Expand Down
2 changes: 0 additions & 2 deletions src/auth/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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')
Expand Down
37 changes: 3 additions & 34 deletions src/auth/auth.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof jwtConfig>) =>
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 {}
40 changes: 7 additions & 33 deletions src/channels/channels.module.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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 {}
31 changes: 6 additions & 25 deletions src/game/game.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
16 changes: 9 additions & 7 deletions src/users/users.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
Loading