-
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.
* [Feat] 지정한 개수 챌린지 조회 API 개발 * [Feat] 지정한 개수 챌린지 조회 API 개발 * [Fix] Fix typo * [Fix] 조인 방식 변경
- Loading branch information
1 parent
ca18fdf
commit 4f9b547
Showing
11 changed files
with
189 additions
and
15 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
12 changes: 12 additions & 0 deletions
12
keewe-api/src/main/java/ccc/keeweapi/config/WebMvcConfig.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,12 @@ | ||
package ccc.keeweapi.config; | ||
|
||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.validation.beanvalidation.MethodValidationPostProcessor; | ||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | ||
|
||
public class WebMvcConfig implements WebMvcConfigurer { | ||
@Bean | ||
public MethodValidationPostProcessor methodValidationPostProcessor() { | ||
return new MethodValidationPostProcessor(); | ||
} | ||
} |
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
27 changes: 27 additions & 0 deletions
27
keewe-api/src/main/java/ccc/keeweapi/dto/challenge/ChallengeInfoResponse.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,27 @@ | ||
package ccc.keeweapi.dto.challenge; | ||
|
||
import static lombok.AccessLevel.PRIVATE; | ||
|
||
import ccc.keewedomain.persistence.domain.common.Interest; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@NoArgsConstructor(access = PRIVATE) | ||
@Getter | ||
public class ChallengeInfoResponse { | ||
private Long challengeId; | ||
private String challengeCategory; | ||
private String challengeName; | ||
private String challengeIntroduction; | ||
private Long insightCount; | ||
|
||
public static ChallengeInfoResponse of(Long id, Interest interest, String name, String introduction, Long insightCount) { | ||
ChallengeInfoResponse response = new ChallengeInfoResponse(); | ||
response.challengeId = id; | ||
response.challengeCategory = interest.getName(); | ||
response.challengeName = name; | ||
response.challengeIntroduction = introduction; | ||
response.insightCount = insightCount; | ||
return response; | ||
} | ||
} |
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
24 changes: 24 additions & 0 deletions
24
.../main/java/ccc/keewedomain/persistence/repository/challenge/ChallengeQueryRepository.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,24 @@ | ||
package ccc.keewedomain.persistence.repository.challenge; | ||
|
||
import static ccc.keewedomain.persistence.domain.challenge.QChallenge.challenge; | ||
|
||
import ccc.keewedomain.persistence.domain.challenge.Challenge; | ||
import com.querydsl.jpa.impl.JPAQueryFactory; | ||
import java.util.List; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
@RequiredArgsConstructor | ||
public class ChallengeQueryRepository { | ||
private final JPAQueryFactory queryFactory; | ||
|
||
public List<Challenge> getSpecifiedNumberOfChallenge(int size) { | ||
return queryFactory.select(challenge) | ||
.from(challenge) | ||
.where(challenge.deleted.isFalse()) | ||
.orderBy(challenge.id.desc()) | ||
.limit(size) | ||
.fetch(); | ||
} | ||
} |
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