-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
스터디 미리보기, 찜 컨트롤러, 서비스 로직 및 테스트 코드 작성 (#105)
* feature: [#102] Study Preview API controller, service 관련 코드 작성 * feature: [#102] StudyController Study Preview response 추가 * feature: [#102] StudyPreview API Controller, Service 테스트 코드 작성 * feature: [#102] study 찜하기, 찜 취소하기 Controller, Service 로직 작성 및 테스트 코드 작성 * refactor: [#102] StudyService 타입 주석 제거
- Loading branch information
1 parent
6d85322
commit 9f9b1a8
Showing
24 changed files
with
620 additions
and
24 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
11 changes: 11 additions & 0 deletions
11
be/src/main/java/com/example/be/common/exception/study/InvalidStudyPreviewTypeException.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,11 @@ | ||
package com.example.be.common.exception.study; | ||
|
||
import com.example.be.common.exception.BaseException; | ||
import com.example.be.common.exception.ErrorCodeAndMessages; | ||
|
||
public class InvalidStudyPreviewTypeException extends BaseException { | ||
|
||
public InvalidStudyPreviewTypeException() { | ||
super(ErrorCodeAndMessages.STUDY_PREVIEW_TYPE_ERROR); | ||
} | ||
} |
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
31 changes: 31 additions & 0 deletions
31
...c/main/java/com/example/be/core/application/dto/request/StudyPreviewConditionRequest.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,31 @@ | ||
package com.example.be.core.application.dto.request; | ||
|
||
import com.example.be.core.domain.study.StudyPreviewType; | ||
import com.example.be.core.domain.study.StudyType; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.ToString; | ||
|
||
@Getter | ||
@ToString | ||
@NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
public class StudyPreviewConditionRequest { | ||
|
||
@Schema(enumAsRef = true, description = "스터디 미리보기 조회 타입, NULL") | ||
private StudyPreviewType type; | ||
|
||
public StudyPreviewConditionRequest(String type) { | ||
this.type = getStudyPreviewTypeFromString(type); | ||
} | ||
|
||
private StudyPreviewType getStudyPreviewTypeFromString(String input) { | ||
|
||
if (input == null) { | ||
throw new IllegalArgumentException("type이 정해지지 않았습니다."); | ||
} | ||
return StudyPreviewType.convert(input.toUpperCase()); | ||
} | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
be/src/main/java/com/example/be/core/application/dto/response/PreviewProfilesResponse.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,16 @@ | ||
package com.example.be.core.application.dto.response; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import java.util.List; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public class PreviewProfilesResponse { | ||
|
||
@Schema(type = "List<String>", description = "스터디에 참여중인 멤버들의 프로필 이미지, NOT NULL") | ||
private final List<String> memberProfiles; | ||
|
||
public PreviewProfilesResponse(List<String> memberProfiles) { | ||
this.memberProfiles = memberProfiles; | ||
} | ||
} |
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
14 changes: 14 additions & 0 deletions
14
be/src/main/java/com/example/be/core/application/dto/response/StudyPreviewsResponse.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,14 @@ | ||
package com.example.be.core.application.dto.response; | ||
|
||
import java.util.List; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public class StudyPreviewsResponse { | ||
|
||
private final List<StudyPreviewResponse> studyPreviewResponses; | ||
|
||
public StudyPreviewsResponse(List<StudyPreviewResponse> studyPreviewResponses) { | ||
this.studyPreviewResponses = studyPreviewResponses; | ||
} | ||
} |
1 change: 0 additions & 1 deletion
1
be/src/main/java/com/example/be/core/domain/study/StudyDay.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
28 changes: 28 additions & 0 deletions
28
be/src/main/java/com/example/be/core/domain/study/StudyPreviewType.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,28 @@ | ||
package com.example.be.core.domain.study; | ||
|
||
import com.example.be.common.exception.study.InvalidStudyPreviewTypeException; | ||
import com.example.be.common.exception.study.InvalidStudyTypeException; | ||
import java.util.Arrays; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public enum StudyPreviewType { | ||
|
||
MY("MY"), | ||
RANDOM("RANDOM") | ||
; | ||
|
||
private final String type; | ||
|
||
StudyPreviewType(String type) { | ||
this.type = type; | ||
} | ||
|
||
public static StudyPreviewType convert(String source) { | ||
|
||
return Arrays.stream(StudyPreviewType.values()) | ||
.filter(e -> e.type.equals(source)) | ||
.findAny() | ||
.orElseThrow(InvalidStudyPreviewTypeException::new); | ||
} | ||
} |
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
Oops, something went wrong.