-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ [STMT-258] 레거시 스터디 목록 조회 및 레거시 스터디 숨김 처리 API 구현 (#154)
* 🗃️ [STMT-258] 스터디 멤버 테이블에 레거시 스터디 숨김 여부 컬럼 추가 * ✅ [STMT-258] 테스트 DB setup 데이터에 완료된 스터디 행 추가 * ✨ [STMT-258] 스터디 멤버 jpa entity에 레거시 스터디 숨김 여부 컬럼 추가 * ✨ [STMT-258] 멤버의 레거시 스터디 조회 쿼리 구현 * ✨ [STMT-258] 멤버의 레거시 스터디 조회 유스케이스 구현 * ✅ [STMT-258] 멤버의 레거시 스터디 조회 API 테스트 작성 * 📝 [STMT-258] 멤버의 레거시 스터디 조회 API 명세서 부가 설명 작성 * ✨ [STMT-258] 스터디 멤버 도메인에 레거시 숨김 플래그 속성 추가 * ✨ [STMT-258] 레거시 스터디인지 판별하는 검증 메서드 구현 * ✨ [STMT-258] 스터디 멤버 정보 업데이트 쿼리 메서드 구현 * ✨ [STMT-258] 레거시 스터디 숨김처리 유스케이스 구현 * ✨ [STMT-258] 레거시 스터디 숨김 API 구현 * 🩹 [STMT-258] 스터디 멤버 검증 메서드로 대체 * ✅ [STMT-258] 레거시 스터디 숨김 API 테스트 작성 * 📝 [STMT-258] 레거시 스터디 숨김 API 명세서 작성 * 🩹 [STMT-258] 레거시 스터디 숨김 스터디 존재 검증 로직 순서 변경
- Loading branch information
Showing
22 changed files
with
372 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,6 @@ | |
public interface StudyValidationUseCase { | ||
|
||
void checkById(Long id); | ||
|
||
void checkLegacyStudy(Long id); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/main/java/com/stumeet/server/studymember/adapter/in/web/LegacyStudyHideApi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.stumeet.server.studymember.adapter.in.web; | ||
|
||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.security.core.annotation.AuthenticationPrincipal; | ||
import org.springframework.web.bind.annotation.PatchMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
|
||
import com.stumeet.server.common.annotation.WebAdapter; | ||
import com.stumeet.server.common.auth.model.LoginMember; | ||
import com.stumeet.server.common.model.ApiResponse; | ||
import com.stumeet.server.common.response.SuccessCode; | ||
import com.stumeet.server.studymember.application.port.in.LegacyStudyHideUseCase; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
@WebAdapter | ||
@RequestMapping("/api/v1/studies/{studyId}") | ||
@RequiredArgsConstructor | ||
public class LegacyStudyHideApi { | ||
|
||
private final LegacyStudyHideUseCase legacyStudyHideUseCase; | ||
|
||
@PatchMapping("/legacy/hide") | ||
public ResponseEntity<ApiResponse<Void>> hideLegacyStudy( | ||
@AuthenticationPrincipal LoginMember member, | ||
@PathVariable(name = "studyId") Long studyId | ||
) { | ||
legacyStudyHideUseCase.hideLegacyStudyForMember(studyId, member.getId()); | ||
|
||
return ResponseEntity.ok(ApiResponse.success(SuccessCode.UPDATE_SUCCESS)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/main/java/com/stumeet/server/studymember/application/port/in/LegacyStudyHideUseCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.stumeet.server.studymember.application.port.in; | ||
|
||
public interface LegacyStudyHideUseCase { | ||
|
||
void hideLegacyStudyForMember(Long studyId, Long member); | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/com/stumeet/server/studymember/application/port/out/StudyMemberUpdatePort.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.stumeet.server.studymember.application.port.out; | ||
|
||
import com.stumeet.server.studymember.domain.StudyMember; | ||
|
||
public interface StudyMemberUpdatePort { | ||
|
||
void update(StudyMember studyMember); | ||
} |
37 changes: 37 additions & 0 deletions
37
src/main/java/com/stumeet/server/studymember/application/service/LegacyStudyHideService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.stumeet.server.studymember.application.service; | ||
|
||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
import com.stumeet.server.common.annotation.UseCase; | ||
import com.stumeet.server.study.application.port.in.StudyValidationUseCase; | ||
import com.stumeet.server.studymember.application.port.in.LegacyStudyHideUseCase; | ||
import com.stumeet.server.studymember.application.port.in.StudyMemberValidationUseCase; | ||
import com.stumeet.server.studymember.application.port.out.StudyMemberQueryPort; | ||
import com.stumeet.server.studymember.application.port.out.StudyMemberUpdatePort; | ||
import com.stumeet.server.studymember.application.port.out.StudyMemberValidationPort; | ||
import com.stumeet.server.studymember.domain.StudyMember; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
@UseCase | ||
@RequiredArgsConstructor | ||
@Transactional | ||
public class LegacyStudyHideService implements LegacyStudyHideUseCase { | ||
|
||
private final StudyValidationUseCase studyValidationUseCase; | ||
private final StudyMemberValidationUseCase studyMemberValidationUseCase; | ||
|
||
private final StudyMemberQueryPort studyMemberQueryPort; | ||
private final StudyMemberUpdatePort studyMemberUpdatePort; | ||
|
||
@Override | ||
public void hideLegacyStudyForMember(Long studyId, Long memberId) { | ||
studyValidationUseCase.checkLegacyStudy(studyId); | ||
studyMemberValidationUseCase.checkStudyJoinMember(studyId, memberId); | ||
|
||
StudyMember studyMember = studyMemberQueryPort.findStudyMember(studyId, memberId); | ||
studyMember.hideLegacyStudy(); | ||
|
||
studyMemberUpdatePort.update(studyMember); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
src/main/resources/db/migration/V1.8__add_legacy_hidden_column_to_study_member_table.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ALTER TABLE study_member | ||
ADD COLUMN is_legacy_hidden TINYINT(1) NOT NULL DEFAULT false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.