-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #138 from innovationacademy-kr/be_v3/common
Be v3/common
- Loading branch information
Showing
23 changed files
with
240 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
import { | ||
BadRequestException, | ||
Controller, | ||
Delete, | ||
Get, | ||
Logger, | ||
Param, | ||
ParseIntPipe, | ||
Patch, | ||
Query, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Controller, Logger, UseGuards } from '@nestjs/common'; | ||
import { ApiTags } from '@nestjs/swagger'; | ||
import { JWTAuthGuard } from 'src/auth/auth.guard'; | ||
import { CabinetService } from './cabinet.service'; | ||
|
||
@ApiTags('(V3) Cabinet') | ||
@Controller({ | ||
version: '3', | ||
path: 'cabinet', | ||
}) | ||
@UseGuards(JWTAuthGuard) | ||
export class CabinetController { | ||
constructor(private cabinetService: CabinetService) {} | ||
|
||
private logger = new Logger(CabinetController.name); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { TypeOrmModule } from '@nestjs/typeorm'; | ||
import { AuthModule } from 'src/auth/auth.module'; | ||
import Cabinet from 'src/entities/cabinet.entity'; | ||
import { CabinetController } from './cabinet.controller'; | ||
import { CabinetService } from './cabinet.service'; | ||
import { CabinetRepository } from './repository/cabinet.repository'; | ||
|
||
const repo = { | ||
provide: 'ICabinetRepository', | ||
useClass: CabinetRepository, | ||
}; | ||
|
||
@Module({ | ||
imports: [AuthModule, TypeOrmModule.forFeature([Cabinet])], | ||
exports: [CabinetService], | ||
controllers: [CabinetController], | ||
providers: [CabinetService, repo], | ||
}) | ||
export class CabinetModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Inject, Injectable, Logger } from '@nestjs/common'; | ||
import { ICabinetRepository } from './repository/cabinet.repository.interface'; | ||
|
||
@Injectable() | ||
export class CabinetService { | ||
private logger = new Logger(CabinetService.name); | ||
|
||
constructor( | ||
@Inject('ICabinetRepository') | ||
private cabinetRepository: ICabinetRepository, | ||
) {} | ||
} |
2 changes: 2 additions & 0 deletions
2
backend/src/v3/cabinet/repository/cabinet.repository.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
export interface ICabinetRepository {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { InjectRepository } from '@nestjs/typeorm'; | ||
import Cabinet from 'src/entities/cabinet.entity'; | ||
import { Repository } from 'typeorm'; | ||
import { ICabinetRepository } from './cabinet.repository.interface'; | ||
|
||
export class CabinetRepository implements ICabinetRepository { | ||
constructor( | ||
@InjectRepository(Cabinet) | ||
private cabinetRepository: Repository<Cabinet>, | ||
) {} | ||
} |
2 changes: 2 additions & 0 deletions
2
backend/src/v3/return/repository/return.repository.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
export interface IReturnRepository {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { InjectRepository } from '@nestjs/typeorm'; | ||
import Cabinet from 'src/entities/cabinet.entity'; | ||
import { Repository } from 'typeorm'; | ||
import { IReturnRepository } from './return.repository.interface'; | ||
|
||
export class ReturnRepository implements IReturnRepository { | ||
constructor( | ||
@InjectRepository(Cabinet) private cabinetRepository: Repository<Cabinet>, | ||
) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Controller, Logger, UseGuards } from '@nestjs/common'; | ||
import { ApiTags } from '@nestjs/swagger'; | ||
import { JWTAuthGuard } from 'src/auth/auth.guard'; | ||
import { ReturnService } from './return.service'; | ||
|
||
@ApiTags('(V3) Return') | ||
@Controller({ | ||
version: '3', | ||
path: 'return', | ||
}) | ||
@UseGuards(JWTAuthGuard) | ||
export class ReturnController { | ||
private logger = new Logger(ReturnController.name); | ||
|
||
constructor(private returnService: ReturnService) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { TypeOrmModule } from '@nestjs/typeorm'; | ||
import { AuthModule } from 'src/auth/auth.module'; | ||
import Cabinet from 'src/entities/cabinet.entity'; | ||
import { CabinetModule } from '../cabinet/cabinet.module'; | ||
import { ReturnRepository } from './repository/return.repository'; | ||
import { ReturnController } from './return.controller'; | ||
import { ReturnService } from './return.service'; | ||
|
||
const repo = { | ||
provide: 'IReturnRepository', | ||
useClass: ReturnRepository, | ||
}; | ||
|
||
@Module({ | ||
controllers: [ReturnController], | ||
providers: [ReturnService, repo], | ||
imports: [AuthModule, TypeOrmModule.forFeature([Cabinet]), CabinetModule], // for JWTAuthGuard | ||
}) | ||
export class ReturnModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Inject, Injectable, Logger } from '@nestjs/common'; | ||
import { CabinetService } from 'src/v3/cabinet/cabinet.service'; | ||
import { IReturnRepository } from './repository/return.repository.interface'; | ||
|
||
@Injectable() | ||
export class ReturnService { | ||
private logger = new Logger(ReturnService.name); | ||
|
||
constructor( | ||
@Inject('IReturnRepository') private returnRepository: IReturnRepository, | ||
private cabinetService: CabinetService, | ||
) {} | ||
} |
2 changes: 2 additions & 0 deletions
2
backend/src/v3/search/repository/search.repository.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
export interface ISearchRepository {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { InjectRepository } from '@nestjs/typeorm'; | ||
import Cabinet from 'src/entities/cabinet.entity'; | ||
import LentLog from 'src/entities/lent.log.entity'; | ||
import User from 'src/entities/user.entity'; | ||
import { Repository } from 'typeorm'; | ||
import { ISearchRepository } from './search.repository.interface'; | ||
|
||
export class SearchRepository implements ISearchRepository { | ||
constructor( | ||
@InjectRepository(User) private userRepository: Repository<User>, | ||
@InjectRepository(Cabinet) private cabinetRepository: Repository<Cabinet>, | ||
@InjectRepository(LentLog) private lentLogRepository: Repository<LentLog>, | ||
) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Controller, Logger, UseGuards } from '@nestjs/common'; | ||
import { ApiTags } from '@nestjs/swagger'; | ||
import { JWTAuthGuard } from 'src/auth/auth.guard'; | ||
import { SearchService } from './search.service'; | ||
|
||
@ApiTags('(V3) Search') | ||
@Controller({ | ||
version: '3', | ||
path: 'search', | ||
}) | ||
@UseGuards(JWTAuthGuard) | ||
export class SearchController { | ||
private logger = new Logger(SearchController.name); | ||
|
||
constructor(private searchService: SearchService) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { TypeOrmModule } from '@nestjs/typeorm'; | ||
import { AuthModule } from 'src/auth/auth.module'; | ||
import Cabinet from 'src/entities/cabinet.entity'; | ||
import LentLog from 'src/entities/lent.log.entity'; | ||
import User from 'src/entities/user.entity'; | ||
import { SearchRepository } from './repository/search.repository'; | ||
import { SearchController } from './search.controller'; | ||
import { SearchService } from './search.service'; | ||
|
||
const repo = { | ||
provide: 'ISearchRepository', | ||
useClass: SearchRepository, | ||
}; | ||
|
||
@Module({ | ||
controllers: [SearchController], | ||
providers: [SearchService, repo], | ||
imports: [AuthModule, TypeOrmModule.forFeature([User, Cabinet, LentLog])], | ||
}) | ||
export class SearchModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Inject, Injectable, Logger } from '@nestjs/common'; | ||
import { ISearchRepository } from './repository/search.repository.interface'; | ||
|
||
@Injectable() | ||
export class SearchService { | ||
private logger = new Logger(SearchService.name); | ||
constructor( | ||
@Inject('ISearchRepository') private searchRepository: ISearchRepository, | ||
) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
export interface IUserRepository {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { InjectRepository } from '@nestjs/typeorm'; | ||
import User from 'src/entities/user.entity'; | ||
import { Repository } from 'typeorm'; | ||
import { IUserRepository } from './user.repository.interface'; | ||
|
||
export class UserRepository implements IUserRepository { | ||
constructor( | ||
@InjectRepository(User) private userRepository: Repository<User>, | ||
) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { TypeOrmModule } from '@nestjs/typeorm'; | ||
import User from 'src/entities/user.entity'; | ||
import { UserRepository } from './repository/user.repository'; | ||
import { UserService } from './user.service'; | ||
|
||
const repo = { | ||
provide: 'IUserRepository', | ||
useClass: UserRepository, | ||
}; | ||
|
||
@Module({ | ||
imports: [TypeOrmModule.forFeature([User])], | ||
providers: [UserService, repo], | ||
exports: [UserService], | ||
}) | ||
export class UserModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Inject } from '@nestjs/common'; | ||
import { Injectable } from '@nestjs/common'; | ||
import { IUserRepository } from './repository/user.repository.interface'; | ||
|
||
@Injectable() | ||
export class UserService { | ||
constructor( | ||
@Inject('IUserRepository') private userRepository: IUserRepository, | ||
) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { AuthModule } from 'src/auth/auth.module'; | ||
import { CabinetModule } from './cabinet/cabinet.module'; | ||
import { ReturnModule } from './return/return.module'; | ||
import { SearchModule } from './search/search.module'; | ||
import { UserModule } from './user/user.module'; | ||
|
||
@Module({ | ||
imports: [AuthModule, CabinetModule, ReturnModule, SearchModule, UserModule], | ||
controllers: [], | ||
providers: [], | ||
}) | ||
export class V3Module {} |