Skip to content

Commit a38887e

Browse files
committed
REFACTOR : 리뷰 작성에 BadgeRepository 연결
1 parent a19eeb9 commit a38887e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/review/controller/review.controller.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
ReviewUpdateDto
1515
} from '../dto/review.dto.js'; // DTO 클래스 import
1616
import reviewService from '../service/review.service.js';
17+
import { BadgeRepository } from "../../user/repository/badge.repository.js";
1718

1819
class ReviewController {
1920

@@ -60,6 +61,9 @@ class ReviewController {
6061
// 현재 로그인한 사용자 ID (BigInt 변환)
6162
const userId = BigInt(req.user.userId);
6263

64+
// accountId 조회
65+
const accountId = BigInt(req.user.accountId);
66+
6367
// 요청 본문 데이터를 DTO 클래스로 구조화
6468
const reviewDto = new ReviewCreateDto(req.body);
6569

@@ -71,6 +75,9 @@ class ReviewController {
7175
// BigInt를 JSON 문자열로 변환 후 다시 파싱하여 일반 객체로 변환
7276
const finalData = JSON.parse(stringifyWithBigInt(responseData));
7377

78+
// 리뷰 뱃지 발급
79+
await BadgeRepository.GiveReviewBadges(userId, accountId);
80+
7481
// 클라이언트에 응답 전송 (201 Created)
7582
res.status(StatusCodes.CREATED).json({
7683
resultType: "SUCCESS",

0 commit comments

Comments
 (0)