-
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 : level 테이블 내의 모든 정보를 가져오는 기능 추가 * feat : 레벨업 테이블 API 구현 * feat : 레벨업 테이블 API JWT 필터 예외 추가 * refactor : 해당 레벨의 minimum Review는 not null임을 명시하도록 원시타입으로 변경 * refactor : 상수 레벨 테이블을 사용해서 레벨 계산하도록 변경 * refactor : 상수 레벨 테이블을 사용해서 레벨업에 필요한 리뷰 수 계산하도록 변경 * fix : 레벨 계산 오류 수정 * build : ImmutableMap 사용을 위한 의존성 추가 * refactor : ImmutableMap을 사용해 레벨 최소/최대 조건 구현 * refactor : rest api 명명 규칙에 맞도록 복수형으로 변경 * refactor : ResponseStatus, summary 추가 * refactor : 레벨업 조건 테이블 조회 api 변경으로 인한 필터 조건 변경
- Loading branch information
1 parent
aeba0e5
commit 7564cb1
Showing
9 changed files
with
150 additions
and
33 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
31 changes: 31 additions & 0 deletions
31
...rc/main/java/org/depromeet/spot/application/member/controller/LevelUpTableController.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 org.depromeet.spot.application.member.controller; | ||
|
||
import java.util.List; | ||
|
||
import org.depromeet.spot.application.member.dto.response.LevelUpTableResponse; | ||
import org.depromeet.spot.usecase.port.in.member.LevelUsecase; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.ResponseStatus; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@Tag(name = "레벨") | ||
@RequestMapping("/api/v1/levelUpConditions") | ||
public class LevelUpTableController { | ||
|
||
private final LevelUsecase levelUsecase; | ||
|
||
@GetMapping | ||
@ResponseStatus(HttpStatus.OK) | ||
@Operation(summary = "레벨업 조건 테이블 조회 API") | ||
public List<LevelUpTableResponse> getLevelUpTable() { | ||
return levelUsecase.findAllLevels().stream().map(LevelUpTableResponse::from).toList(); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...rc/main/java/org/depromeet/spot/application/member/dto/response/LevelUpTableResponse.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,20 @@ | ||
package org.depromeet.spot.application.member.dto.response; | ||
|
||
import org.depromeet.spot.domain.member.Level; | ||
|
||
import lombok.Builder; | ||
|
||
@Builder | ||
public record LevelUpTableResponse(Integer level, String title, int minimum, Integer maximum) { | ||
public static LevelUpTableResponse from(Level level) { | ||
LevelUpTableResponse levelUpTableResponse = | ||
LevelUpTableResponse.builder() | ||
.level(level.getValue()) | ||
.title(level.getTitle()) | ||
.minimum(level.getMinimum()) | ||
.maximum(level.getMaximum()) | ||
.build(); | ||
|
||
return levelUpTableResponse; | ||
} | ||
} |
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
9 changes: 9 additions & 0 deletions
9
usecase/src/main/java/org/depromeet/spot/usecase/port/in/member/LevelUsecase.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,9 @@ | ||
package org.depromeet.spot.usecase.port.in.member; | ||
|
||
import java.util.List; | ||
|
||
import org.depromeet.spot.domain.member.Level; | ||
|
||
public interface LevelUsecase { | ||
List<Level> findAllLevels(); | ||
} |
4 changes: 4 additions & 0 deletions
4
usecase/src/main/java/org/depromeet/spot/usecase/port/out/member/LevelRepository.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 |
---|---|---|
@@ -1,8 +1,12 @@ | ||
package org.depromeet.spot.usecase.port.out.member; | ||
|
||
import java.util.List; | ||
|
||
import org.depromeet.spot.domain.member.Level; | ||
|
||
public interface LevelRepository { | ||
|
||
Level findByValue(int value); | ||
|
||
List<Level> findAll(); | ||
} |
24 changes: 24 additions & 0 deletions
24
usecase/src/main/java/org/depromeet/spot/usecase/service/level/LevelService.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 org.depromeet.spot.usecase.service.level; | ||
|
||
import java.util.List; | ||
|
||
import org.depromeet.spot.domain.member.Level; | ||
import org.depromeet.spot.usecase.port.in.member.LevelUsecase; | ||
import org.depromeet.spot.usecase.port.out.member.LevelRepository; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
@Transactional(readOnly = true) | ||
public class LevelService implements LevelUsecase { | ||
|
||
private final LevelRepository levelRepository; | ||
|
||
@Override | ||
public List<Level> findAllLevels() { | ||
return levelRepository.findAll(); | ||
} | ||
} |