From 2df7f605d6e0366ccb9dbe4877b6a3d08fcec5d2 Mon Sep 17 00:00:00 2001 From: sichoi42 <42.4.sichoi@gmail.com> Date: Fri, 28 Oct 2022 16:23:42 +0900 Subject: [PATCH 1/2] :sparkles: add v3 module for new API #136 add v3 module for new API #136 --- backend/src/app.module.ts | 2 ++ backend/src/main.ts | 1 + backend/src/v3/cabinet/cabinet.controller.ts | 16 ++++++++++++++ backend/src/v3/cabinet/cabinet.module.ts | 20 ++++++++++++++++++ backend/src/v3/cabinet/cabinet.service.ts | 12 +++++++++++ .../cabinet.repository.interface.ts | 3 +++ .../cabinet/repository/cabinet.repository.ts | 11 ++++++++++ .../repository/return.repository.interface.ts | 3 +++ .../v3/return/repository/return.repository.ts | 10 +++++++++ backend/src/v3/return/return.controller.ts | 20 ++++++++++++++++++ backend/src/v3/return/return.module.ts | 20 ++++++++++++++++++ backend/src/v3/return/return.service.ts | 13 ++++++++++++ .../repository/search.repository.interface.ts | 3 +++ .../v3/search/repository/search.repository.ts | 14 +++++++++++++ backend/src/v3/search/search.controller.ts | 21 +++++++++++++++++++ backend/src/v3/search/search.module.ts | 21 +++++++++++++++++++ backend/src/v3/search/search.service.ts | 10 +++++++++ .../repository/user.repository.interface.ts | 3 +++ .../src/v3/user/repository/user.repository.ts | 10 +++++++++ backend/src/v3/user/user.module.ts | 17 +++++++++++++++ backend/src/v3/user/user.service.ts | 10 +++++++++ backend/src/v3/v3.module.ts | 13 ++++++++++++ 22 files changed, 253 insertions(+) create mode 100644 backend/src/v3/cabinet/cabinet.controller.ts create mode 100644 backend/src/v3/cabinet/cabinet.module.ts create mode 100644 backend/src/v3/cabinet/cabinet.service.ts create mode 100644 backend/src/v3/cabinet/repository/cabinet.repository.interface.ts create mode 100644 backend/src/v3/cabinet/repository/cabinet.repository.ts create mode 100644 backend/src/v3/return/repository/return.repository.interface.ts create mode 100644 backend/src/v3/return/repository/return.repository.ts create mode 100644 backend/src/v3/return/return.controller.ts create mode 100644 backend/src/v3/return/return.module.ts create mode 100644 backend/src/v3/return/return.service.ts create mode 100644 backend/src/v3/search/repository/search.repository.interface.ts create mode 100644 backend/src/v3/search/repository/search.repository.ts create mode 100644 backend/src/v3/search/search.controller.ts create mode 100644 backend/src/v3/search/search.module.ts create mode 100644 backend/src/v3/search/search.service.ts create mode 100644 backend/src/v3/user/repository/user.repository.interface.ts create mode 100644 backend/src/v3/user/repository/user.repository.ts create mode 100644 backend/src/v3/user/user.module.ts create mode 100644 backend/src/v3/user/user.service.ts create mode 100644 backend/src/v3/v3.module.ts diff --git a/backend/src/app.module.ts b/backend/src/app.module.ts index 9c10364..72562e8 100644 --- a/backend/src/app.module.ts +++ b/backend/src/app.module.ts @@ -11,6 +11,7 @@ import { SearchModule } from './search/search.module'; import { join } from 'path'; import TypeOrmConfigService from './config/typeorm.config'; import { TypeOrmModule } from '@nestjs/typeorm'; +import { V3Module } from './v3/v3.module'; @Module({ imports: [ @@ -32,6 +33,7 @@ import { TypeOrmModule } from '@nestjs/typeorm'; rootPath: join(__dirname, '../../', 'frontend/build/'), serveRoot: '', }), + V3Module, ], }) export class AppModule {} diff --git a/backend/src/main.ts b/backend/src/main.ts index ae1c912..5eac647 100644 --- a/backend/src/main.ts +++ b/backend/src/main.ts @@ -5,6 +5,7 @@ import { AppModule } from './app.module'; async function bootstrap() { const app = await NestFactory.create(AppModule); + app.enableVersioning(); app.setGlobalPrefix('api'); const swaggerConfig = new DocumentBuilder() .setTitle('Cabi Admin v2 API') diff --git a/backend/src/v3/cabinet/cabinet.controller.ts b/backend/src/v3/cabinet/cabinet.controller.ts new file mode 100644 index 0000000..d27640a --- /dev/null +++ b/backend/src/v3/cabinet/cabinet.controller.ts @@ -0,0 +1,16 @@ +import { Controller, Get, 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); +} diff --git a/backend/src/v3/cabinet/cabinet.module.ts b/backend/src/v3/cabinet/cabinet.module.ts new file mode 100644 index 0000000..d5c4bc3 --- /dev/null +++ b/backend/src/v3/cabinet/cabinet.module.ts @@ -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 {} diff --git a/backend/src/v3/cabinet/cabinet.service.ts b/backend/src/v3/cabinet/cabinet.service.ts new file mode 100644 index 0000000..72dccd2 --- /dev/null +++ b/backend/src/v3/cabinet/cabinet.service.ts @@ -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, + ) {} +} diff --git a/backend/src/v3/cabinet/repository/cabinet.repository.interface.ts b/backend/src/v3/cabinet/repository/cabinet.repository.interface.ts new file mode 100644 index 0000000..46563dc --- /dev/null +++ b/backend/src/v3/cabinet/repository/cabinet.repository.interface.ts @@ -0,0 +1,3 @@ +export interface ICabinetRepository { + +} diff --git a/backend/src/v3/cabinet/repository/cabinet.repository.ts b/backend/src/v3/cabinet/repository/cabinet.repository.ts new file mode 100644 index 0000000..f53db67 --- /dev/null +++ b/backend/src/v3/cabinet/repository/cabinet.repository.ts @@ -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, + ) {} +} diff --git a/backend/src/v3/return/repository/return.repository.interface.ts b/backend/src/v3/return/repository/return.repository.interface.ts new file mode 100644 index 0000000..c3137d6 --- /dev/null +++ b/backend/src/v3/return/repository/return.repository.interface.ts @@ -0,0 +1,3 @@ +export interface IReturnRepository { + +} diff --git a/backend/src/v3/return/repository/return.repository.ts b/backend/src/v3/return/repository/return.repository.ts new file mode 100644 index 0000000..83c167c --- /dev/null +++ b/backend/src/v3/return/repository/return.repository.ts @@ -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, + ) {} +} diff --git a/backend/src/v3/return/return.controller.ts b/backend/src/v3/return/return.controller.ts new file mode 100644 index 0000000..7b47b91 --- /dev/null +++ b/backend/src/v3/return/return.controller.ts @@ -0,0 +1,20 @@ +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) {} +} diff --git a/backend/src/v3/return/return.module.ts b/backend/src/v3/return/return.module.ts new file mode 100644 index 0000000..2dfa1b9 --- /dev/null +++ b/backend/src/v3/return/return.module.ts @@ -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 {} diff --git a/backend/src/v3/return/return.service.ts b/backend/src/v3/return/return.service.ts new file mode 100644 index 0000000..c208f20 --- /dev/null +++ b/backend/src/v3/return/return.service.ts @@ -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, + ) {} +} diff --git a/backend/src/v3/search/repository/search.repository.interface.ts b/backend/src/v3/search/repository/search.repository.interface.ts new file mode 100644 index 0000000..67d761a --- /dev/null +++ b/backend/src/v3/search/repository/search.repository.interface.ts @@ -0,0 +1,3 @@ +export interface ISearchRepository { + +} diff --git a/backend/src/v3/search/repository/search.repository.ts b/backend/src/v3/search/repository/search.repository.ts new file mode 100644 index 0000000..75313ea --- /dev/null +++ b/backend/src/v3/search/repository/search.repository.ts @@ -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, + @InjectRepository(Cabinet) private cabinetRepository: Repository, + @InjectRepository(LentLog) private lentLogRepository: Repository, + ) {} +} diff --git a/backend/src/v3/search/search.controller.ts b/backend/src/v3/search/search.controller.ts new file mode 100644 index 0000000..7be8322 --- /dev/null +++ b/backend/src/v3/search/search.controller.ts @@ -0,0 +1,21 @@ +import { + Controller, + Get, + 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) {} +} diff --git a/backend/src/v3/search/search.module.ts b/backend/src/v3/search/search.module.ts new file mode 100644 index 0000000..ccf4933 --- /dev/null +++ b/backend/src/v3/search/search.module.ts @@ -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 {} diff --git a/backend/src/v3/search/search.service.ts b/backend/src/v3/search/search.service.ts new file mode 100644 index 0000000..39058ca --- /dev/null +++ b/backend/src/v3/search/search.service.ts @@ -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, + ) {} +} diff --git a/backend/src/v3/user/repository/user.repository.interface.ts b/backend/src/v3/user/repository/user.repository.interface.ts new file mode 100644 index 0000000..ea3fa95 --- /dev/null +++ b/backend/src/v3/user/repository/user.repository.interface.ts @@ -0,0 +1,3 @@ +export interface IUserRepository { + +} diff --git a/backend/src/v3/user/repository/user.repository.ts b/backend/src/v3/user/repository/user.repository.ts new file mode 100644 index 0000000..0d2367c --- /dev/null +++ b/backend/src/v3/user/repository/user.repository.ts @@ -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, + ) {} +} diff --git a/backend/src/v3/user/user.module.ts b/backend/src/v3/user/user.module.ts new file mode 100644 index 0000000..4ae9ceb --- /dev/null +++ b/backend/src/v3/user/user.module.ts @@ -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 {} diff --git a/backend/src/v3/user/user.service.ts b/backend/src/v3/user/user.service.ts new file mode 100644 index 0000000..6b546a7 --- /dev/null +++ b/backend/src/v3/user/user.service.ts @@ -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, + ) {} +} diff --git a/backend/src/v3/v3.module.ts b/backend/src/v3/v3.module.ts new file mode 100644 index 0000000..1f0fbdc --- /dev/null +++ b/backend/src/v3/v3.module.ts @@ -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 {} From 9604aa8a90c09bbbcf5abf1ba644ad2a1164888a Mon Sep 17 00:00:00 2001 From: sichoi42 <42.4.sichoi@gmail.com> Date: Fri, 28 Oct 2022 16:32:45 +0900 Subject: [PATCH 2/2] :lipstick: lint check #136 lint check #136 --- backend/src/cabinet/cabinet.service.ts | 12 +++++++-- .../cabinet.repository.interface.ts | 14 +++++++---- .../cabinet/repository/cabinet.repository.ts | 23 ++++++++++------- backend/src/return/return.controller.ts | 2 -- backend/src/return/return.service.ts | 12 +++++++-- .../search/repository/search.repository.ts | 25 +++++++++++++------ backend/src/search/search.controller.ts | 2 +- backend/src/v3/cabinet/cabinet.controller.ts | 2 +- backend/src/v3/cabinet/cabinet.module.ts | 16 ++++++------ .../cabinet.repository.interface.ts | 5 ++-- .../cabinet/repository/cabinet.repository.ts | 8 +++--- .../repository/return.repository.interface.ts | 5 ++-- .../v3/return/repository/return.repository.ts | 10 ++++---- backend/src/v3/return/return.controller.ts | 6 +---- backend/src/v3/return/return.module.ts | 16 ++++++------ .../repository/search.repository.interface.ts | 5 ++-- .../v3/search/repository/search.repository.ts | 12 ++++----- backend/src/v3/search/search.controller.ts | 7 +----- backend/src/v3/search/search.service.ts | 4 +-- .../repository/user.repository.interface.ts | 5 ++-- .../src/v3/user/repository/user.repository.ts | 8 +++--- 21 files changed, 109 insertions(+), 90 deletions(-) diff --git a/backend/src/cabinet/cabinet.service.ts b/backend/src/cabinet/cabinet.service.ts index 1f57fa8..9e4e826 100644 --- a/backend/src/cabinet/cabinet.service.ts +++ b/backend/src/cabinet/cabinet.service.ts @@ -17,8 +17,16 @@ export class CabinetService { return result; } - async getCabinetIdBySection(location: string, floor: number, section: string): Promise { + async getCabinetIdBySection( + location: string, + floor: number, + section: string, + ): Promise { this.logger.debug(`Called ${this.getCabinetIdBySection.name}`); - return await this.cabinetRepository.getCabinetIdBySection(location, floor, section); + return await this.cabinetRepository.getCabinetIdBySection( + location, + floor, + section, + ); } } diff --git a/backend/src/cabinet/repository/cabinet.repository.interface.ts b/backend/src/cabinet/repository/cabinet.repository.interface.ts index 62e5e6c..6ad8be4 100644 --- a/backend/src/cabinet/repository/cabinet.repository.interface.ts +++ b/backend/src/cabinet/repository/cabinet.repository.interface.ts @@ -10,10 +10,14 @@ export interface ICabinetRepository { /** * section별로 lent된 cabinetid list를 가져옵니다. - * - * @param location - * @param floor - * @param section + * + * @param location + * @param floor + * @param section */ - getCabinetIdBySection(location: string, floor: number, section: string): Promise; + getCabinetIdBySection( + location: string, + floor: number, + section: string, + ): Promise; } diff --git a/backend/src/cabinet/repository/cabinet.repository.ts b/backend/src/cabinet/repository/cabinet.repository.ts index c447ac5..fe1bb01 100644 --- a/backend/src/cabinet/repository/cabinet.repository.ts +++ b/backend/src/cabinet/repository/cabinet.repository.ts @@ -45,15 +45,20 @@ export class CabinetRepository implements ICabinetRepository { return result; } - async getCabinetIdBySection(location: string, floor: number, section: string): Promise { - const result = await this.cabinetRepository.createQueryBuilder('c') - .innerJoin('c.lent', 'lent') - .select('lent_cabinet_id') - .where( {location} ) - .andWhere({ floor }) - .andWhere({ section }) - .getRawMany(); + async getCabinetIdBySection( + location: string, + floor: number, + section: string, + ): Promise { + const result = await this.cabinetRepository + .createQueryBuilder('c') + .innerJoin('c.lent', 'lent') + .select('lent_cabinet_id') + .where({ location }) + .andWhere({ floor }) + .andWhere({ section }) + .getRawMany(); - return result.map((c) => c.lent_cabinet_id) + return result.map((c) => c.lent_cabinet_id); } } diff --git a/backend/src/return/return.controller.ts b/backend/src/return/return.controller.ts index 8e20a7c..55623df 100644 --- a/backend/src/return/return.controller.ts +++ b/backend/src/return/return.controller.ts @@ -1,10 +1,8 @@ import { BadRequestException, Controller, - Delete, Get, Logger, - Param, ParseIntPipe, Patch, Query, diff --git a/backend/src/return/return.service.ts b/backend/src/return/return.service.ts index 146f12c..dae170c 100644 --- a/backend/src/return/return.service.ts +++ b/backend/src/return/return.service.ts @@ -24,9 +24,17 @@ export class ReturnService { return result; } - async sectionReturn(location: string, floor: number, section: string): Promise { + async sectionReturn( + location: string, + floor: number, + section: string, + ): Promise { this.logger.debug(`Called ${this.sectionReturn.name}`); - const cabinetList = await this.cabinetService.getCabinetIdBySection(location, floor, section); + const cabinetList = await this.cabinetService.getCabinetIdBySection( + location, + floor, + section, + ); cabinetList.forEach(async (id) => await this.patchReturn(id)); } } diff --git a/backend/src/search/repository/search.repository.ts b/backend/src/search/repository/search.repository.ts index 9ebbcf9..a71ba3a 100644 --- a/backend/src/search/repository/search.repository.ts +++ b/backend/src/search/repository/search.repository.ts @@ -15,14 +15,23 @@ export class SearchRepository implements ISearchRepository { ) {} async getLentByIntraId(intraId: string): Promise { - const result = await this.userRepository.createQueryBuilder('u') - .select(['u.intra_id', 'u.state']) - .addSelect(['c.cabinet_id', 'c.cabinet_id', 'c.cabinet_num', 'c.location', 'c.section', 'c.floor', 'c.cabinet_status']) - .addSelect(['l.lent_id', 'l.lent_time', 'l.expire_time']) - .leftJoin('lent', 'l', 'l.lent_user_id = u.user_id') - .leftJoin('cabinet', 'c', 'c.cabinet_id = l.lent_cabinet_id') - .where('u.intra_id = :intraId', { intraId }) - .execute(); + const result = await this.userRepository + .createQueryBuilder('u') + .select(['u.intra_id', 'u.state']) + .addSelect([ + 'c.cabinet_id', + 'c.cabinet_id', + 'c.cabinet_num', + 'c.location', + 'c.section', + 'c.floor', + 'c.cabinet_status', + ]) + .addSelect(['l.lent_id', 'l.lent_time', 'l.expire_time']) + .leftJoin('lent', 'l', 'l.lent_user_id = u.user_id') + .leftJoin('cabinet', 'c', 'c.cabinet_id = l.lent_cabinet_id') + .where('u.intra_id = :intraId', { intraId }) + .execute(); if (result.length === 0) { return []; } diff --git a/backend/src/search/search.controller.ts b/backend/src/search/search.controller.ts index 702533c..ddeeaa8 100644 --- a/backend/src/search/search.controller.ts +++ b/backend/src/search/search.controller.ts @@ -38,7 +38,7 @@ export class SearchController { intra_id: resultFromLentLog[0].intra_id, auth: 0, cabinet_id: null, - cabinet_num:null, + cabinet_num: null, location: null, section: null, floor: null, diff --git a/backend/src/v3/cabinet/cabinet.controller.ts b/backend/src/v3/cabinet/cabinet.controller.ts index d27640a..ed11056 100644 --- a/backend/src/v3/cabinet/cabinet.controller.ts +++ b/backend/src/v3/cabinet/cabinet.controller.ts @@ -1,4 +1,4 @@ -import { Controller, Get, Logger, UseGuards } from '@nestjs/common'; +import { Controller, Logger, UseGuards } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; import { JWTAuthGuard } from 'src/auth/auth.guard'; import { CabinetService } from './cabinet.service'; diff --git a/backend/src/v3/cabinet/cabinet.module.ts b/backend/src/v3/cabinet/cabinet.module.ts index d5c4bc3..6d892b1 100644 --- a/backend/src/v3/cabinet/cabinet.module.ts +++ b/backend/src/v3/cabinet/cabinet.module.ts @@ -1,17 +1,17 @@ -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"; +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({ +@Module({ imports: [AuthModule, TypeOrmModule.forFeature([Cabinet])], exports: [CabinetService], controllers: [CabinetController], diff --git a/backend/src/v3/cabinet/repository/cabinet.repository.interface.ts b/backend/src/v3/cabinet/repository/cabinet.repository.interface.ts index 46563dc..eda8920 100644 --- a/backend/src/v3/cabinet/repository/cabinet.repository.interface.ts +++ b/backend/src/v3/cabinet/repository/cabinet.repository.interface.ts @@ -1,3 +1,2 @@ -export interface ICabinetRepository { - -} +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface ICabinetRepository {} diff --git a/backend/src/v3/cabinet/repository/cabinet.repository.ts b/backend/src/v3/cabinet/repository/cabinet.repository.ts index f53db67..9e18037 100644 --- a/backend/src/v3/cabinet/repository/cabinet.repository.ts +++ b/backend/src/v3/cabinet/repository/cabinet.repository.ts @@ -1,7 +1,7 @@ -import { InjectRepository } from "@nestjs/typeorm"; -import Cabinet from "src/entities/cabinet.entity"; -import { Repository } from "typeorm"; -import { ICabinetRepository } from "./cabinet.repository.interface"; +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( diff --git a/backend/src/v3/return/repository/return.repository.interface.ts b/backend/src/v3/return/repository/return.repository.interface.ts index c3137d6..125fc17 100644 --- a/backend/src/v3/return/repository/return.repository.interface.ts +++ b/backend/src/v3/return/repository/return.repository.interface.ts @@ -1,3 +1,2 @@ -export interface IReturnRepository { - -} +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface IReturnRepository {} diff --git a/backend/src/v3/return/repository/return.repository.ts b/backend/src/v3/return/repository/return.repository.ts index 83c167c..0b2dd81 100644 --- a/backend/src/v3/return/repository/return.repository.ts +++ b/backend/src/v3/return/repository/return.repository.ts @@ -1,10 +1,10 @@ -import { InjectRepository } from "@nestjs/typeorm"; -import Cabinet from "src/entities/cabinet.entity"; -import { Repository } from "typeorm"; -import { IReturnRepository } from "./return.repository.interface"; +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, + @InjectRepository(Cabinet) private cabinetRepository: Repository, ) {} } diff --git a/backend/src/v3/return/return.controller.ts b/backend/src/v3/return/return.controller.ts index 7b47b91..eb5c0d1 100644 --- a/backend/src/v3/return/return.controller.ts +++ b/backend/src/v3/return/return.controller.ts @@ -1,8 +1,4 @@ -import { - Controller, - Logger, - UseGuards, -} from '@nestjs/common'; +import { Controller, Logger, UseGuards } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; import { JWTAuthGuard } from 'src/auth/auth.guard'; import { ReturnService } from './return.service'; diff --git a/backend/src/v3/return/return.module.ts b/backend/src/v3/return/return.module.ts index 2dfa1b9..ca18ffa 100644 --- a/backend/src/v3/return/return.module.ts +++ b/backend/src/v3/return/return.module.ts @@ -1,11 +1,11 @@ -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"; +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', diff --git a/backend/src/v3/search/repository/search.repository.interface.ts b/backend/src/v3/search/repository/search.repository.interface.ts index 67d761a..3d8fe59 100644 --- a/backend/src/v3/search/repository/search.repository.interface.ts +++ b/backend/src/v3/search/repository/search.repository.interface.ts @@ -1,3 +1,2 @@ -export interface ISearchRepository { - -} +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface ISearchRepository {} diff --git a/backend/src/v3/search/repository/search.repository.ts b/backend/src/v3/search/repository/search.repository.ts index 75313ea..30d36c3 100644 --- a/backend/src/v3/search/repository/search.repository.ts +++ b/backend/src/v3/search/repository/search.repository.ts @@ -1,9 +1,9 @@ -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"; +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( diff --git a/backend/src/v3/search/search.controller.ts b/backend/src/v3/search/search.controller.ts index 7be8322..177a115 100644 --- a/backend/src/v3/search/search.controller.ts +++ b/backend/src/v3/search/search.controller.ts @@ -1,9 +1,4 @@ -import { - Controller, - Get, - Logger, - UseGuards, -} from '@nestjs/common'; +import { Controller, Logger, UseGuards } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; import { JWTAuthGuard } from 'src/auth/auth.guard'; import { SearchService } from './search.service'; diff --git a/backend/src/v3/search/search.service.ts b/backend/src/v3/search/search.service.ts index 39058ca..f0a4a54 100644 --- a/backend/src/v3/search/search.service.ts +++ b/backend/src/v3/search/search.service.ts @@ -1,5 +1,5 @@ -import { Inject, Injectable, Logger } from "@nestjs/common"; -import { ISearchRepository } from "./repository/search.repository.interface"; +import { Inject, Injectable, Logger } from '@nestjs/common'; +import { ISearchRepository } from './repository/search.repository.interface'; @Injectable() export class SearchService { diff --git a/backend/src/v3/user/repository/user.repository.interface.ts b/backend/src/v3/user/repository/user.repository.interface.ts index ea3fa95..6514907 100644 --- a/backend/src/v3/user/repository/user.repository.interface.ts +++ b/backend/src/v3/user/repository/user.repository.interface.ts @@ -1,3 +1,2 @@ -export interface IUserRepository { - -} +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface IUserRepository {} diff --git a/backend/src/v3/user/repository/user.repository.ts b/backend/src/v3/user/repository/user.repository.ts index 0d2367c..023e4d8 100644 --- a/backend/src/v3/user/repository/user.repository.ts +++ b/backend/src/v3/user/repository/user.repository.ts @@ -1,7 +1,7 @@ -import { InjectRepository } from "@nestjs/typeorm"; -import User from "src/entities/user.entity"; -import { Repository } from "typeorm"; -import { IUserRepository } from "./user.repository.interface"; +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(