Skip to content

feat: implement growth record#14

Open
Choi-Jung-Hyeon wants to merge 7 commits intomainfrom
feat/growth-record
Open

feat: implement growth record#14
Choi-Jung-Hyeon wants to merge 7 commits intomainfrom
feat/growth-record

Conversation

@Choi-Jung-Hyeon
Copy link
Contributor

@Choi-Jung-Hyeon Choi-Jung-Hyeon commented Mar 15, 2026

💡 변경 사항

성장기록(Growth Record) 도메인의 핵심 비즈니스 로직을 전용 모듈로 분리 및 구현했습니다.

1. 성장기록 및 버전 관리 모듈 신규 구현

  • apps/api/src/growth-record 모듈을 신규 생성하여 버전 발행 및 성장기록 관련 로직을 캡슐화했습니다.
  • 기존 Project 모듈에서 버전 관련 핸들러를 이관하여 도메인 간 책임을 분리했습니다.

2. 프로젝트 버전 발행 및 조회 API (POST, GET)

  • 버전 발행: 버전명 중복 검증 및 직군 카테고리별 피드백 질문 개수(1~4개) 검증 로직을 포함합니다.
  • 티켓 보상: 새로운 버전 발행 시, 프로젝트의 모든 팀원에게 활동 보상 티켓(+1)을 트랜잭션 내에서 지급합니다.
  • 이미지 처리: S3에 저장된 이미지 Key를 조회 시점에 유효한 Presigned URL로 동적 변환하여 응답하도록 구현했습니다.

3. 피드백 채택(Adopt) 및 동적 보상 시스템

  • 피드백 채택: 팀원이 유의미한 피드백을 특정 카테고리로 채택할 수 있는 엔드포인트를 추가했습니다.
  • 조건부 티켓 지급: 채택된 피드백 작성자에게 보상을 지급하되, 한 버전 내에서 오남용을 방지하기 위한 로직을 적용했습니다.
    • 첫 번째 채택 시: 티켓 +3개
    • 두 번째 채택 시: 티켓 +2개 (합계 최대 5개 제한)
    • 세 번째 이상: 티켓 보상 없음 (+0)

4. 안정성 및 예외 처리

  • 모든 쓰기 작업(버전 발행, 티켓 지급, 채택 상태 변경)을 Prisma Transaction으로 묶어 데이터 무결성을 보장했습니다.
  • 403 Forbidden(권한), 404 Not Found(데이터 부재), 409 Conflict(중복 처리) 등 다양한 엣지 케이스에 대한 Custom Exception 처리를 완료했습니다.

💡 추가 개선 사항 (동시성 제어 및 트랜잭션 원자성 보장)

Copilot 코드 리뷰를 반영하여 잠재적인 경쟁 상태(Race Condition)를 방어하는 로직을 추가했습니다.

  • 버전명 중복 검사 로직 개선 (createVersion):
    • 기존에 트랜잭션 외부에서 수행하던 ProjectVersion 중복 검사를 Prisma $transaction 내부로 이동시켰습니다.
    • 동시에 동일한 버전명 생성 요청이 들어와도 중복 생성을 완벽히 차단하고 409 Conflict를 안전하게 반환합니다.
  • 피드백 채택 및 티켓 보상 로직 개선 (adoptFeedback):
    • 피드백 존재 여부 및 isAdopted 상태 검증 로직을 $transaction 내부로 편입했습니다.
    • 사용자가 동시에 여러 번 채택 요청을 보내더라도, 단 한 번만 채택 처리 및 티켓 보상(+3, +2)이 지급되도록 트랜잭션 원자성을 보장합니다.

Copilot AI review requested due to automatic review settings March 15, 2026 18:23
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements the Growth Record domain module with version publishing, feedback adoption, and a tiered ticket reward system.

Changes:

  • Added version name duplication check and feedback adoption endpoint with conditional ticket rewards (+3/+2/+0)
  • Extended the Feedback Prisma model with isAdopted and adoptedCategory fields
  • Created AdoptFeedbackDto and wired the new PATCH endpoint in the controller

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
growth-record.service.ts Adds version duplication check and adoptFeedback method with tiered reward logic
growth-record.controller.ts Adds PATCH …/adopt endpoint for feedback adoption
dto/adopt-feedback.dto.ts New DTO validating RecordCategory enum for adoption
schema.prisma Adds isAdopted and adoptedCategory columns to Feedback model

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@Choi-Jung-Hyeon Choi-Jung-Hyeon self-assigned this Mar 15, 2026
@Choi-Jung-Hyeon Choi-Jung-Hyeon added the enhancement New feature or request label Mar 15, 2026
@zero1177 zero1177 self-requested a review March 16, 2026 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants