Skip to content

Commit

Permalink
refactor: delete unused modules
Browse files Browse the repository at this point in the history
- 사용하지 않는 모듈이 import 되어 있는 부분을 모두 삭제하였습니다.
  • Loading branch information
Tolerblanc committed Nov 4, 2023
1 parent 63e3136 commit e1ddd22
Show file tree
Hide file tree
Showing 30 changed files with 12 additions and 127 deletions.
3 changes: 0 additions & 3 deletions srcs/nest/src/auth/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ import {
Res,
UseGuards,
UnauthorizedException,
Query,
InternalServerErrorException,
Logger,
Param,
Body,
Patch,
} from '@nestjs/common';
Expand Down
2 changes: 0 additions & 2 deletions srcs/nest/src/auth/auth.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ import { UserModule } from 'src/user/user.module';
import { HttpModule } from '@nestjs/axios';
import { JwtService } from '@nestjs/jwt';
import { MailService } from 'src/mail/mail.service';
// import { RegenerateJwtStrategy } from './regenerate-auth.strategy';
import { RegenerateAuthGuard } from './regenerateAuth.guard';
// import { JwtAuthGuard } from './jwtAuth.guard';
import { SocketUsersModule } from '../socket/socketUsersService/socketUsers.module';

@Module({
Expand Down
5 changes: 1 addition & 4 deletions srcs/nest/src/auth/auth.service.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
import {
Injectable,
UnauthorizedException,
Res,
HttpStatus,
InternalServerErrorException,
Logger,
BadRequestException,
} from '@nestjs/common';
import { JwtService } from '@nestjs/jwt';
import { UserService } from 'src/user/user.service';
import { Auth42Dto } from './dto/auth42.dto';
import { Request, Response } from 'express';
import { Request } from 'express';
import { User } from 'src/user/user.entity';
import { MailService } from 'src/mail/mail.service';
import { UserInfoDto } from 'src/user/dto/userInfo.dto';

@Injectable()
export class AuthService {
Expand Down
Empty file.
2 changes: 0 additions & 2 deletions srcs/nest/src/auth/fortytwo.strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import { PassportStrategy } from '@nestjs/passport';
import { Strategy } from 'passport-oauth2';
import axios from 'axios';
import { Response } from 'express';
// import { UserInfoDto } from 'src/user/dto/user-info.dto';
// import { userRole } from 'src/user/user-role.enum';

//42 OAuth2 인증을 위한 클래스
/*
Expand Down
15 changes: 1 addition & 14 deletions srcs/nest/src/auth/jwtAuth.guard.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
// import { Injectable } from '@nestjs/common';
// import { AuthGuard } from '@nestjs/passport';

// @Injectable()
// export class JwtAuthGuard extends AuthGuard('jwt') {}

import {
Injectable,
CanActivate,
UnauthorizedException,
ExecutionContext,
NotFoundException,
Logger,
} from '@nestjs/common';
import { Injectable, CanActivate, UnauthorizedException, ExecutionContext, Logger } from '@nestjs/common';
import { JwtService } from '@nestjs/jwt';
import { Request } from 'express';

Expand Down
7 changes: 1 addition & 6 deletions srcs/nest/src/auth/jwtEnroll.guard.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import {
Injectable,
CanActivate,
UnauthorizedException,
ExecutionContext,
} from '@nestjs/common';
import { Injectable, CanActivate, UnauthorizedException, ExecutionContext } from '@nestjs/common';
import { JwtService } from '@nestjs/jwt';
import { Request } from 'express';

Expand Down
1 change: 0 additions & 1 deletion srcs/nest/src/auth/regenerate-auth.strategy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Injectable } from '@nestjs/common';
import { PassportStrategy } from '@nestjs/passport';
import { ExtractJwt, Strategy } from 'passport-jwt';
// import { JwtPayload } from './jwtAuth.strategy';
import { UserService } from 'src/user/user.service';

@Injectable()
Expand Down
9 changes: 1 addition & 8 deletions srcs/nest/src/auth/regenerateAuth.guard.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
import {
Injectable,
CanActivate,
UnauthorizedException,
ExecutionContext,
BadRequestException,
Logger,
} from '@nestjs/common';
import { Injectable, CanActivate, UnauthorizedException, ExecutionContext, Logger } from '@nestjs/common';
import { JwtService } from '@nestjs/jwt';
import { Request } from 'express';

Expand Down
2 changes: 1 addition & 1 deletion srcs/nest/src/game/game.controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Controller, Get, Put, Delete, Patch, Param, Req, Res, UseGuards, Logger } from '@nestjs/common';
import { Controller, Get, Param, Req, Res, UseGuards, Logger } from '@nestjs/common';
import { GameService } from './game.service';
import { JwtAuthGuard } from 'src/auth/jwtAuth.guard';
import { Response } from 'express';
Expand Down
2 changes: 1 addition & 1 deletion srcs/nest/src/game/game.module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Module, forwardRef } from '@nestjs/common';
import { Module } from '@nestjs/common';
import { UserModule } from 'src/user/user.module';
import { JwtModule } from '@nestjs/jwt';
import { TypeOrmModule } from '@nestjs/typeorm';
Expand Down
6 changes: 1 addition & 5 deletions srcs/nest/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import * as express from 'express';
import { MyLogger } from './my-logger';

async function bootstrap() {
// Set the defaultMaxListeners before creating the NestJS app instance

require('events').EventEmitter.prototype._maxListeners = 100;
const app = await NestFactory.create(AppModule, { cors: true, logger: new MyLogger() });

Expand All @@ -16,9 +14,7 @@ async function bootstrap() {
allowedHeaders: 'Authorization, X-Requested-With, X-HTTP-Method-Override, Content-Type',
});

// Other app configuration and startup code...

await app.listen(3000);
}

bootstrap();
bootstrap();
9 changes: 1 addition & 8 deletions srcs/nest/src/socket/chatRoom/chatRoom.gateway.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
import {
OnGatewayConnection,
OnGatewayDisconnect,
SubscribeMessage,
WebSocketGateway,
WebSocketServer,
} from '@nestjs/websockets';
import { OnGatewayConnection, SubscribeMessage, WebSocketGateway, WebSocketServer } from '@nestjs/websockets';
import { Logger } from '@nestjs/common';
import { AppService } from 'src/app.service';
import { Server, Socket } from 'socket.io';
import { ChatRoomService } from './chatRoom.service';
import { CreateRoomDto } from './dto/createRoom.dto';
Expand Down
30 changes: 0 additions & 30 deletions srcs/nest/src/socket/chatRoom/chatRoom.guard.ts

This file was deleted.

1 change: 0 additions & 1 deletion srcs/nest/src/socket/chatRoom/chatRoom.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { BlockedUsersRepository } from 'src/user/blockedUsers/blockedUsers.repos
import { TypeOrmModule } from '@nestjs/typeorm';
import { BlockedUsersModule } from 'src/user/blockedUsers/blockedUsers.module';
import { SocketUsersModule } from '../socketUsersService/socketUsers.module';
import { SocketUsersService } from '../socketUsersService/socketUsers.service';
import { FriendModule } from 'src/user/friend/friend.module';

@Module({
Expand Down
14 changes: 0 additions & 14 deletions srcs/nest/src/socket/chatRoom/chatRoom.service.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
import { Injectable, Logger } from '@nestjs/common';
import { AppService } from '../../app.service';
import { Socket, Server } from 'socket.io';
import { ChatRoomDto } from './dto/chatRoom.dto';
import { CreateRoomDto } from './dto/createRoom.dto';
import { RoomStatus } from './roomStatus.enum';
import { UserPermission } from './userPermission.enum';
import { SocketUsersService } from '../socketUsersService/socketUsers.service';
import { time } from 'console';
import { InviteType } from '../socketUsersService/socketUsers.enum';
import { User } from 'src/user/user.entity';
// import { RouterModule } from '@nestjs/core';
// import * as schedule from 'node-schedule';

/*
1. 채팅방 개설
2. 채팅방 나가기
Expand Down Expand Up @@ -71,13 +65,6 @@ export class ChatRoomService {
return memberList;
}

private async getBlockListById(userId: number): Promise<Array<number>> {
// 새로 들어오는 유저의 blockList를 DB에서 꺼내와 배열로 반환하기
const resultArray = new Array<number>();
// DB에서 userId가 block한 다른 user의 id들을 가져와 resultArray에 담기
return resultArray;
}

getUserId(socket: Socket): number | undefined {
return this.socketUsersService.getUserIdByChatSocketId(socket.id);
}
Expand All @@ -93,7 +80,6 @@ export class ChatRoomService {

async deleteUser(socket: Socket) {
const userId = this.getUserId(socket);
// console.log('DELETE USER', await this.socketUsersService.getUserNameByUserId(userId));
//user가 속했던 방 삭제
const publicRooms: Map<string, ChatRoomDto> = this.publicRoomList;
const privateRooms: Map<string, ChatRoomDto> = this.privateRoomList;
Expand Down
3 changes: 0 additions & 3 deletions srcs/nest/src/socket/chatRoom/dto/createRoom.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ export class CreateRoomDto {
@IsString()
roomName: string;

// @IsString()
// userName: string;

@IsString()
password: string | null;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Body, Controller, Get, Logger, Param, ParseIntPipe, Put, Req, Res, UseGuards } from '@nestjs/common';
import { Body, Controller, Get, Logger, Param, Put, Req, Res, UseGuards } from '@nestjs/common';
import { DirectMessageService } from './directMessage.service';
import { JwtAuthGuard } from 'src/auth/jwtAuth.guard';
import { UserService } from 'src/user/user.service';
Expand Down
1 change: 0 additions & 1 deletion srcs/nest/src/socket/directMessage/directMessage.entity.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { IsBoolean, IsNumber, IsString } from 'class-validator';
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
import { DateTime } from 'luxon';

@Entity({ name: 'DMMessages', schema: 'public' })
export class DirectMessage {
Expand Down
2 changes: 0 additions & 2 deletions srcs/nest/src/socket/directMessage/directMessage.gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import {
} from '@nestjs/websockets';
import { Server, Socket } from 'socket.io';
import { DirectMessageService } from './directMessage.service';
import { DateTime } from 'luxon';
import { JwtService } from '@nestjs/jwt';
import { UserStatus } from 'src/user/user-status.enum';
import { Logger } from '@nestjs/common';
import { User } from 'src/user/user.entity';
export const TIMEZONE: string = 'Asia/Seoul';
Expand Down
1 change: 0 additions & 1 deletion srcs/nest/src/socket/directMessage/directMessage.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { TypeOrmModule } from '@nestjs/typeorm';
import { DirectMessageController } from './directMessage.controller';
import { UserModule } from 'src/user/user.module';
import { BlockedUsersModule } from 'src/user/blockedUsers/blockedUsers.module';
import { SocketUsersService } from '../socketUsersService/socketUsers.service';
import { SocketUsersModule } from '../socketUsersService/socketUsers.module';
import { FriendModule } from 'src/user/friend/friend.module';

Expand Down
2 changes: 0 additions & 2 deletions srcs/nest/src/socket/directMessage/directMessage.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ import { DirectMessageRepository } from './directMessage.repository';
import { Socket } from 'socket.io';
import { DirectMessage } from './directMessage.entity';
import { DateTime } from 'luxon';
import { BlockedUsersService } from 'src/user/blockedUsers/blockedUsers.service';
import { SocketUsersService } from '../socketUsersService/socketUsers.service';
import { DirectMessageInfoDto } from './dto/directMessageInfo.dto';
import { InjectRepository } from '@nestjs/typeorm';
import { UserStatus } from 'src/user/user-status.enum';
import { InviteType } from '../socketUsersService/socketUsers.enum';
import { Invitation } from '../socketUsersService/socketUsers.interface';
import { User } from 'src/user/user.entity';
const TIMEZONE: string = 'Asia/Seoul';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Module, forwardRef } from '@nestjs/common';
import { Module } from '@nestjs/common';
import { BlockedUsersModule } from 'src/user/blockedUsers/blockedUsers.module';
import { SocketUsersService } from './socketUsers.service';
import { UserModule } from 'src/user/user.module';
Expand Down
1 change: 0 additions & 1 deletion srcs/nest/src/user/dto/userProfile.dto.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { IsNotEmpty, IsString, IsNumber } from 'class-validator';

//TODO 프로필에 보여줄 내용 정해야함
export class UserProfileDto {
@IsNotEmpty()
@IsNumber()
Expand Down
1 change: 0 additions & 1 deletion srcs/nest/src/user/friend/friend.repository.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Injectable } from '@nestjs/common';
import { EntityRepository, Repository } from 'typeorm';
import { Friend } from './friend.entity';
import { FriendStatus } from './friend.enum';

@EntityRepository(Friend)
@Injectable()
Expand Down
1 change: 0 additions & 1 deletion srcs/nest/src/user/friend/friend.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { FriendRepository } from './friend.repository';
import { Friend } from './friend.entity';
import { InjectRepository } from '@nestjs/typeorm';
import { UserService } from '../user.service';
import { UserStatus } from '../user-status.enum';
import { FriendStatus } from './friend.enum';
import { User } from '../user.entity';

Expand Down
4 changes: 0 additions & 4 deletions srcs/nest/src/user/user.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ import {
UseInterceptors,
UploadedFile,
Res,
NotFoundException,
InternalServerErrorException,
BadRequestException,
ParseIntPipe,
Logger,
} from '@nestjs/common';
import { UserService } from './user.service';
Expand Down
2 changes: 1 addition & 1 deletion srcs/nest/src/user/user.entity.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Entity, PrimaryGeneratedColumn, Column, Unique } from 'typeorm';
import { UserStatus } from './user-status.enum';
import { IsBoolean, IsEnum, IsNumber, IsString } from 'class-validator';
import { IsEnum, IsNumber, IsString } from 'class-validator';
import { userRole } from './user-role.enum';

@Entity({ name: 'user', schema: 'public' })
Expand Down
7 changes: 1 addition & 6 deletions srcs/nest/src/user/user.module.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
import { Module, UnprocessableEntityException, forwardRef } from '@nestjs/common';
import { Module, UnprocessableEntityException } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { UserController } from './user.controller';
import { UserService } from './user.service';
import { User } from './user.entity';
import { UserRepository } from './user.repository';
import { JwtEnrollGuard } from 'src/auth/jwtEnroll.guard';
import { JwtModule } from '@nestjs/jwt';
import { MulterModule } from '@nestjs/platform-express';
import { diskStorage } from 'multer';
import { GameModule } from 'src/game/game.module';
import { GameService } from 'src/game/game.service';
import { SocketUsersModule } from '../socket/socketUsersService/socketUsers.module';
import { DirectMessageModule } from 'src/socket/directMessage/directMessage.module';
import { JwtAuthGuard } from 'src/auth/jwtAuth.guard';

@Module({
Expand Down
2 changes: 0 additions & 2 deletions srcs/nest/src/user/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ import { existsSync, readFileSync, unlinkSync } from 'fs';
import { extname } from 'path';
import { UserProfileDto } from './dto/userProfile.dto';
import { InjectRepository } from '@nestjs/typeorm';
import { UserStatus } from './user-status.enum';
import { POINT, LEVELUP } from 'src/game/game.constants';
import { DirectMessageService } from 'src/socket/directMessage/directMessage.service';
import * as bcrypt from 'bcrypt';

@Injectable()
Expand Down

0 comments on commit e1ddd22

Please sign in to comment.