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 @@ -15,7 +15,8 @@ public enum BookmarkErrorCode implements ErrorCode{
NO_BOOKMARK_PERMISSION_EXCEPTION(403, "해당 북마크에 대한 권한이 없습니다."),
INVALID_BOOKMARK_CATEGORY_EXCEPTION(400, "카테고리를 선택해야 합니다."),
BOOKMARK_TAG_MINIMUM_REQUIRED_EXCEPTION(400, "최소 1개 이상의 태그를 선택해야 합니다."),
BOOKMARK_TAG_COUNT_EXCEEDED_EXCEPTION(400, "태그는 최대 3개까지만 선택할 수 있습니다.");
BOOKMARK_TAG_COUNT_EXCEEDED_EXCEPTION(400, "태그는 최대 3개까지만 선택할 수 있습니다."),
BOOKMARK_UPDATE_FIELD_EMPTY_EXCEPTION(400, "업데이트할 필드가 존재하지 않습니다.");

private final int errorCode;
private final String message;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package leets.bookmark.domain.bookmark.application.exception;

import leets.bookmark.global.common.exception.BusinessException;

public class BookmarkUpdateFieldEmptyException extends BusinessException {
public BookmarkUpdateFieldEmptyException() {
super(BookmarkErrorCode.BOOKMARK_UPDATE_FIELD_EMPTY_EXCEPTION);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import leets.bookmark.domain.bookmark.domain.entity.BookmarkTagMapping;
import leets.bookmark.domain.file.application.dto.response.FileResponse;
import leets.bookmark.domain.notification.application.dto.response.NotificationResponse;
import leets.bookmark.domain.notification.application.dto.request.NotificationUpdateRequest;
import leets.bookmark.domain.tag.domain.entity.Tag;
import leets.bookmark.domain.category.domain.entity.Category;

Expand All @@ -17,6 +18,8 @@

import java.util.List;

import leets.bookmark.domain.notification.application.dto.request.NotificationSaveRequest;

@Component
@RequiredArgsConstructor
public class BookmarkMapper {
Expand Down Expand Up @@ -132,4 +135,8 @@ public BookmarkFullResponse toFullResponse(Bookmark bookmark, List<BookmarkTagMa
.updatedAt(bookmark.getUpdatedAt())
.build();
}

public NotificationSaveRequest toNotificationSaveRequest(NotificationUpdateRequest updateRequest) {
return new NotificationSaveRequest(updateRequest.notifyAt());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import leets.bookmark.domain.bookmark.application.dto.response.BookmarkFullResponse;
import leets.bookmark.domain.bookmark.application.dto.response.BookmarkPreviewResponse;
import leets.bookmark.domain.bookmark.application.dto.response.BookmarkPlatformResponse;
import leets.bookmark.domain.bookmark.application.exception.BookmarkUpdateFieldEmptyException;
import leets.bookmark.domain.bookmark.application.exception.TagCategoryMismatchException;
import leets.bookmark.domain.bookmark.application.mapper.BookmarkPlatformMapper;
import leets.bookmark.domain.bookmark.application.mapper.BookmarkSearchConditionMapper;
Expand All @@ -24,6 +25,8 @@
import leets.bookmark.domain.file.application.dto.response.FileResponse;
import leets.bookmark.domain.file.application.mapper.FileMapper;
import leets.bookmark.domain.file.application.usecase.FileUseCase;
import leets.bookmark.domain.notification.application.dto.request.NotificationSaveRequest;
import leets.bookmark.domain.notification.application.mapper.NotificationMapper;
import leets.bookmark.domain.notification.application.dto.response.NotificationResponse;
import leets.bookmark.domain.notification.domain.service.NotificationDeleteService;
import leets.bookmark.domain.notification.domain.service.NotificationGetService;
Expand Down Expand Up @@ -69,6 +72,7 @@ public class BookmarkUseCaseImpl implements BookmarkUseCase {
private final NotificationDeleteService notificationDeleteService;
private final NotificationGetService notificationGetService;
private final NotificationUseCase notificationUseCase;
private final NotificationMapper notificationMapper;

private final FileMapper fileMapper;

Expand Down Expand Up @@ -185,6 +189,12 @@ public void update(Long userId, Long bookmarkId, BookmarkUpdateRequest request,
if (request.title() != null && !request.title().trim().isEmpty()) {
bookmark.updateTitle(request.title());
updated = true;

}
if (request.memo() != null && !request.memo().trim().isEmpty()) {
bookmark.updateMemo(request.memo());
updated = true;

}

if (request.thumbnailUrl() != null) {
Expand All @@ -207,8 +217,13 @@ public void update(Long userId, Long bookmarkId, BookmarkUpdateRequest request,
updated = true;
}
Copy link
Collaborator

@jj0526 jj0526 Aug 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thumbnailUrl, platform, faviconUrl, url은 모두 url이 바뀌었기에 일어나기에 검증 처리를 통해 한번에 이루어져야 한다고 생각됩니다. 하지만 시간상 이후에 리팩토링으로 부탁드립니다.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


if (request.notification() != null && request.notification().notificationId() != null) {
notificationUseCase.updateNotification(user, bookmark, request.notification());
if (request.notification() != null) {
if (request.notification().notificationId() != null) {
notificationUseCase.updateNotification(user, bookmark, request.notification());
} else {
NotificationSaveRequest saveRequest = bookmarkMapper.toNotificationSaveRequest(request.notification());
notificationUseCase.saveNotification(user, bookmark, saveRequest);
}
updated = true;
}

Expand Down Expand Up @@ -245,7 +260,7 @@ public void update(Long userId, Long bookmarkId, BookmarkUpdateRequest request,
}

if (!updated) {
throw new IllegalArgumentException("업데이트할 필드가 존재하지 않습니다.");
throw new BookmarkUpdateFieldEmptyException();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,8 @@ public void updateUrl(String url) {
public void updateCategory(Category category) {
this.category = category;
}

public void updateMemo(String memo) {
this.memo = memo;
}
}