Skip to content

Commit

Permalink
응집성을 높이기 위해 별개의 모듈로 분리하라
Browse files Browse the repository at this point in the history
각 애플리케이션 마다 모듈화를 진행했습니다. 모듈화 하는 이유는 애플리케이션이 한 가지 일만 수행하도록 여러 컴포넌트를 조합하여 더 큰 작업을 수행 할 수 있습니다
  • Loading branch information
jihwooon committed Nov 1, 2023
1 parent 8a4c58d commit 98b0303
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 18 deletions.
18 changes: 4 additions & 14 deletions server/src/auth/auth.module.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
import { Module } from '@nestjs/common'
import { DatabaseModule } from '../config/database/database.module'
import { MemberModule } from '../members/member.module'
import { SignupController } from './signup/web/signup.controller'
import { SignupService } from './signup/application/signup.service'
import { JwtProvider } from '../jwt/jwt.provider'
import { SigninController } from './signin/web/signin.controller'
import { SigninService } from './signin/application/signin.service'
import { TokenController } from './token/web/token.controller'
import { TokenIssuer } from './token/application/token.issuer'
import { SignoutService } from './signout/application/signout.service'
import { SignoutController } from './signout/web/signout.controller'
import { SigninModule } from './signin/signin.module'
import { SignoutModule } from './signout/signout.module'
import { SignupModule } from './signup/signup.module'

@Module({
imports: [DatabaseModule, MemberModule],
controllers: [SignupController, SigninController, TokenController, SignoutController],
providers: [SignupService, SigninService, JwtProvider, TokenIssuer, SignoutService],
imports: [SigninModule, SignoutModule, SignupModule],
})
export class AuthModule {}
15 changes: 15 additions & 0 deletions server/src/auth/signin/signin.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Module } from '@nestjs/common'
import { SigninService } from './application/signin.service'
import { SigninController } from './web/signin.controller'
import { DatabaseModule } from '../../config/database/database.module'
import { MemberModule } from '../../members/member.module'
import { JwtModule } from '../../jwt/jwt.module'
import { TokenModule } from '../token/token.module'

@Module({
imports: [DatabaseModule, MemberModule, JwtModule, TokenModule],
controllers: [SigninController],
providers: [SigninService],
exports: [SigninService],
})
export class SigninModule {}
15 changes: 15 additions & 0 deletions server/src/auth/signout/signout.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Module } from '@nestjs/common'
import { DatabaseModule } from '../../config/database/database.module'
import { MemberModule } from '../../members/member.module'
import { JwtModule } from '../../jwt/jwt.module'
import { SignoutService } from './application/signout.service'
import { SignoutController } from './web/signout.controller'
import { TokenModule } from '../token/token.module'

@Module({
imports: [DatabaseModule, MemberModule, JwtModule, TokenModule],
controllers: [SignoutController],
providers: [SignoutService],
exports: [SignoutService],
})
export class SignoutModule {}
14 changes: 14 additions & 0 deletions server/src/auth/signup/signup.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Module } from '@nestjs/common'
import { DatabaseModule } from '../../config/database/database.module'
import { MemberModule } from '../../members/member.module'
import { JwtModule } from '../../jwt/jwt.module'
import { SignupService } from './application/signup.service'
import { SignupController } from './web/signup.controller'

@Module({
imports: [DatabaseModule, MemberModule, JwtModule],
controllers: [SignupController],
providers: [SignupService],
exports: [SignupService],
})
export class SignupModule {}
14 changes: 14 additions & 0 deletions server/src/auth/token/token.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Module } from '@nestjs/common'
import { DatabaseModule } from '../../config/database/database.module'
import { TokenController } from './web/token.controller'
import { TokenIssuer } from './application/token.issuer'
import { MemberModule } from '../../members/member.module'
import { JwtModule } from '../../jwt/jwt.module'

@Module({
imports: [DatabaseModule, MemberModule, JwtModule],
controllers: [TokenController],
providers: [TokenIssuer],
exports: [TokenIssuer],
})
export class TokenModule {}
8 changes: 4 additions & 4 deletions server/src/items/item.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import { ItemRepository } from './domain/item.repository'
import { DatabaseModule } from '../config/database/database.module'
import { ItemUpdateController } from './web/item-update.controller'
import { ItemUpdater } from './application/item.updater'
import { MemberRepository } from '../members/domain/member.repository'
import { JwtProvider } from '../jwt/jwt.provider'
import { ItemImageModule } from '../item-images/item-image.module'
import { MemberModule } from '../members/member.module'
import { JwtModule } from '../jwt/jwt.module'

@Module({
imports: [DatabaseModule, ItemImageModule],
imports: [DatabaseModule, ItemImageModule, MemberModule, JwtModule],
controllers: [ItemCreateController, ItemDetailController, ItemUpdateController],
providers: [ItemCreater, ItemRepository, ItemReader, ItemUpdater, MemberRepository, JwtProvider],
providers: [ItemCreater, ItemRepository, ItemReader, ItemUpdater],
})
export class ItemModule {}
10 changes: 10 additions & 0 deletions server/src/jwt/jwt.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Module } from '@nestjs/common'
import { DatabaseModule } from '../config/database/database.module'
import { JwtProvider } from '../jwt/jwt.provider'

@Module({
imports: [DatabaseModule],
providers: [JwtProvider],
exports: [JwtProvider],
})
export class JwtModule {}

0 comments on commit 98b0303

Please sign in to comment.