[YS-505] feature: 공고 등록, 공고 목록 조회 시 '교내 실험 여부' 필드 추가#166
Conversation
Walkthrough실험 게시물에 isOnCampus:Boolean 필드를 추가하고 요청 DTO → 매퍼 → 유스케이스 입력/출력 → 도메인 팩토리 → 엔티티로 값을 전달·매핑하도록 코드와 테스트들을 갱신했습니다. 공개 생성자/팩토리/메서드 시그니처에 isOnCampus가 추가되었습니다. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Client
participant API as Controller/API
participant Mapper as ExperimentPostMapper
participant UC as CreateExperimentPostUseCase
participant Domain as ExperimentPost (domain)
participant Repo as Repository/Entity
Client->>API: POST /experiments (body includes isOnCampus)
API->>Mapper: toCreatePostUseCaseInput(request with isOnCampus)
Mapper-->>UC: Input(..., isOnCampus)
UC->>Domain: newExperimentPost(..., isOnCampus)
Domain-->>UC: ExperimentPost{ isOnCampus }
UC->>Repo: save(ExperimentPost)
Repo-->>UC: saved entity
UC-->>API: Output.PostInfo(isOnCampus)
API-->>Client: 201 Created (response includes isOnCampus)
rect rgba(50,130,200,0.08)
note right of Domain: 도메인 모델에 isOnCampus 설정
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the ✨ 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
presentation/src/main/kotlin/com/dobby/api/mapper/ExperimentPostMapper.kt (2)
388-416: 요구사항 미반영: 목록 조회 응답에 ‘교내 실험 여부’ 누락PR 목적에는 “공고 목록 조회 시 ‘교내 실험 여부’ 필드 추가”가 포함되지만, 리스트 매핑(ExperimentPostResponse.PostInfo)에는 미포함입니다.
아래와 같이 매퍼/DTO/유즈케이스 출력에 필드를 전파해 주세요(예시).
ExperimentPostResponse( postInfo = PostInfo( experimentPostId = post.postInfo.experimentPostId, title = post.postInfo.title, views = post.postInfo.views, place = post.postInfo.place, + isOnCampus = post.postInfo.isOnCampus, reward = post.postInfo.reward,추가로 필요한 변경:
- com.dobby.api.dto.response.experiment.PostInfo에 val isOnCampus: Boolean 추가
- GetExperimentPostsUseCase.Output.PostInfo(또는 동등 타입)에 isOnCampus 추가 및 도메인->출력 매핑 보강
원하시면 연쇄 수정 패치 제안 드립니다.
46-47: 응답 DTO 매핑에 isOnCampus 누락
- toCreatePostInfo(PostInfo) 및 ExperimentPostResponse 매핑에 isOnCampus 추가
- toGetExperimentPostDetailResponse(ExperimentPostDetailResponse) 매핑에 isOnCampus 반영
- toExperimentPostResponse(MyExperimentPostResponse) 매핑에 isOnCampus 포함
🧹 Nitpick comments (7)
domain/src/main/kotlin/com/dobby/model/experiment/ExperimentPost.kt (4)
35-35: isOnCampus 널 허용 → 비널로 일관성 맞추기 제안프리젠테이션/유즈케이스 계층은 Boolean(비널)인데 도메인만 Boolean? 입니다. 계층 간 계약 불일치가 NPE/검증 누락을 유발할 수 있습니다.
다음과 같이 타입만 비널로 통일하는 것을 권장합니다.
- var isOnCampus: Boolean?, + var isOnCampus: Boolean,
144-171: ONLINE 매칭 시 isOnCampus=true 조합 방지 검증 추가 필요 여부 확인온라인(비대면)이라면 ‘교내 실험 여부’가 true인 조합은 모순일 수 있습니다. 요구사항에 따라 금지해야 한다면 아래와 같이 팩토리에서 즉시 검증을 추가하는 것이 안전합니다.
fun newExperimentPost( @@ images: List<ExperimentImage> = listOf() ): ExperimentPost { validate(title, reward, content, leadResearcher, matchType, place, region, area, count, images = images.map { it.imageUrl }) + if (matchType == MatchType.ONLINE && isOnCampus) { + throw ExperimentPostInvalidOnlineRequestException + }요구사항상 허용이라면 무시해도 됩니다. 결정만 확인 부탁드립니다.
61-118: isOnCampus 업데이트 경로 부재 — 업데이트 가능 여부 확인update(...)에 isOnCampus 파라미터가 없어 생성 후 수정이 불가합니다. 수정 불가 정책이면 그대로, 수정 가능해야 한다면 파라미터 및 copy 반영이 필요합니다.
원하시면 해당 변경에 맞춘 mapper/DTO까지 일괄 패치 제안 드리겠습니다.
155-180: DB 마이그레이션 및 기본값 전략 점검인프라 계층에 is_on_campus 컬럼 추가가 필요합니다. 운영 중 스키마 변경 시:
- 기본값/널 전략(Boolean NOT NULL DEFAULT false vs NULL 허용) 결정
- 기존 데이터 백필 계획
- 읽기 경로 캐시/인덱스 영향(필터링/집계에 사용할 예정인지) 검토
필요하면 Flyway/Liquibase 마이그레이션 스크립트 초안 만들어 드릴게요.
presentation/src/main/kotlin/com/dobby/api/dto/request/experiment/CreateExperimentPostRequest.kt (1)
22-22: API 호환성 확인: isOnCampus 필드 필수화기존 클라이언트가 필드를 보내지 않으면 400이 될 수 있습니다. 단계적 롤아웃이면 기본값을 두는 방안도 고려해 주세요.
- val isOnCampus: Boolean, + val isOnCampus: Boolean = false,프론트/문서(Swagger) 반영 일정도 함께 확인 부탁드립니다.
presentation/src/main/kotlin/com/dobby/api/mapper/ExperimentPostMapper.kt (1)
151-173: 업데이트 API에 isOnCampus 없음 — 정책 확인UpdateExperimentPostUseCase.Input/매퍼에도 isOnCampus가 없습니다. 수정 불가 정책인지 확인 부탁드립니다. 수정 가능이라면 필드/매핑 추가가 필요합니다.
원하시면 관련 테스트 케이스도 함께 보강해 드리겠습니다.
application/src/test/kotlin/com/dobby/usecase/experiment/CreateExperimentPostUseCaseTest.kt (1)
171-203: isOnCampus 의미론 테스트 추가 제안ONLINE 설정 시(isOnCampus=true/false 조합 등) 허용/금지 규칙이 있다면 별도 테스트로 명시해 주세요. 현재는 “온라인+지역 정보”만 검증 중입니다.
원하시면 케이스 초안 드리겠습니다.
📜 Review details
Configuration used: CodeRabbit UI
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 (7)
application/src/main/kotlin/com/dobby/usecase/experiment/CreateExperimentPostUseCase.kt(2 hunks)application/src/test/kotlin/com/dobby/usecase/experiment/CreateExperimentPostUseCaseTest.kt(3 hunks)application/src/test/kotlin/com/dobby/usecase/experiment/GetExperimentPostApplyMethodUseCaseTest.kt(1 hunks)domain/src/main/kotlin/com/dobby/model/experiment/ExperimentPost.kt(3 hunks)infrastructure/src/main/kotlin/com/dobby/persistence/entity/experiment/ExperimentPostEntity.kt(3 hunks)presentation/src/main/kotlin/com/dobby/api/dto/request/experiment/CreateExperimentPostRequest.kt(1 hunks)presentation/src/main/kotlin/com/dobby/api/mapper/ExperimentPostMapper.kt(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build
🔇 Additional comments (7)
application/src/test/kotlin/com/dobby/usecase/experiment/GetExperimentPostApplyMethodUseCaseTest.kt (1)
55-55: LGTM: 테스트 픽스처에 isOnCampus 추가 적절목표 검증 대상(applyMethod)과 독립적이며, 도메인 생성자 변경을 정확히 반영했습니다.
presentation/src/main/kotlin/com/dobby/api/mapper/ExperimentPostMapper.kt (1)
56-56: LGTM: 생성 입력 매핑에 isOnCampus 전달 추가CreateExperimentPostUseCase.Input으로 정확히 전달됩니다.
application/src/test/kotlin/com/dobby/usecase/experiment/CreateExperimentPostUseCaseTest.kt (1)
69-69: LGTM: 생성 유즈케이스 입력에 isOnCampus 추가 적절세 시나리오 모두 입력 스키마 변경을 정확히 반영했습니다.
Also applies to: 135-135, 193-193
application/src/main/kotlin/com/dobby/usecase/experiment/CreateExperimentPostUseCase.kt (1)
120-121: 검증 완료:newExperimentPost에isOnCampus파라미터가 포함되어 있어 전달 로직에 문제가 없습니다.infrastructure/src/main/kotlin/com/dobby/persistence/entity/experiment/ExperimentPostEntity.kt (3)
144-144: toDomain 매핑 적합엔티티 → 도메인 매핑에
isOnCampus가 누락 없이 전달됩니다.
173-173: fromDomain 매핑 적합도메인 → 엔티티 매핑에도
isOnCampus가 일관되게 포함됩니다.
73-75: 엔티티 필드isOnCampusnon-nullable 전환 권장 및 필터/정렬 사용 여부 재검증 필요
Boolean?대신Boolean+nullable = false전환을 위해 백필(backfill) → NOT NULL 계획 수립- 향후 조회·필터·정렬 시 애매모호성 제거를 위해 인덱스 추가 고려
- 레포지토리·쿼리에서 해당 필드(
isOnCampus)로 실제 필터링·정렬 사용 여부를 수동으로 재검증하세요- @Column(name = "is_on_campus") - var isOnCampus: Boolean?, + @Column(name = "is_on_campus", nullable = false) + var isOnCampus: Boolean,
application/src/main/kotlin/com/dobby/usecase/experiment/CreateExperimentPostUseCase.kt
Show resolved
Hide resolved
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (3)
application/src/test/kotlin/com/dobby/usecase/experiment/GetExperimentPostDetailForUpdateUseCaseTest.kt (1)
63-63: 수정용 상세 DTO에도 isOnCampus 검증 라인 추가수정 화면에서의 노출/바인딩을 보장하기 위해 assertion을 포함해 주세요.
추가 예:
result.experimentPostDetail.isOnCampus shouldBe trueapplication/src/test/kotlin/com/dobby/usecase/member/email/SendMatchingEmailUseCaseTest.kt (1)
183-189: 예외 단언 방식 재검토 필요
shouldThrow<EmailDomainNotFoundException>로 이미 타입이 검증되므로exception shouldBe EmailDomainNotFoundException비교는 중복이거나, 예외가object가 아닌class라면 실패합니다. 아래처럼 메시지나 필드 검증으로 바꾸는 것을 권장합니다.val ex = shouldThrow<EmailDomainNotFoundException> { runBlocking { sendMatchingEmailUseCase.execute(input) } } // ex.message shouldContain "유효하지 않은 이메일 도메인"application/src/test/kotlin/com/dobby/usecase/experiment/GetMyExperimentPostsUseCaseTest.kt (1)
131-150: 목록 응답에 isOnCampus 포함 여부 검증 추가 고려PR 목적이 “공고 목록 조회 시 ‘교내 실험 여부’ 추가”라면, 해당 UseCase/DTO가 이 필드를 노출하는지 단언을 추가해 주세요(현재는 title/content/views/recruitStatus만 확인).
📜 Review details
Configuration used: CodeRabbit UI
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 (7)
application/src/test/kotlin/com/dobby/usecase/experiment/GetExperimentPostDetailForUpdateUseCaseTest.kt(1 hunks)application/src/test/kotlin/com/dobby/usecase/experiment/GetExperimentPostDetailUseCaseTest.kt(1 hunks)application/src/test/kotlin/com/dobby/usecase/experiment/GetExperimentPostsUseCaseTest.kt(5 hunks)application/src/test/kotlin/com/dobby/usecase/experiment/GetMyExperimentPostsUseCaseTest.kt(3 hunks)application/src/test/kotlin/com/dobby/usecase/experiment/UpdateExperimentPostRecruitStatusUseCaseTest.kt(2 hunks)application/src/test/kotlin/com/dobby/usecase/member/email/GetMatchingExperimentPostsUseCaseTest.kt(1 hunks)application/src/test/kotlin/com/dobby/usecase/member/email/SendMatchingEmailUseCaseTest.kt(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build
🔇 Additional comments (4)
application/src/test/kotlin/com/dobby/usecase/experiment/UpdateExperimentPostRecruitStatusUseCaseTest.kt (1)
57-57: isOnCampus 필드 반영 OK도메인 변경에 맞춘 테스트 픽스가 일관됩니다.
Also applies to: 114-114
application/src/test/kotlin/com/dobby/usecase/member/email/SendMatchingEmailUseCaseTest.kt (1)
99-99: isOnCampus 필드 반영 OK생성자 인자 업데이트가 적절합니다.
Also applies to: 168-168
application/src/test/kotlin/com/dobby/usecase/member/email/GetMatchingExperimentPostsUseCaseTest.kt (1)
79-79: isOnCampus 필드 반영 OK데이터 클래스 동등성 비교에 포함되어 간접적으로도 검증됩니다.
application/src/test/kotlin/com/dobby/usecase/experiment/GetMyExperimentPostsUseCaseTest.kt (1)
63-63: isOnCampus 필드 반영 OK테스트 픽스가 일관되며 다른 필드와 충돌 없습니다.
Also applies to: 91-91, 117-117
application/src/test/kotlin/com/dobby/usecase/experiment/GetExperimentPostDetailUseCaseTest.kt
Show resolved
Hide resolved
application/src/test/kotlin/com/dobby/usecase/experiment/GetExperimentPostsUseCaseTest.kt
Show resolved
Hide resolved
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
application/src/main/kotlin/com/dobby/usecase/experiment/GetExperimentPostsUseCase.kt(2 hunks)domain/src/main/kotlin/com/dobby/model/experiment/ExperimentPost.kt(3 hunks)infrastructure/src/main/kotlin/com/dobby/persistence/entity/experiment/ExperimentPostEntity.kt(3 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- domain/src/main/kotlin/com/dobby/model/experiment/ExperimentPost.kt
- infrastructure/src/main/kotlin/com/dobby/persistence/entity/experiment/ExperimentPostEntity.kt
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build
🔇 Additional comments (1)
application/src/main/kotlin/com/dobby/usecase/experiment/GetExperimentPostsUseCase.kt (1)
86-86: 도메인 → 출력 매핑 LGTM
post.isOnCampus를PostInfoOutput.isOnCampus로 전달하는 매핑이 정확합니다.
application/src/main/kotlin/com/dobby/usecase/experiment/GetExperimentPostsUseCase.kt
Show resolved
Hide resolved
|
해당 작업은 일정 지연 이슈로 선 머지 후 리뷰해주시면 감사하겠습니다. 🙇♀️ |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
application/src/main/kotlin/com/dobby/usecase/experiment/UpdateExperimentPostUseCase.kt (1)
100-119: isOnCampus 값이 도메인 update에 전달되지 않아 실제로 수정되지 않습니다Input과 Mapper에서 받아온 값을
existingPost.update(...)호출에 넘기지 않아 변경이 반영되지 않습니다.아래와 같이 넘겨 주세요(도메인 시그니처가 지원한다는 전제):
val experimentPost = existingPost.update( applyMethod = applyMethod, targetGroup = targetGroup, title = input.title, reward = input.reward, startDate = input.startDate, endDate = input.endDate, content = input.content, count = input.count, leadResearcher = input.leadResearcher, detailedAddress = input.detailedAddress, matchType = input.matchType, + isOnCampus = input.isOnCampus, place = input.place, region = input.region, area = input.area, timeRequired = input.timeRequired, imageListInfo = input.imageListInfo?.images, recruitStatus = input.recruitStatus, idGenerator = idGenerator )도메인 메서드가
isOnCampus파라미터를 받는지 확인:#!/bin/bash rg -nC3 'fun\s+update\s*\(' domain/src/main/kotlin/com/dobby/model/experiment/ExperimentPost.kt rg -nC2 '\bisOnCampus\b' domain/src/main/kotlin/com/dobby/model/experiment/ExperimentPost.kt원하시면 isOnCampus 업데이트 케이스를 검증하는 단위테스트도 추가해 드리겠습니다.
🧹 Nitpick comments (3)
presentation/src/main/kotlin/com/dobby/api/dto/request/experiment/UpdateExperimentPostRequest.kt (1)
22-22: 업데이트 DTO에서만 isOnCampus가 비nullable(필수)인 점 재검토 제안다른 필드들은 대부분 nullable인데 isOnCampus만 필수이면 부분 업데이트(패치) 철학과 어긋나고, 구(舊) 클라이언트가 값을 누락하면 400이 날 수 있습니다. 의도라면 OK, 아니라면 nullable로 전환을 권장합니다.
다음과 같이 변경을 고려해 주세요:
- val isOnCampus: Boolean, + val isOnCampus: Boolean? = null,다음 스크립트로 업데이트 엔드포인트 테스트/컨트롤러에서 새 필드가 누락 없이 전달되는지 확인해 주세요.
#!/bin/bash rg -nC2 'UpdateExperimentPostRequest\(' rg -nC2 '\bisOnCampus\b' presentation | sed -n '1,200p'application/src/main/kotlin/com/dobby/usecase/experiment/UpdateExperimentPostUseCase.kt (1)
36-36: Update.Input에서도 isOnCampus의 nullable 전환 고려부분 업데이트 일관성을 위해
Boolean?로 두고 null이면 보존, 값이 있으면 변경하는 패턴을 권장합니다(요청 DTO 변경 시 함께 정합 필요).- val isOnCampus: Boolean, + val isOnCampus: Boolean?,presentation/src/main/kotlin/com/dobby/api/mapper/ExperimentPostMapper.kt (1)
143-150: 업데이트 응답 매핑 OK + 가독성 순서 니트픽네이밍 인자라 기능엔 문제 없으나,
views바로 다음에isOnCampus를 배치하면 파일 전반의 필드 순서와 더 일관됩니다.- durationInfo = DurationInfo( - startDate = input.durationInfo?.startDate, - endDate = input.durationInfo?.endDate - ), - isOnCampus = input.isOnCampus, + isOnCampus = input.isOnCampus, + durationInfo = DurationInfo( + startDate = input.durationInfo?.startDate, + endDate = input.durationInfo?.endDate + ),
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
application/src/main/kotlin/com/dobby/usecase/experiment/CreateExperimentPostUseCase.kt(4 hunks)application/src/main/kotlin/com/dobby/usecase/experiment/UpdateExperimentPostUseCase.kt(3 hunks)presentation/src/main/kotlin/com/dobby/api/dto/request/experiment/UpdateExperimentPostRequest.kt(1 hunks)presentation/src/main/kotlin/com/dobby/api/dto/response/experiment/PostInfo.kt(1 hunks)presentation/src/main/kotlin/com/dobby/api/mapper/ExperimentPostMapper.kt(5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- application/src/main/kotlin/com/dobby/usecase/experiment/CreateExperimentPostUseCase.kt
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build
🔇 Additional comments (6)
application/src/main/kotlin/com/dobby/usecase/experiment/UpdateExperimentPostUseCase.kt (1)
73-73: 응답 경로에 isOnCampus 노출 매핑 적절합니다
PostInfo.isOnCampus추가 및updatedPost.isOnCampus매핑 모두 일관됩니다.Also applies to: 127-127
presentation/src/main/kotlin/com/dobby/api/dto/response/experiment/PostInfo.kt (1)
8-8: 응답 스키마에 isOnCampus 추가 OK리스트/생성 응답에 필요한 필드로 보이며 매퍼들과 일관됩니다. 서버 관점 문제 없습니다.
presentation/src/main/kotlin/com/dobby/api/mapper/ExperimentPostMapper.kt (4)
56-57: 생성 입력으로 isOnCampus 전달 OKCreate 플로우 인입 매핑 정상입니다.
101-106: 생성 응답에 isOnCampus 매핑 OK응답 DTO와 시그니처가 일치합니다.
153-175: 업데이트 입력으로 isOnCampus 전달 OK — 다만 UseCase에서 실제 반영 누락Mapper는 값을 잘 넘기지만, UseCase의
existingPost.update(...)호출에 전달이 빠져 있어 현재는 효과가 없습니다(동일 PR 내 다른 코멘트 참조).UseCase 수정 후 여기서 전달되는 값이 실제 저장까지 이어지는지 통합 테스트로 확인 부탁드립니다.
399-405: 목록 응답에 isOnCampus 포함 OK리스트 아이템
PostInfo에 반영되어 목표(PR 목적)와 부합합니다.
* feat: add isOnCampus field to create new experiment posts * feat: add isOnCampus field in ExperimentPostEntity * feat: add isOnCampus value on presentation layer * fix: fix failed test cases * feat: revise isOnCampus field nullable to non-nullable * feature: add isOnCampus field in updateExperimentPost
* feat: add isOnCampus field to create new experiment posts * feat: add isOnCampus field in ExperimentPostEntity * feat: add isOnCampus value on presentation layer * fix: fix failed test cases * feat: revise isOnCampus field nullable to non-nullable * feature: add isOnCampus field in updateExperimentPost
💡 작업 내용
✅ 셀프 체크리스트
🙋🏻 확인해주세요
🔗 Jira 티켓
https://yappsocks.atlassian.net/browse/YS-505
Summary by CodeRabbit
🔗 Jira 티켓
https://yappsocks.atlassian.net/browse/YS-505