-
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.
Merge pull request #111 from SWM-Flash/feature/FLASH-417-modify-hold-…
…color-api 문제의 홀드색을 수정하는 API
- Loading branch information
Showing
6 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
src/main/java/com/first/flash/climbing/problem/application/ProblemsHoldService.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,35 @@ | ||
package com.first.flash.climbing.problem.application; | ||
|
||
import com.first.flash.climbing.hold.application.HoldService; | ||
import com.first.flash.climbing.hold.domain.Hold; | ||
import com.first.flash.climbing.problem.application.dto.ProblemDetailResponseDto; | ||
import com.first.flash.climbing.problem.domain.Problem; | ||
import com.first.flash.climbing.problem.domain.QueryProblem; | ||
import java.util.UUID; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
@Transactional(readOnly = true) | ||
public class ProblemsHoldService { | ||
|
||
private final ProblemReadService problemReadService; | ||
private final HoldService holdService; | ||
|
||
@Transactional | ||
public ProblemDetailResponseDto updateHold(final UUID problemId, | ||
final Long holdId) { | ||
Hold hold = holdService.findById(holdId); | ||
|
||
Problem problem = problemReadService.findProblemById(problemId); | ||
QueryProblem queryProblem = problemReadService.findQueryProblemById(problemId); | ||
|
||
problem.updateHoldInfo(hold.getId()); | ||
queryProblem.updateHoldInfo(hold.getId(), hold.getColorName(), hold.getColorCode()); | ||
|
||
return ProblemDetailResponseDto.of(queryProblem); | ||
} | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/com/first/flash/climbing/problem/application/dto/ProblemHoldRequestDto.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.first.flash.climbing.problem.application.dto; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
|
||
public record ProblemHoldRequestDto( | ||
@NotNull(message = "변경할 홀드 id는 필수입니다.") Long holdId) { | ||
|
||
} |
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
2 changes: 2 additions & 0 deletions
2
.../java/com/first/flash/climbing/problem/infrastructure/QueryProblemQueryDslRepository.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
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