diff --git a/api/src/main/java/com/sponus/sponusbe/domain/bookmark/exception/BookmarkErrorCode.java b/api/src/main/java/com/sponus/sponusbe/domain/bookmark/exception/BookmarkErrorCode.java index 9a1ebdbe..3034ce36 100644 --- a/api/src/main/java/com/sponus/sponusbe/domain/bookmark/exception/BookmarkErrorCode.java +++ b/api/src/main/java/com/sponus/sponusbe/domain/bookmark/exception/BookmarkErrorCode.java @@ -12,7 +12,8 @@ @AllArgsConstructor public enum BookmarkErrorCode implements BaseErrorCode { - BOOKMARK_ERROR(HttpStatus.BAD_REQUEST, "BMK4000", "북마크 관련 에러"); + BOOKMARK_ERROR(HttpStatus.BAD_REQUEST, "BMK4000", "북마크 관련 에러"), + CANNOT_BOOKMARK_TO_SELF(HttpStatus.BAD_REQUEST, "PROP4011", "본인에게는 북마크할 수 없습니다."); private final HttpStatus httpStatus; private final String code; diff --git a/api/src/main/java/com/sponus/sponusbe/domain/bookmark/service/BookmarkService.java b/api/src/main/java/com/sponus/sponusbe/domain/bookmark/service/BookmarkService.java index ed01acaf..0d72649d 100644 --- a/api/src/main/java/com/sponus/sponusbe/domain/bookmark/service/BookmarkService.java +++ b/api/src/main/java/com/sponus/sponusbe/domain/bookmark/service/BookmarkService.java @@ -29,7 +29,7 @@ public class BookmarkService { public BookmarkToggleResponse bookmarkToggle(Organization organization, BookmarkToggleRequest request) { if (organization.getId().equals(request.target())) - throw new BookmarkException(BookmarkErrorCode.BOOKMARK_ERROR); + throw new BookmarkException(BookmarkErrorCode.CANNOT_BOOKMARK_TO_SELF); final Organization target = organizationRepository.findById(request.target()) .orElseThrow(() -> new OrganizationException(OrganizationErrorCode.ORGANIZATION_NOT_FOUND)); diff --git a/api/src/main/java/com/sponus/sponusbe/domain/propose/exception/ProposeErrorCode.java b/api/src/main/java/com/sponus/sponusbe/domain/propose/exception/ProposeErrorCode.java index 46f38ab0..1669bd65 100644 --- a/api/src/main/java/com/sponus/sponusbe/domain/propose/exception/ProposeErrorCode.java +++ b/api/src/main/java/com/sponus/sponusbe/domain/propose/exception/ProposeErrorCode.java @@ -15,6 +15,7 @@ public enum ProposeErrorCode implements BaseErrorCode { INVALID_PROPOSE_STATUS(HttpStatus.BAD_REQUEST, "PROP4005", "유효하지 않은 제안 상태입니다."), PROPOSE_LIMIT_ERROR(HttpStatus.CONFLICT, "PROP4009", "하루 제안 5회 초과하였습니다."), PROFILE_NOT_COMPLETED(HttpStatus.BAD_REQUEST, "PROP4010", "프로필이 작성되지 않았습니다."), + CANNOT_PROPOSE_TO_SELF(HttpStatus.BAD_REQUEST, "PROP4011", "본인에게는 제안할 수 없습니다."), PROPOSE_NOT_FOUND(HttpStatus.NOT_FOUND, "PROP4040", "해당 제안이 존재하지 않습니다."); private final HttpStatus httpStatus; diff --git a/api/src/main/java/com/sponus/sponusbe/domain/propose/service/ProposeService.java b/api/src/main/java/com/sponus/sponusbe/domain/propose/service/ProposeService.java index 7dc7819d..4faa7a3d 100644 --- a/api/src/main/java/com/sponus/sponusbe/domain/propose/service/ProposeService.java +++ b/api/src/main/java/com/sponus/sponusbe/domain/propose/service/ProposeService.java @@ -31,14 +31,14 @@ public class ProposeService { public ProposeCreateResponse createPropose(Organization organization, ProposeCreateRequest request) { if (organization.getId().equals(request.target())) - throw new ProposeException(ProposeErrorCode.PROPOSE_ERROR); + throw new ProposeException(ProposeErrorCode.CANNOT_PROPOSE_TO_SELF); final Organization target = organizationRepository.findById(request.target()) .orElseThrow(() -> new OrganizationException(OrganizationErrorCode.ORGANIZATION_NOT_FOUND)); if (organization.getImageUrl() == null || organization.getImageUrl().isEmpty()) throw new ProposeException(ProposeErrorCode.PROFILE_NOT_COMPLETED); - + final Long count = proposeRepository.countProposesByOrganizationToday(organization, LocalDateTime.now().toLocalDate().atStartOfDay());