-
Notifications
You must be signed in to change notification settings - Fork 3
[Refactor][jjaeroong]: 팟 시작 날짜/ 종료 날짜 형식 수정(모집 중/끓인 팟),유저 닉네임 생성 시 씨앗과 함께 응답 및 팟 이름 수정 API 변경 #420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
[Fix][jjaeroong]:회원 탈퇴 시 사용자 정보가 삭제되지 않는 버그 수정
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughPot 이름 변경 엔드포인트를 PotController에서 MyPotController로 이동. 날짜 유틸(DateFormatter) 추가 및 Pot 관련 변환기들이 시작/종료일을 문자열 포맷으로 반환하도록 변경. PotMember DTO/컨버터에서 kakaoId 제거. PotRequestDto에 @Schema 주석 추가 및 potStatus → potModeOfOperation 교체. 닉네임에 " 새싹" 접미사 추가. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant C as 클라이언트
participant MC as MyPotController
participant S as PotCommandService
participant R as PotRepository
C->>MC: PATCH /my-pots/{pot_id}/rename (PotNameUpdateRequestDto)
MC->>S: updatePotName(pot_id, request)
S->>R: findById(pot_id)
R-->>S: Pot entity
S->>R: save(updated Pot)
R-->>S: saved Pot
S-->>MC: 결과 문자열
MC-->>C: ApiResponse<String>
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Poem
✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🔭 Outside diff range comments (2)
src/main/java/stackpot/stackpot/pot/dto/PotRequestDto.java (1)
1-50: 레거시 potStatus 참조 전역 정리 필요PotRequestDto 에서 potStatus 필드를 제거했으므로, 아래 위치에 남아있는 potStatus 참조를 전부 제거하거나 새로운 상태 관리 로직으로 대체해야 합니다.
• 서비스 레이어
– PotApplicationQueryServiceImpl:if ("RECRUITING".equals(pot.getPotStatus()))
– PotMemberCommandServiceImpl:pot.setPotStatus("ONGOING")
– PotCommandServiceImpl: 초기 상태 부여(pot.setPotStatus("RECRUITING")),updateValues.put("potStatus", "COMPLETED")
– MyPotServiceImpl: 상태 검증 및 필터("COMPLETED".equals(pot.getPotStatus()), switch문)
– UserCommandServiceImpl: 삭제 알림 조건(pot.getPotStatus().equals("ONGOING"))
– PotQueryServiceImpl: isMember 판별("COMPLETED".equals(pot.getPotStatus()))• 리포지토리
– PotRepository 내findByUserIdAndPotStatus, JPQL 쿼리의p.potStatus사용• 엔티티
– Pot.java:private String potStatus;, updateFields 매핑(case "potStatus")• 컨버터/DTO
– PotDetailConverter, MyPotConverter, PotConverter 등에서.potStatus(...)호출
– PotResponseDto, PotDetailResponseDto, OngoingPotResponseDto, AppliedPotResponseDto 등potStatus필드• 컨트롤러
– UserController, PotController:@RequestParam(name = "potStatus"), API 문서 설명 내 potStatus위 모든 위치를 점검 및 수정하고, 빌드·테스트·Swagger 문서 확인을 통해 모든 potStatus 참조가 제거되었는지 검증해주세요.
src/main/java/stackpot/stackpot/pot/converter/PotDetailConverter.java (1)
43-44: 닉네임에 ‘ 새싹’ 직접 덧붙이기 → 중복 표기 방지 가드 필요DB에 ‘… 새싹’이 저장될 수 있으므로(상세는 UserCommandServiceImpl 리뷰 참조), 여기서 무조건 ' 새싹'을 추가하면 ‘… 새싹 새싹’이 될 수 있습니다. 안전 가드를 두거나 표시 전용 유틸을 사용하세요.
예:
String displayNickname = user.getNickname(); if (!displayNickname.endsWith("새싹")) { displayNickname += " 새싹"; } ... .userNickname(displayNickname)또는 공용 유틸(예: NameFormatter.appendSeedSuffixIfMissing(String))로 중복 로직을 제거해 전역 일관성을 유지하는 것도 좋습니다.
🧹 Nitpick comments (9)
src/main/java/stackpot/stackpot/pot/dto/PotRequestDto.java (2)
23-27: 요청 DTO의 날짜 형식 유효성 검증 추가 제안(@pattern)potStartDate/potEndDate는 yyyy.MM 형식을 요구하므로, 입력 검증을 DTO 수준에서 보장하면 다운스트림 포맷팅/파싱 실패를 줄일 수 있습니다.
아래와 같이 정규식 검증을 추가하는 것을 제안합니다:
import io.swagger.v3.oas.annotations.media.Schema; import jakarta.persistence.Column; import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Pattern; ... - @Schema(description = "팟 시작 날짜 (yyyy.MM)", example = "2025.08") + @Schema(description = "팟 시작 날짜 (yyyy.MM)", example = "2025.08") + @Pattern(regexp = "^(19|20)\\d{2}\\.(0[1-9]|1[0-2])$", message = "yyyy.MM 형식이어야 합니다.") private String potStartDate; - @Schema(description = "팟 종료 날짜 (yyyy.MM)", example = "2025.10") + @Schema(description = "팟 종료 날짜 (yyyy.MM)", example = "2025.10") + @Pattern(regexp = "^(19|20)\\d{2}\\.(0[1-9]|1[0-2])$", message = "yyyy.MM 형식이어야 합니다.") private String potEndDate;
42-44: 운영 방식 필드 String → PotModeOfOperation Enum으로 변경 제안DTO의 potModeOfOperation 필드를 String에서 실제 Enum 타입으로 변경하면
컴파일/바인딩 단계에서 잘못된 입력을 차단하고, 매퍼/서비스 로직을 단순화할 수 있습니다.
- 사용 가능한 Enum:
src/main/java/stackpot/stackpot/pot/entity/enums/PotModeOfOperation.javapublic enum PotModeOfOperation { ONLINE, OFFLINE, HYBRID }- 변경 예시:
- @Schema(description = "운영 방식", example = "ONLINE") - private String potModeOfOperation; + @Schema(description = "운영 방식", example = "ONLINE") + private PotModeOfOperation potModeOfOperation;- import 추가:
import stackpot.stackpot.pot.entity.enums.PotModeOfOperation;src/main/java/stackpot/stackpot/common/util/DateFormatter.java (1)
24-32: format(String): 입력/출력 규약 명확화 필요(Null/N/A 혼용)
- format(String)은 null/blank 입력에 null을 반환하지만, 기존 dotFormatter(LocalDate)는 "N/A"를 반환합니다. 동일 도메인의 포맷터가 서로 다른 널 처리 규약을 가지면 DTO/뷰에서 조건 분기가 늘어납니다.
- 코드 자체는 견고하지만, 반환 규약을 문서화(JavaDoc)하거나, 일관된 정책(예: 모두 null 반환)을 채택하는 것을 권장합니다.
src/main/java/stackpot/stackpot/pot/converter/PotDetailConverter.java (1)
49-49: 중복 세터 호출: potRecruitmentDeadline가 두 번 설정됨Builder 체인에서 potRecruitmentDeadline가 2회 호출됩니다(라인 49, 58). 동작상 문제는 없으나 불필요하며 리뷰어/유지보수자 혼란을 야기할 수 있습니다. 하나를 제거하세요.
예시(라인 58 제거):
- .isSaved(isSaved) - .potRecruitmentDeadline(pot.getPotRecruitmentDeadline()) + .isSaved(isSaved)Also applies to: 58-58
src/main/java/stackpot/stackpot/pot/controller/MyPotController.java (1)
86-94: @PathVariable 네이밍 및 바인딩 안정화 필요
MyPotController.updatePotName API에서 다음 사항을 반영해주세요:
명시적 매핑과 camelCase 변수명 사용
@PatchMapping("/{pot_id}/rename") public ResponseEntity<ApiResponse<String>> updatePotName( - @PathVariable Long pot_id, + @PathVariable("pot_id") Long potId, @Valid @RequestBody PotNameUpdateRequestDto request ) { String res = potCommandService.updatePotName(potId, request); return ResponseEntity.ok(ApiResponse.onSuccess(res)); }Service 레벨 검증
- 소유자 체크(
pot.getUser().equals(user))는 이미 구현되어 있습니다.- 완료된 팟에 대한 이름 변경 허용 여부가 비즈니스 요구사항이라면,
pot.getStatus()등을 확인해 추가 검증 로직을 넣거나 API 문서에 명시해주세요.API 이동에 따른 클라이언트·문서 업데이트 여부도 함께 확인해 주시기 바랍니다.
src/main/java/stackpot/stackpot/pot/controller/PotController.java (1)
39-41: 요청 스키마 유효성(yyyy.MM)와 서버 포맷 일관성 확인 필요API 문서에 potStartDate/potEndDate가 yyyy.MM 형식이라 명시되어 있습니다. 요청 DTO(PotRequestDto)에서 @pattern 같은 검증이 적용되어 있는지, 그리고 하위 계층(Converter/Entity)에서 해당 형식이 일관되게 처리되는지 확인이 필요합니다.
권장:
- PotRequestDto 필드에 정규식 검증 추가: ^\d{4}\.\d{2}$
- 응답 포맷을 월 단위로 통일하려면 Converter에서 DateFormatter.formatToMonth(...)를 사용해 yyyy.MM으로 일관되게 반환하도록 조정(아래 PotConverter 코멘트 참고).
src/main/java/stackpot/stackpot/pot/converter/PotConverter.java (3)
48-49: 모집 중 화면의 목표 포맷이 월 단위(yyyy.MM)라면 formatToMonth(...) 사용 권장현재 DateFormatter.format(...)은 yyyy.MM.dd를 지향합니다. PR 제목/설명에 따르면 시작/종료일 표기를 월 단위로 통일하려는 의도가 있어 보입니다.
의도가 yyyy.MM 통일이라면 아래처럼 변경하세요.
- .potStartDate(DateFormatter.format(entity.getPotStartDate())) - .potEndDate(DateFormatter.format(entity.getPotEndDate())) + .potStartDate(DateFormatter.formatToMonth(entity.getPotStartDate())) + .potEndDate(DateFormatter.formatToMonth(entity.getPotEndDate()))참고: formatToMonth는 yyyy-MM-dd 입력을 yyyy.MM으로 변환하고, 파싱 실패 시 원문을 그대로 반환하므로 과거 데이터(yyyy-MM-dd)와 신규 데이터(yyyy.MM)가 섞여 있어도 출력은 yyyy.MM으로 수렴됩니다.
97-98: 끓인 팟(완료) 화면도 월 단위 포맷 통일 권장완료된 팟 응답에서도 동일한 포맷을 유지하는 것이 사용자 경험에 좋습니다.
아래처럼 수정 제안:
- .potStartDate(DateFormatter.format(pot.getPotStartDate())) - .potEndDate(DateFormatter.format(pot.getPotEndDate())) + .potStartDate(DateFormatter.formatToMonth(pot.getPotStartDate())) + .potEndDate(DateFormatter.formatToMonth(pot.getPotEndDate()))
27-27: 사소한: 중복 import 및 오탈자 존재이 파일에는 java.util.List가 중복 import되어 있고(toPrviewDto 메서드명 오탈자) 가독성에 영향을 줍니다. 이번 변경 범위는 아니지만 다음 정리 때 함께 수정하면 좋겠습니다.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (10)
src/main/java/stackpot/stackpot/common/util/DateFormatter.java(2 hunks)src/main/java/stackpot/stackpot/pot/controller/MyPotController.java(2 hunks)src/main/java/stackpot/stackpot/pot/controller/PotController.java(1 hunks)src/main/java/stackpot/stackpot/pot/controller/PotMemberController.java(1 hunks)src/main/java/stackpot/stackpot/pot/converter/PotConverter.java(3 hunks)src/main/java/stackpot/stackpot/pot/converter/PotDetailConverter.java(1 hunks)src/main/java/stackpot/stackpot/pot/converter/PotMemberConverter.java(0 hunks)src/main/java/stackpot/stackpot/pot/dto/PotMemberInfoResponseDto.java(0 hunks)src/main/java/stackpot/stackpot/pot/dto/PotRequestDto.java(2 hunks)src/main/java/stackpot/stackpot/user/service/UserCommandServiceImpl.java(1 hunks)
💤 Files with no reviewable changes (2)
- src/main/java/stackpot/stackpot/pot/dto/PotMemberInfoResponseDto.java
- src/main/java/stackpot/stackpot/pot/converter/PotMemberConverter.java
🧰 Additional context used
🧬 Code Graph Analysis (2)
src/main/java/stackpot/stackpot/pot/converter/PotConverter.java (1)
src/main/java/stackpot/stackpot/common/util/DateFormatter.java (1)
DateFormatter(7-47)
src/main/java/stackpot/stackpot/pot/dto/PotRequestDto.java (1)
src/main/java/stackpot/stackpot/user/dto/request/UserRequestDto.java (1)
Schema(12-24)
🔇 Additional comments (6)
src/main/java/stackpot/stackpot/pot/controller/PotMemberController.java (1)
28-28: OpenAPI 요약 문구 업데이트 적절DTO/컨버터에서 KakaoId 노출 제거와 문서 일관성이 맞습니다. 기능 영향도 없고 명확합니다.
src/main/java/stackpot/stackpot/pot/dto/PotRequestDto.java (1)
19-21: 스키마 메타데이터 추가는 문서 품질 향상에 도움필드별 @Schema 예시/설명 추가로 OpenAPI 문서가 명확해졌습니다. 런타임 동작에는 영향이 없고, 클라이언트 통합 시 실수를 줄이는 데 유용합니다.
Also applies to: 23-27, 29-31, 35-37, 39-41, 45-47, 48-50
src/main/java/stackpot/stackpot/common/util/DateFormatter.java (1)
34-43: 월 단위 포맷팅 로직은 목적에 부합(yyyy.MM로 안정 변환)입력이 "yyyy-MM-dd"면 yyyy.MM로 변환, 그 외(예: 이미 yyyy.MM)면 원본 유지 전략이어서, PR의 “문자열 기반 월 단위 표기” 목표와 잘 맞습니다.
src/main/java/stackpot/stackpot/pot/converter/PotDetailConverter.java (1)
47-48: yyyy.MM 포맷 적용은 의도와 일치DateFormatter.formatToMonth(...)로 월 단위 표기를 보장해 응답 일관성을 높였습니다. 입력이 이미 yyyy.MM이어도 원본 유지 전략이라 회귀 위험도 낮습니다.
src/main/java/stackpot/stackpot/pot/controller/MyPotController.java (2)
5-5: 유효성 검증 import 추가 적절요청 본문 검증을 위해 jakarta.validation.Valid 추가는 적절합니다.
13-13: 요청 DTO import 추가 적절PotNameUpdateRequestDto를 사용하는 변경과 일치합니다.
| .potStartDate(String.valueOf(requestDto.getPotStartDate())) | ||
| .potEndDate(String.valueOf(requestDto.getPotEndDate())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String.valueOf(...)는 null을 "null" 문자열로 저장 — 데이터 오염 가능성
requestDto의 값이 null일 때 "null"이라는 문자열이 엔티티에 저장됩니다. 이는 후속 포맷팅/조회 시 예기치 않은 동작을 야기합니다.
아래처럼 null-안전하게 직접 할당하세요(요청 DTO 타입이 String이라면 단순 대입, YearMonth/LocalDate라면 명시적 포맷터로 변환).
- .potStartDate(String.valueOf(requestDto.getPotStartDate()))
- .potEndDate(String.valueOf(requestDto.getPotEndDate()))
+ .potStartDate(requestDto.getPotStartDate())
+ .potEndDate(requestDto.getPotEndDate())추가 권장:
- 이미 "null" 문자열이 저장된 레코드가 있을 수 있으니, 마이그레이션으로 해당 값을 실제 NULL로 정정하는 작업도 고려하세요.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| .potStartDate(String.valueOf(requestDto.getPotStartDate())) | |
| .potEndDate(String.valueOf(requestDto.getPotEndDate())) | |
| .potStartDate(requestDto.getPotStartDate()) | |
| .potEndDate(requestDto.getPotEndDate()) |
🤖 Prompt for AI Agents
In src/main/java/stackpot/stackpot/pot/converter/PotConverter.java around lines
33–34, using String.valueOf(requestDto.getPotStartDate()) and
String.valueOf(requestDto.getPotEndDate()) will store the literal "null" when
the DTO values are null; change these assignments to be null-safe: if the DTO
fields are already String assign them directly (requestDto.getPotStartDate()),
otherwise if they are YearMonth/LocalDate convert using an explicit
DateTimeFormatter and handle null by keeping the target field null (e.g., field
= dto == null ? null : formatter.format(dto)); also consider adding a data
migration to replace any existing "null" string values in the database with
actual NULLs.
PR 타입(하나 이상의 PR 타입을 선택해주세요)
반영 브랜치
ex) feat/login -> dev
작업 내용
ex) 로그인 시, 구글 소셜 로그인 기능을 추가했습니다.
테스트 결과
ex) 베이스 브랜치에 포함되기 위한 코드는 모두 정상적으로 동작해야 합니다. 결과물에 대한 스크린샷, GIF, 혹은 라이브
Summary by CodeRabbit
New Features
Refactor
Documentation