Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ public record UpdatePinPointRequest(
String name,

@Schema(description = "우선순위 설정 여부, true인 경우 최우선", example = "true")
Boolean isFirst
Boolean first
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public void update(String id, UUID userId, UpdatePinPointRequest request) {
PinPoint pinPoint = loadPinPoint(id);

/// isFirst가 true로 변경되는 경우, 기존 first=true인 핀포인트를 false로 변경
if (request.isFirst() != null && request.isFirst() && !pinPoint.isFirst()) {
if (request.first() != null && request.first() && !pinPoint.isFirst()) {
Optional<PinPoint> existingFirstPinPoint = repository.findByUserIdAndIsFirst(userId.toString(), true);
existingFirstPinPoint.ifPresent(existingPinPoint -> {
existingPinPoint.setFirst(false);
Expand All @@ -96,9 +96,9 @@ public void update(String id, UUID userId, UpdatePinPointRequest request) {
/// 수정 (더티체킹)
pinPoint.updateName(request.name());

/// isFirst 값이 null이 아닌 경우에만 업데이트
if (request.isFirst() != null) {
pinPoint.setFirst(request.isFirst());
/// first 값이 null이 아닌 경우에만 업데이트
if (request.first() != null) {
pinPoint.setFirst(request.first());
}

repository.save(pinPoint);
Expand Down
Loading