-
Notifications
You must be signed in to change notification settings - Fork 0
[YS-505] feature: 공고 수정 - 기존 공고 조회 시, 누락되었던 isOnCampus 필드값 추가 #168
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
Walkthrough실험 게시글 전반에 isOnCampus(Boolean) 필드를 추가하고, 도메인-영속성-유스케이스-프레젠테이션-매퍼-테스트 전 계층에 전달/매핑을 반영했습니다. 생성/수정 입력과 출력, 상세/목록 조회 응답 및 엔티티/도메인 변환, 테스트 픽스처 모두 해당 필드를 포함하도록 수정되었습니다. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Client
participant API as API (Request DTO)
participant UC as CreateExperimentPostUseCase
participant Domain as ExperimentPost
participant Repo as ExperimentPostEntity/Repo
participant Mapper as Mapper (Response)
Client->>API: CreateExperimentPostRequest{..., isOnCampus}
API->>UC: Input{..., isOnCampus}
UC->>Domain: newExperimentPost(..., isOnCampus)
Domain-->>UC: ExperimentPost{..., isOnCampus}
UC->>Repo: save(Entity{..., isOnCampus})
Repo-->>UC: ExperimentPost{..., isOnCampus}
UC->>Mapper: PostInfo mapping with isOnCampus
Mapper-->>Client: Response{postInfo{..., isOnCampus}}
note over UC,Repo: isOnCampus 필드가 전 구간에 전달/보존
sequenceDiagram
autonumber
actor Client
participant API as API (Request DTO)
participant UC as UpdateExperimentPostUseCase
participant Repo as ExperimentPostEntity/Repo
participant Domain as ExperimentPost
participant Mapper as Mapper (Response)
Client->>API: UpdateExperimentPostRequest{..., isOnCampus}
API->>UC: Input{..., isOnCampus}
UC->>Repo: findById(...)
Repo-->>UC: ExperimentPost{...}
UC->>Domain: update(..., isOnCampus)
Domain-->>UC: ExperimentPost{..., isOnCampus}
UC->>Repo: save(...)
Repo-->>UC: ExperimentPost{..., isOnCampus}
UC->>Mapper: PostInfo mapping with isOnCampus
Mapper-->>Client: Response{postInfo{..., isOnCampus}}
sequenceDiagram
autonumber
actor Client
participant UC1 as GetExperimentPostDetailUseCase
participant UC2 as GetExperimentPostDetailForUpdateUseCase
participant Repo as ExperimentPostEntity/Repo
participant Mapper as Mapper (Response)
Client->>UC1: detail(id)
UC1->>Repo: load(id)
Repo-->>UC1: ExperimentPost{..., isOnCampus}
UC1->>Mapper: Address/PostInfo with isOnCampus
Mapper-->>Client: DetailResponse{address{isOnCampus,...}}
Client->>UC2: detailForUpdate(id)
UC2->>Repo: load(id)
Repo-->>UC2: ExperimentPost{..., isOnCampus}
UC2->>Mapper: AddressForUpdate with isOnCampus
Mapper-->>Client: Response{address{isOnCampus,...}}
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
domain/src/main/kotlin/com/dobby/model/experiment/ExperimentPost.kt (1)
61-80: 도메인 update에 isOnCampus 반영 누락
update(...)시그니처 및 copy에서isOnCampus가 누락되어 업데이트가 불가능합니다. 아래와 같이 보완해 주세요.fun update( targetGroup: TargetGroup?, applyMethod: ApplyMethod?, title: String?, reward: String?, startDate: LocalDate?, endDate: LocalDate?, content: String?, count: Int?, leadResearcher: String?, detailedAddress: String?, matchType: MatchType?, + isOnCampus: Boolean?, place: String?, region: Region?, area: Area?, timeRequired: TimeSlot?, imageListInfo: List<String>?, recruitStatus: Boolean?, idGenerator: IdGenerator ): ExperimentPost { @@ return this.copy( targetGroup = targetGroup?.let { this.targetGroup.update(it.startAge, it.endAge, it.genderType, it.otherCondition) } ?: this.targetGroup, applyMethod = applyMethod?.let { this.applyMethod.update(it.phoneNum, it.formUrl, it.content) } ?: this.applyMethod, title = title ?: this.title, reward = reward ?: this.reward, startDate = startDate ?: this.startDate, endDate = endDate ?: this.endDate, content = content ?: this.content, count = count ?: this.count, leadResearcher = leadResearcher ?: this.leadResearcher, detailedAddress = detailedAddress, matchType = matchType ?: this.matchType, + isOnCampus = isOnCampus ?: this.isOnCampus, timeRequired = timeRequired ?: this.timeRequired, place = place, region = region, area = area, images = updatedImages, updatedAt = TimeProvider.currentDateTime(), recruitStatus = recruitStatus ?: this.recruitStatus ) }Also applies to: 98-117
🧹 Nitpick comments (11)
application/src/test/kotlin/com/dobby/usecase/experiment/GetExperimentPostDetailForUpdateUseCaseTest.kt (1)
63-63: 픽스처에 isOnCampus 추가 OK. 검증 보강 권장해당 유스케이스 결과에 isOnCampus가 노출된다면, 결과 객체에 대한 필드 검증도 1~2개 추가해 주세요(회귀 방지).
application/src/test/kotlin/com/dobby/usecase/experiment/GetExperimentPostsUseCaseTest.kt (1)
50-51: 픽스처에 isOnCampus 추가 OK. 결과 검증도 추가 권장PostInfo에 isOnCampus가 포함된다면,
result.first().postInfo.isOnCampus shouldBe true같은 단언을 각 시나리오에 1개씩 추가해 주세요.Also applies to: 136-137, 219-220, 302-303, 384-385
application/src/test/kotlin/com/dobby/usecase/experiment/GetExperimentPostDetailUseCaseTest.kt (1)
65-65: 픽스처에 isOnCampus 추가 OK. 응답 검증 1줄 추가 권장응답의 address에 노출된다면
result.experimentPostDetail.address.isOnCampus shouldBe true단언을 추가해 주세요.presentation/src/main/kotlin/com/dobby/api/dto/response/experiment/PostInfo.kt (1)
3-9: Boolean 'is' 프리픽스 직렬화 명시화 권장 (@JsonProperty 추가)Jackson 사용 시
isOnCampus가onCampus로 내려갈 수 있습니다. JSON 필드명을 고정해 주세요.적용 예시:
import java.time.LocalDate +import com.fasterxml.jackson.annotation.JsonProperty data class PostInfo( val experimentPostId: String, val title: String, val views: Int, - val isOnCampus: Boolean, + @field:JsonProperty("isOnCampus") + val isOnCampus: Boolean, val place: String?, val reward: String?, val durationInfo: DurationInfo )검증: 스웨거/실제 응답에서 키가
isOnCampus로 노출되는지 확인 바랍니다.presentation/src/main/kotlin/com/dobby/api/dto/request/experiment/CreateExperimentPostRequest.kt (1)
3-7: 요청 스키마 잠재적 깨짐: isOnCampus를 기본값/nullable로 처리하거나 마이그레이션 공지 필요PR 목적은 “조회 시 누락된 필드 추가”인데, 생성 요청에 필드를 필수(Boolean)로 추가하면 기존 클라이언트가 실패할 수 있습니다. 기본값을 두어 호환성을 유지하는 것을 권장합니다. 또한 JSON 필드명 고정도 함께 제안합니다.
import com.dobby.enums.experiment.TimeSlot import java.time.LocalDate +import com.fasterxml.jackson.annotation.JsonProperty data class CreateExperimentPostRequest( @@ - val isOnCampus: Boolean, + @field:JsonProperty("isOnCampus") + val isOnCampus: Boolean = false,
- 대안:
Boolean? = null후 서버에서 기본값 보정.- 확인: 앱/프론트가 이미 본 필드를 전송하는지 여부.
Also applies to: 20-26
application/src/test/kotlin/com/dobby/usecase/experiment/GetMyExperimentPostsUseCaseTest.kt (1)
63-68: 새 필드 커버리지 보강 제안: isOnCampus도 검증픽스처에
isOnCampus = true를 넣으셨으니, 결과 검증에 해당 필드도 포함하면 좋습니다.예시:
result[0].isOnCampus shouldBe true result[1].isOnCampus shouldBe true result[2].isOnCampus shouldBe trueapplication/src/test/kotlin/com/dobby/usecase/member/email/GetMatchingExperimentPostsUseCaseTest.kt (1)
79-80: 매칭 결과 검증에 isOnCampus도 포함 권장출력 검증 시
isOnCampus포함해 회귀 방지 강화 제안.예시:
output.matchingPosts.values.flatten().first().isOnCampus shouldBe trueapplication/src/test/kotlin/com/dobby/usecase/experiment/CreateExperimentPostUseCaseTest.kt (1)
90-95: 생성 결과에 isOnCampus 검증 추가 제안생성 응답 PostInfo에 필드가 포함되므로 함께 검증해 주세요.
then("정상적으로 실험 게시글이 생성되어야 한다") { result.postInfo.postId shouldBe "0" result.postInfo.title shouldBe validInput.title result.postInfo.place shouldBe validInput.place result.postInfo.reward shouldBe validInput.reward + result.postInfo.isOnCampus shouldBe validInput.isOnCampus }presentation/src/main/kotlin/com/dobby/api/dto/response/experiment/ExperimentPostDetailResponse.kt (1)
8-10: AddressResponse의 isOnCampus JSON 키 고정: @field:JsonProperty("isOnCampus") 추가직렬화 시 JavaBeans 규칙에 의해 'onCampus'로 변환될 수 있으니 해당 프로퍼티에 @field:JsonProperty("isOnCampus")를 명시하세요. 매퍼는 이미 값을 채우고 있습니다 — presentation/src/main/kotlin/com/dobby/api/mapper/ExperimentPostMapper.kt (231–235, 288–292). 수정 위치: presentation/src/main/kotlin/com/dobby/api/dto/response/experiment/ExperimentPostDetailResponse.kt (95–97).
application/src/main/kotlin/com/dobby/usecase/experiment/UpdateExperimentPostUseCase.kt (1)
36-36: 부분 업데이트 일관성: isOnCampus를 nullable로 두는 방안 제안다른 필드가 대부분 nullable인데
isOnCampus만 non-null입니다. 부분 업데이트 패턴과 일관되게Boolean?로 두는 것을 권장합니다(미지정 시 기존 값 유지).- val isOnCampus: Boolean, + val isOnCampus: Boolean?,도메인
update는isOnCampus: Boolean?를 받아?: this.isOnCampus로 처리하는 형태로 함께 정렬해 주세요(도메인 파일 제안 참고).infrastructure/src/main/kotlin/com/dobby/persistence/entity/experiment/ExperimentPostEntity.kt (1)
73-75: DB null 허용 불일치: 컬럼을 not null로 명시코틀린 속성이
Boolean(non-null)인데 JPA 컬럼에nullable = false가 빠져 있습니다. 스키마/마이그레이션과 불일치할 수 있어 명시를 권장합니다.- @Column(name = "is_on_campus") + @Column(name = "is_on_campus", nullable = false) var isOnCampus: Boolean,또한, 기존 데이터에 대한 DDL 마이그레이션(기본값 설정 및 NOT NULL 제약) 적용 여부도 확인해 주세요.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (21)
application/src/main/kotlin/com/dobby/usecase/experiment/CreateExperimentPostUseCase.kt(4 hunks)application/src/main/kotlin/com/dobby/usecase/experiment/GetExperimentPostDetailForUpdateUseCase.kt(2 hunks)application/src/main/kotlin/com/dobby/usecase/experiment/GetExperimentPostDetailUseCase.kt(2 hunks)application/src/main/kotlin/com/dobby/usecase/experiment/GetExperimentPostsUseCase.kt(2 hunks)application/src/main/kotlin/com/dobby/usecase/experiment/UpdateExperimentPostUseCase.kt(3 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)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)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/dto/request/experiment/UpdateExperimentPostRequest.kt(1 hunks)presentation/src/main/kotlin/com/dobby/api/dto/response/experiment/ExperimentPostDetailResponse.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(7 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 (12)
application/src/test/kotlin/com/dobby/usecase/experiment/GetExperimentPostApplyMethodUseCaseTest.kt (1)
55-55: isOnCampus 픽스처 반영 LGTM테스트 데이터에 새 필드 반영 잘 됐습니다.
application/src/main/kotlin/com/dobby/usecase/experiment/GetExperimentPostDetailUseCase.kt (2)
62-67: Address에 isOnCampus 추가 OK. 응답 스키마/문서 동기화 확인 필요
- 프레젠테이션 계층(예: ExperimentPostDetailResponse.AddressResponse)과 API 문서가 동일하게 갱신됐는지 확인 부탁드립니다.
- Boolean 비널러블로 공개되므로, DB 마이그레이션/기본값(backfill) 상태가 일관적인지 점검이 필요합니다.
124-124: 도메인→응답 매핑 누락 없이 반영됨isOnCampus 매핑 적절합니다.
application/src/test/kotlin/com/dobby/usecase/member/email/SendMatchingEmailUseCaseTest.kt (1)
99-100: isOnCampus 필드 반영 LGTM테스트 초기화에 새 필드가 일관되게 반영되었습니다.
Also applies to: 168-169
application/src/test/kotlin/com/dobby/usecase/experiment/UpdateExperimentPostRecruitStatusUseCaseTest.kt (1)
57-57: isOnCampus 필드 반영 LGTM유스케이스 동작과 무관한 필드지만, 데이터 일관성 유지에 적절히 반영됐습니다.
Also applies to: 114-114
application/src/main/kotlin/com/dobby/usecase/experiment/CreateExperimentPostUseCase.kt (2)
107-127: 생성 플로우 내 isOnCampus 전달 매핑 적절함도메인 팩토리로의 전달과 저장 후 응답 매핑 모두 일관됩니다. LGTM.
140-147: 엔티티 매핑 확인됨 — 마이그레이션 존재 여부 확인 필요
- infrastructure/src/main/kotlin/com/dobby/persistence/entity/experiment/ExperimentPostEntity.kt 에 @column(name = "is_on_campus") var isOnCampus: Boolean 로 매핑되어 있음.
- DB 마이그레이션(V*.sql 또는 Liquibase changelog 등)에서 is_on_campus 컬럼을 추가하는 변경은 검색되지 않음 — DB 스키마에 컬럼이 반영됐는지 또는 마이그레이션 파일이 PR에 포함됐는지 확인하고, 누락 시 마이그레이션 추가.
application/src/main/kotlin/com/dobby/usecase/experiment/GetExperimentPostsUseCase.kt (1)
80-87: 목록 응답 isOnCampus 매핑 확인 — 문제 없음presentation/src/main/kotlin/com/dobby/api/mapper/ExperimentPostMapper.kt에서 request/input/response 변환에 isOnCampus가 일관되게 매핑되는 것이 확인되었습니다. LGTM.
infrastructure/src/main/kotlin/com/dobby/persistence/entity/experiment/ExperimentPostEntity.kt (1)
144-145: toDomain/fromDomain 매핑 반영 OK도메인-엔티티 간
isOnCampus매핑이 일관되게 반영되었습니다.Also applies to: 173-174
application/src/main/kotlin/com/dobby/usecase/experiment/GetExperimentPostDetailForUpdateUseCase.kt (1)
62-67: 수정 화면용 Address에 isOnCampus 추가 및 매핑 반영 OK조회 DTO와 변환 함수 모두
isOnCampus를 일관되게 노출합니다.Also applies to: 124-129
domain/src/main/kotlin/com/dobby/model/experiment/ExperimentPost.kt (1)
170-171: 생성 경로(newExperimentPost)의 isOnCampus 포함 OK생성 시그니처/생성자에 정상 반영되었습니다.
presentation/src/main/kotlin/com/dobby/api/mapper/ExperimentPostMapper.kt (1)
56-56: isOnCampus 매핑 전 경로 반영 OK
- Create/Update 입력 매핑
- Create/Update/List/Detail 응답 매핑
모두 일관성 있게 전달/노출됩니다.업데이트 입력을
Boolean?로 전환하는 경우(제안 반영 시), 요청 DTO와 매퍼도 함께 정렬되었는지 확인 부탁드립니다.Also applies to: 105-106, 147-147, 162-162, 233-233, 290-290, 406-406
| val timeRequired: TimeSlot?, | ||
|
|
||
| val leadResearcher: String?, | ||
| val isOnCampus: Boolean, |
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.
isOnCampus 업데이트 미반영(기능 오류)
Input에 추가된 isOnCampus가 도메인 업데이트 경로로 전달되지 않아 값 변경이 저장/반영되지 않습니다. 응답(PostInfo)에서는 updatedPost.isOnCampus를 노출하므로, 사용자는 업데이트가 되지 않은 값(이전 값)을 보게 됩니다.
아래와 같이 UseCase에서 도메인 update 호출 시 인자를 추가하고, 도메인 모델의 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
)Also applies to: 100-119, 127-127
|
|
||
| val leadResearcher: String?, // 연구 책임 정보 -> 기본값: 연구자 정보에서 끌어와야 함, 추후에 자유롭게 수정 가능 | ||
|
|
||
| val isOnCampus: Boolean, |
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.
Update 요청 스키마의 비호환 변경 위험
isOnCampus를 필수(Boolean)로 추가하면 기존 클라이언트 요청이 400으로 깨질 수 있습니다. 하위 호환을 위해 nullable+기본값 또는 기본값만 두는 것을 권장합니다. 업데이트 로직에서는 null이면 기존 값을 유지하는 패치 동작으로 처리하세요.
적용 예시:
- val isOnCampus: Boolean,
+ val isOnCampus: Boolean? = null,업데이트 적용 시(참고용):
// 예: usecase/mapper 내부
val newIsOnCampus = request.isOnCampus ?: existing.isOnCampus🤖 Prompt for AI Agents
presentation/src/main/kotlin/com/dobby/api/dto/request/experiment/UpdateExperimentPostRequest.kt
around line 22: the new non-nullable Boolean property isOnCampus breaks backward
compatibility for existing clients; change the request field to nullable
(Boolean?) or provide a default so missing values don't cause 400s, and update
the update/mapper logic to treat null as "keep existing" (i.e., use
existing.isOnCampus when request.isOnCampus is null) to implement patch-style
behavior.
* 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
* feature: add isOnCampus field in GET /{postId}/edit
* feature: add isOnCampus in AddressResponse
* 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
* feature: add isOnCampus field in GET /{postId}/edit
* feature: add isOnCampus in AddressResponse
💡 작업 내용
✅ 셀프 체크리스트
🙋🏻 확인해주세요
🔗 Jira 티켓
https://yappsocks.atlassian.net/browse/YS-505
Summary by CodeRabbit