diff --git a/src/app.module.ts b/src/app.module.ts index 79dd06d..7675f54 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -5,8 +5,8 @@ import { RedisModule } from '@liaoliaots/nestjs-redis'; import { UserModule } from './user/user.module'; import { ProfileModule } from './profile/profile.module'; import { ChatModule } from './chat/chat.module'; -import { SlackModule } from 'nestjs-slack-webhook'; -import slackConfig from './config/slack.config'; +// import { SlackModule } from 'nestjs-slack-webhook'; +// import slackConfig from './config/slack.config'; import { configDotenv } from 'dotenv'; configDotenv() @@ -18,16 +18,16 @@ configDotenv() envFilePath: `${process.cwd()}/.${process.env.NODE_ENV}.env`, cache: true, // 캐싱 isGlobal: true, // 전역 - load: [slackConfig], + load: [], // slackConfig }), - SlackModule.forRootAsync({ - imports: [ConfigModule], - inject: [ConfigService], - useFactory: async (config: ConfigService) => ({ - url: config.get('SLACK'), + // SlackModule.forRootAsync({ + // imports: [ConfigModule], + // inject: [ConfigService], + // useFactory: async (config: ConfigService) => ({ + // url: config.get('SLACK'), - }), - }), + // }), + // }), TypeOrmModule.forRoot({ // TypeORM type: 'mysql', diff --git a/src/config/slack.config.ts b/src/config/slack.config.ts index 3252e1f..78286a2 100644 --- a/src/config/slack.config.ts +++ b/src/config/slack.config.ts @@ -1,9 +1,9 @@ -import { registerAs } from "@nestjs/config"; -import { SlackOptions } from "nestjs-slack-webhook"; +// import { registerAs } from "@nestjs/config"; +// import { SlackOptions } from "nestjs-slack-webhook"; -export default registerAs( - 'slack', - (): SlackOptions => ({ - url: process.env.SLACK, - }), -); \ No newline at end of file +// export default registerAs( +// 'slack', +// (): SlackOptions => ({ +// url: process.env.SLACK, +// }), +// ); \ No newline at end of file diff --git a/src/user/user.controller.ts b/src/user/user.controller.ts index 9705a7e..8f90504 100644 --- a/src/user/user.controller.ts +++ b/src/user/user.controller.ts @@ -182,32 +182,32 @@ export class UserController { }) } - @ApiOperation({ - summary: "문의 API", - description: "불만 사항 / 업데이트 건의 / 오류 등 발생 시 문의할 수 있음" - }) - @ApiHeader({ name: "authorization", required: true }) - @ApiBody({ - type: QuestionDto, - }) - @ApiCreatedResponse({ - status: 201, - description: "문의 완료" - }) - @ApiNotFoundResponse({ - status: 404, - description: "찾을 수 없는 사용자" - }) - @Post('question') - async question(@Headers('authorization') accesstoken: string, @Body() questionDto: QuestionDto): Promise{ - const data = await this.userService.question(accesstoken, questionDto); - - return Object.assign({ - data, - statusCode: 201, - statusMsg: "문의가 완료되었습니다." - }) - } + // @ApiOperation({ + // summary: "문의 API", + // description: "불만 사항 / 업데이트 건의 / 오류 등 발생 시 문의할 수 있음" + // }) + // @ApiHeader({ name: "authorization", required: true }) + // @ApiBody({ + // type: QuestionDto, + // }) + // @ApiCreatedResponse({ + // status: 201, + // description: "문의 완료" + // }) + // @ApiNotFoundResponse({ + // status: 404, + // description: "찾을 수 없는 사용자" + // }) + // @Post('question') + // async question(@Headers('authorization') accesstoken: string, @Body() questionDto: QuestionDto): Promise{ + // const data = await this.userService.question(accesstoken, questionDto); + + // return Object.assign({ + // data, + // statusCode: 201, + // statusMsg: "문의가 완료되었습니다." + // }) + // } @ApiOperation({ summary: "리프레시 토큰 검증", diff --git a/src/user/user.service.ts b/src/user/user.service.ts index 7800620..7f5b33e 100644 --- a/src/user/user.service.ts +++ b/src/user/user.service.ts @@ -271,63 +271,63 @@ export class UserService { * * 문의하기 */ - async question(accesstoken: string, question: QuestionDto): Promise { - const webhook = new IncomingWebhook(process.env.SLACK); // 웹훅 생성 - - const { userID } = await this.validateAccess(accesstoken); // 액세스 토큰 검증 - - const thisUser = await this.userEntity.findOneBy({ userID }); // 유저 찾기 - - if (!thisUser) throw new NotFoundException(); // 없으면 NotFoundException - - const thisQuestion = await this.questionEntity.save({ - userID, - user: thisUser, - title: question.title, - content: question.content - }) - - const payload = { - "attachments": [ - { - "blocks": [ - { - "type": "header", - "text": { - "type": "plain_text", - "text": question.title - } - }, - { - "type": "divider" - }, - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": question.content - }, - }, - { - "type": "divider" - }, - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": `*date*:${Date.now().toString()}\n*userID*: ${userID}\n*userName*: ${thisUser.name}\n*userEmail*: ${thisUser.email}` - } - }, - { - "type": "divider" - } - ] - } - ] - } - - await webhook.send(payload); - - return thisQuestion; - } + // async question(accesstoken: string, question: QuestionDto): Promise { + // const webhook = new IncomingWebhook(process.env.SLACK); // 웹훅 생성 + + // const { userID } = await this.validateAccess(accesstoken); // 액세스 토큰 검증 + + // const thisUser = await this.userEntity.findOneBy({ userID }); // 유저 찾기 + + // if (!thisUser) throw new NotFoundException(); // 없으면 NotFoundException + + // const thisQuestion = await this.questionEntity.save({ + // userID, + // user: thisUser, + // title: question.title, + // content: question.content + // }) + + // const payload = { + // "attachments": [ + // { + // "blocks": [ + // { + // "type": "header", + // "text": { + // "type": "plain_text", + // "text": question.title + // } + // }, + // { + // "type": "divider" + // }, + // { + // "type": "section", + // "text": { + // "type": "mrkdwn", + // "text": question.content + // }, + // }, + // { + // "type": "divider" + // }, + // { + // "type": "section", + // "text": { + // "type": "mrkdwn", + // "text": `*date*:${Date.now().toString()}\n*userID*: ${userID}\n*userName*: ${thisUser.name}\n*userEmail*: ${thisUser.email}` + // } + // }, + // { + // "type": "divider" + // } + // ] + // } + // ] + // } + + // await webhook.send(payload); + + // return thisQuestion; + // } } \ No newline at end of file