diff --git a/src/modules/generation/service/generation.service.ts b/src/modules/generation/service/generation.service.ts index f62fba0..4c904cd 100644 --- a/src/modules/generation/service/generation.service.ts +++ b/src/modules/generation/service/generation.service.ts @@ -1,4 +1,4 @@ -import { Injectable } from '@nestjs/common'; +import { HttpException, HttpStatus, Injectable } from '@nestjs/common'; import * as moment from 'moment'; import { Generations } from 'src/infra/entity/Generations.entity'; import { DeleteResult, UpdateResult } from 'typeorm'; @@ -57,6 +57,13 @@ export class GenerationService { currentGenerationState.isActive = true; } + if ( + !currentGenerationState.isApplying && + !currentGenerationState.isActive + ) { + throw new HttpException('활동 기수가 없습니다.', HttpStatus.NOT_FOUND); + } + return { ...currentGeneration, ...currentGenerationState }; }