diff --git a/src/tag-log-v3/dto/UserMonthlyInOutLogs.type.ts b/src/tag-log-v3/dto/UserMonthlyInOutLogs.type.ts index dbe377a..a8f484f 100644 --- a/src/tag-log-v3/dto/UserMonthlyInOutLogs.type.ts +++ b/src/tag-log-v3/dto/UserMonthlyInOutLogs.type.ts @@ -4,13 +4,13 @@ import { InOutLogType } from './subType/InOutLog.type'; export class UserMonthlyInOutLogsType { @ApiProperty({ description: '42 로그인 ID', - example: 'joopark', + example: 'wchae', }) login: string; @ApiProperty({ description: '인트라 이미지 URI', - example: 'https://cdn.intra.42.fr/users/joopark.jpg', + example: 'https://cdn.intra.42.fr/users/wchae.jpg', }) profileImage: string; diff --git a/src/tag-log-v3/dto/info-message.dto.ts b/src/tag-log-v3/dto/info-message.dto.ts new file mode 100644 index 0000000..54634c2 --- /dev/null +++ b/src/tag-log-v3/dto/info-message.dto.ts @@ -0,0 +1,10 @@ + +export class InfoMessageDto { + title: string | null; + content: string | null; + + constructor(title: string | null, content: string | null) { + this.title = title; + this.content = content; + } +} \ No newline at end of file diff --git a/src/tag-log-v3/dto/user-Info.type.ts b/src/tag-log-v3/dto/user-Info.type.ts index 55d33a6..8f46bd3 100644 --- a/src/tag-log-v3/dto/user-Info.type.ts +++ b/src/tag-log-v3/dto/user-Info.type.ts @@ -1,16 +1,17 @@ import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; import InOut from 'src/enums/inout.enum'; +import { InfoMessageDto } from './info-message.dto'; export class UserInfoType { @ApiProperty({ description: '42 로그인 ID', - example: 'joopark', + example: 'wchae', }) login: string; @ApiProperty({ description: '인트라 이미지 URI', - example: 'https://cdn.intra.42.fr/users/joopark.jpg', + example: 'https://cdn.intra.42.fr/users/wchae.jpg', }) profileImage: string; @@ -27,10 +28,19 @@ export class UserInfoType { gaepo?: number; @ApiPropertyOptional({ - description: '서초 체류인원 (Optional)', - example: 42, + description: '안내 메세지(Optional)', + example: [ + { + title: "제목", + content: "메세지" + }, + { + title: "제목", + content: "메세지" + }, + ], }) - seocho?: number; + infoMessages? : InfoMessageDto[]; @ApiProperty({ description: '본인의 클러스터 체류 여부', diff --git a/src/tag-log-v3/tag-log-v3.controller.ts b/src/tag-log-v3/tag-log-v3.controller.ts index c9c9566..7f6f3cf 100644 --- a/src/tag-log-v3/tag-log-v3.controller.ts +++ b/src/tag-log-v3/tag-log-v3.controller.ts @@ -28,6 +28,8 @@ import { CadetPerClusterDto } from 'src/statistics/dto/cadet-per-cluster.dto'; import { InOutLogPerDay, groupLogsByDay } from './dto/subType/InOutLogPerDay.type'; import { UserMonthlyInOutLogsType } from './dto/UserMonthlyInOutLogs.type'; import { TWELVE_HOURS_IN_SECONDS } from 'src/utils/common.constants'; +import { InfoMessageDto } from './dto/info-message.dto'; +import { MessageGenerator } from 'src/utils/message-generator.component'; @ApiTags('체류 시간 산출 v3') @Controller({ @@ -42,6 +44,7 @@ export class TagLogController { constructor( private tagLogService: TagLogService, private statisticsService: StatisticsService, + private messageGenerator: MessageGenerator, @Inject(CACHE_MANAGER) private cacheManager: Cache, ) {} @@ -140,7 +143,11 @@ export class TagLogController { await this.cacheManager.set('getCadetPerCluster', cadetPerCluster, 60); } const gaepo = +cadetPerCluster.find((v) => v.cluster === 'GAEPO')?.cadet; - const seocho = +cadetPerCluster.find((v) => v.cluster === 'SEOCHO')?.cadet; + // const seocho = +cadetPerCluster.find((v) => v.cluster === 'SEOCHO')?.cadet; + + const infoMessages: InfoMessageDto[] = []; + infoMessages.push(this.messageGenerator.generateInfoMessage()); + const result: UserInfoType = { login: user.login, profileImage: user.image_url, @@ -148,7 +155,8 @@ export class TagLogController { inoutState: inoutState.inout, tagAt: inoutState.log, gaepo: gaepo ? gaepo : 0, - seocho: seocho ? seocho : 0, + // seocho: seocho ? seocho : 0, + infoMessages: infoMessages, }; return result; } diff --git a/src/utils/common.constants.ts b/src/utils/common.constants.ts index 8e03058..7758a7c 100644 --- a/src/utils/common.constants.ts +++ b/src/utils/common.constants.ts @@ -1,2 +1,5 @@ export const TWELVE_HOURS_IN_SECONDS = 12 * 60 * 60; -export const ONE_DAY_IN_SECONDS = 24 * 60 * 60; \ No newline at end of file +export const ONE_DAY_IN_SECONDS = 24 * 60 * 60; + +export const INFO_MESSAGE_TITLE = "인정 시간은 지원금 정책에 반영되는 시간입니다."; +export const INFO_MESSAGE_CONTENT = "1일 최대 12시간"; \ No newline at end of file diff --git a/src/utils/message-generator.component.ts b/src/utils/message-generator.component.ts new file mode 100644 index 0000000..47b15b0 --- /dev/null +++ b/src/utils/message-generator.component.ts @@ -0,0 +1,15 @@ +import { Injectable, Logger } from "@nestjs/common"; +import { InfoMessageDto } from "src/tag-log-v3/dto/info-message.dto"; + +@Injectable() +export class MessageGenerator { + // private logger = new Logger(MessageGenerator.name); + + generateInfoMessage(): InfoMessageDto { + const INFO_MESSAGE_TITLE: string = "인정 시간은 지원금 정책에 반영되는 시간입니다."; + const INFO_MESSAGE_CONTENT: string = "1일 최대 12시간"; + const infoMessage = new InfoMessageDto(INFO_MESSAGE_TITLE, INFO_MESSAGE_CONTENT); + return infoMessage; + } + +} \ No newline at end of file diff --git a/src/utils/utils.module.ts b/src/utils/utils.module.ts index 788a2b7..ee619ca 100644 --- a/src/utils/utils.module.ts +++ b/src/utils/utils.module.ts @@ -1,9 +1,10 @@ import { Module } from '@nestjs/common'; import { DateCalculator } from './date-calculator.component'; import { GoogleApi } from './google-api.component'; +import { MessageGenerator } from './message-generator.component'; @Module({ - providers: [DateCalculator, GoogleApi], - exports: [DateCalculator, GoogleApi], + providers: [DateCalculator, GoogleApi, MessageGenerator], + exports: [DateCalculator, GoogleApi, MessageGenerator], }) export class UtilsModule {}