From c8459807e6f8ca454a242903e86049d3f937d737 Mon Sep 17 00:00:00 2001 From: leedy5521 Date: Wed, 28 Jan 2026 01:35:37 +0900 Subject: [PATCH 1/6] =?UTF-8?q?refactor:=20CodiveNotification=EC=97=90=20N?= =?UTF-8?q?otificationType=ED=95=84=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/request/TestPresignedUrlRequest.java | 12 +++++++ .../CodiveNotificationRepositoryImpl.java | 8 +++-- .../CodiveNotificationServiceImpl.java | 35 +++++++++++++++---- .../entity/CodiveNotification.java | 11 +++++- .../notification/enums/NotificationType.java | 9 +++++ 5 files changed, 65 insertions(+), 10 deletions(-) create mode 100644 clokey-api/src/main/java/org/clokey/domain/cloth/dto/request/TestPresignedUrlRequest.java create mode 100644 clokey-domain/src/main/java/org/clokey/notification/enums/NotificationType.java diff --git a/clokey-api/src/main/java/org/clokey/domain/cloth/dto/request/TestPresignedUrlRequest.java b/clokey-api/src/main/java/org/clokey/domain/cloth/dto/request/TestPresignedUrlRequest.java new file mode 100644 index 00000000..f5342ad2 --- /dev/null +++ b/clokey-api/src/main/java/org/clokey/domain/cloth/dto/request/TestPresignedUrlRequest.java @@ -0,0 +1,12 @@ +package org.clokey.domain.cloth.dto.request; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotNull; + +@Schema(description = "테스트용 presignedUrl 발급 요청 (로컬 환경 전용)") +public record TestPresignedUrlRequest( + @NotNull(message = "발급할 presignedUrl 개수는 필수입니다.") + @Min(value = 1, message = "발급할 presignedUrl 개수는 1개 이상이어야 합니다.") + @Schema(description = "발급할 presignedUrl 개수", example = "5") + Integer count) {} diff --git a/clokey-api/src/main/java/org/clokey/domain/notification/repository/CodiveNotificationRepositoryImpl.java b/clokey-api/src/main/java/org/clokey/domain/notification/repository/CodiveNotificationRepositoryImpl.java index e92b7717..b9a7e379 100644 --- a/clokey-api/src/main/java/org/clokey/domain/notification/repository/CodiveNotificationRepositoryImpl.java +++ b/clokey-api/src/main/java/org/clokey/domain/notification/repository/CodiveNotificationRepositoryImpl.java @@ -32,8 +32,12 @@ public Slice findAllNotificationsByMemberId( codiveNotification.id, codiveNotification.notificationImageUrl, codiveNotification.content, - codiveNotification.redirectInfo, - codiveNotification.redirectType, + codiveNotification.notificationType, + Projections.constructor( + NotificationListResponse.NotificationActionResponse + .class, + codiveNotification.redirectType, + codiveNotification.redirectInfo), codiveNotification.readStatus, codiveNotification.createdAt)) .from(codiveNotification) diff --git a/clokey-api/src/main/java/org/clokey/domain/notification/service/CodiveNotificationServiceImpl.java b/clokey-api/src/main/java/org/clokey/domain/notification/service/CodiveNotificationServiceImpl.java index 4389070d..ab6df2ca 100644 --- a/clokey-api/src/main/java/org/clokey/domain/notification/service/CodiveNotificationServiceImpl.java +++ b/clokey-api/src/main/java/org/clokey/domain/notification/service/CodiveNotificationServiceImpl.java @@ -28,6 +28,7 @@ import org.clokey.member.entity.Member; import org.clokey.member.enums.MemberStatus; import org.clokey.notification.entity.CodiveNotification; +import org.clokey.notification.enums.NotificationType; import org.clokey.notification.enums.ReadStatus; import org.clokey.notification.enums.RedirectType; import org.clokey.response.SliceResponse; @@ -55,6 +56,7 @@ public class CodiveNotificationServiceImpl implements CodiveNotificationService private static final String TODAY_TEMPERATURE_NOTIFICATION = "오늘의 기온은 %d도 입니다!\n날씨에 맞는 오늘의 옷차림이 기다리고 있어요👀"; + private static final String TODAY_TEMPERATURE_IMAGE_URL = "https://example.com/temperature.png"; @Override public void sendNewFollowerNotification(Long followFromId, Long followToId) { @@ -90,7 +92,8 @@ public void sendNewFollowerNotification(Long followFromId, Long followToId) { content, profileImageUrl, followToMember.getNickname(), - RedirectType.MEMBER_REDIRECT); + RedirectType.MEMBER_REDIRECT, + NotificationType.FOLLOW); codiveNotificationRepository.save(codiveNotification); } @@ -131,7 +134,8 @@ public void sendNewPendingFollowerNotification(Long followFromId, Long followToI content, profileImageUrl, followToMember.getNickname(), - RedirectType.MEMBER_REDIRECT); + RedirectType.MEMBER_REDIRECT, + NotificationType.FOLLOW_REQUEST); codiveNotificationRepository.save(codiveNotification); } @@ -173,7 +177,8 @@ public void sendNewCommentNotification(NewCommentEvent event) { content, profileImageUrl, String.valueOf(event.historyId()), - RedirectType.HISTORY_REDIRECT); + RedirectType.HISTORY_REDIRECT, + NotificationType.COMMENT); codiveNotificationRepository.save(codiveNotification); } @@ -212,7 +217,8 @@ public void sendNewReplyNotification(NewReplyEvent event) { content, profileImageUrl, String.valueOf(event.historyId()), - RedirectType.HISTORY_REDIRECT); + RedirectType.HISTORY_REDIRECT, + NotificationType.REPLY); codiveNotificationRepository.save(codiveNotification); } @@ -221,11 +227,15 @@ public void sendNewReplyNotification(NewReplyEvent event) { @Override public void sendNewTemperatureNotification(TemperatureNotificationRequest request) { Member receiver = memberUtil.getCurrentMember(); - String content = ""; + String content = + String.format(TODAY_TEMPERATURE_NOTIFICATION, Math.round(request.temperature())); if (isAbleToSendNotification(receiver)) { - - Notification notification = Notification.builder().setBody(content).build(); + Notification notification = + Notification.builder() + .setBody(content) + .setImage(TODAY_TEMPERATURE_IMAGE_URL) + .build(); Message message = Message.builder() .setToken(receiver.getDeviceToken()) @@ -237,6 +247,17 @@ public void sendNewTemperatureNotification(TemperatureNotificationRequest reques } catch (FirebaseMessagingException e) { throw new BaseCustomException(NotificationErrorCode.NOTIFICATION_FIREBASE_ERROR); } + + CodiveNotification codiveNotification = + CodiveNotification.createCodiveNotification( + receiver, + content, + TODAY_TEMPERATURE_IMAGE_URL, + "", + RedirectType.NONE, + NotificationType.TEMPERATURE_DAILY); + + codiveNotificationRepository.save(codiveNotification); } } diff --git a/clokey-domain/src/main/java/org/clokey/notification/entity/CodiveNotification.java b/clokey-domain/src/main/java/org/clokey/notification/entity/CodiveNotification.java index 42eb76f8..e81b2db5 100644 --- a/clokey-domain/src/main/java/org/clokey/notification/entity/CodiveNotification.java +++ b/clokey-domain/src/main/java/org/clokey/notification/entity/CodiveNotification.java @@ -5,6 +5,7 @@ import lombok.*; import org.clokey.common.model.BaseEntity; import org.clokey.member.entity.Member; +import org.clokey.notification.enums.NotificationType; import org.clokey.notification.enums.ReadStatus; import org.clokey.notification.enums.RedirectType; @@ -30,6 +31,10 @@ public class CodiveNotification extends BaseEntity { @Enumerated(EnumType.STRING) private RedirectType redirectType; + @NotNull + @Enumerated(EnumType.STRING) + private NotificationType notificationType; + @Enumerated(EnumType.STRING) @NotNull private ReadStatus readStatus; @@ -46,12 +51,14 @@ private CodiveNotification( String notificationImageUrl, String redirectInfo, RedirectType redirectType, + NotificationType notificationType, ReadStatus readStatus) { this.member = member; this.content = content; this.notificationImageUrl = notificationImageUrl; this.redirectInfo = redirectInfo; this.redirectType = redirectType; + this.notificationType = notificationType; this.readStatus = readStatus; } @@ -60,13 +67,15 @@ public static CodiveNotification createCodiveNotification( String content, String notificationImageUrl, String redirectInfo, - RedirectType redirectType) { + RedirectType redirectType, + NotificationType notificationType) { return CodiveNotification.builder() .member(member) .content(content) .notificationImageUrl(notificationImageUrl) .redirectInfo(redirectInfo) .redirectType(redirectType) + .notificationType(notificationType) .readStatus(ReadStatus.NOT_READ) .build(); } diff --git a/clokey-domain/src/main/java/org/clokey/notification/enums/NotificationType.java b/clokey-domain/src/main/java/org/clokey/notification/enums/NotificationType.java new file mode 100644 index 00000000..11d6fd0e --- /dev/null +++ b/clokey-domain/src/main/java/org/clokey/notification/enums/NotificationType.java @@ -0,0 +1,9 @@ +package org.clokey.notification.enums; + +public enum NotificationType { + FOLLOW, + FOLLOW_REQUEST, + COMMENT, + REPLY, + TEMPERATURE_DAILY +} From ee117bf523543073b71c2d34cbf02d83c1d5f2bf Mon Sep 17 00:00:00 2001 From: leedy5521 Date: Wed, 28 Jan 2026 01:38:16 +0900 Subject: [PATCH 2/6] =?UTF-8?q?refactor:=20NotificationListResponse=20?= =?UTF-8?q?=EC=9D=91=EB=8B=B5=20=EA=B5=AC=EC=A1=B0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/response/NotificationListResponse.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/clokey-api/src/main/java/org/clokey/domain/notification/dto/response/NotificationListResponse.java b/clokey-api/src/main/java/org/clokey/domain/notification/dto/response/NotificationListResponse.java index d0d2a5bf..efae7130 100644 --- a/clokey-api/src/main/java/org/clokey/domain/notification/dto/response/NotificationListResponse.java +++ b/clokey-api/src/main/java/org/clokey/domain/notification/dto/response/NotificationListResponse.java @@ -2,17 +2,22 @@ import io.swagger.v3.oas.annotations.media.Schema; import java.time.LocalDateTime; +import org.clokey.notification.enums.NotificationType; import org.clokey.notification.enums.ReadStatus; import org.clokey.notification.enums.RedirectType; public record NotificationListResponse( - @Schema(description = "알림의 ID", example = "1L") Long notificationId, + @Schema(description = "알림의 ID", example = "1") Long notificationId, @Schema(description = "알림의 이미지 URL", example = "https://testiamge.com") String notificationImageUrl, @Schema(description = "알림의 내용", example = "테스트 알림입니다.") String notificationContent, - @Schema(description = "redirectInfo(historyId 등)", example = "1L") String redirectInfo, - @Schema(description = "RedirectType(Member, History 등)", example = "MEMBER_REDIRECT") - RedirectType redirectType, + @Schema(description = "알림의 타입", example = "COMMENT") NotificationType notificationType, + @Schema(description = "알림 이동 정보") NotificationActionResponse action, @Schema(description = "읽음 상태(ReadStatus)", example = "NOT_READ") ReadStatus readStatus, @Schema(description = "알림이 생성된 시간", example = "2025-11-25T12:39:03.123456") - LocalDateTime createdAt) {} + LocalDateTime createdAt) { + public record NotificationActionResponse( + @Schema(description = "알림 이동 타입", example = "HISTORY_REDIRECT") + RedirectType redirectType, + @Schema(description = "알림 이동 정보(historyId 등)", example = "1") String redirectInfo) {} +} From 9d39baab5dc395d26a89b77c811ca6c42b786a0e Mon Sep 17 00:00:00 2001 From: leedy5521 Date: Wed, 28 Jan 2026 01:39:31 +0900 Subject: [PATCH 3/6] =?UTF-8?q?refactor:=20RedirectType=EC=97=90=20NONE=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/clokey/domain/cloth/service/ClothServiceImpl.java | 1 - .../main/java/org/clokey/notification/enums/RedirectType.java | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/clokey-api/src/main/java/org/clokey/domain/cloth/service/ClothServiceImpl.java b/clokey-api/src/main/java/org/clokey/domain/cloth/service/ClothServiceImpl.java index c5a81715..903ac5e2 100644 --- a/clokey-api/src/main/java/org/clokey/domain/cloth/service/ClothServiceImpl.java +++ b/clokey-api/src/main/java/org/clokey/domain/cloth/service/ClothServiceImpl.java @@ -21,7 +21,6 @@ import org.clokey.domain.image.event.ImageDeleteEvent; import org.clokey.domain.search.event.ClothDeleteEvent; import org.clokey.domain.search.event.MeiliSearchSyncEvent; -import org.clokey.enums.ImageType; import org.clokey.exception.BaseCustomException; import org.clokey.global.paging.SortDirection; import org.clokey.global.util.MemberUtil; diff --git a/clokey-domain/src/main/java/org/clokey/notification/enums/RedirectType.java b/clokey-domain/src/main/java/org/clokey/notification/enums/RedirectType.java index c7553b95..f1e98ba5 100644 --- a/clokey-domain/src/main/java/org/clokey/notification/enums/RedirectType.java +++ b/clokey-domain/src/main/java/org/clokey/notification/enums/RedirectType.java @@ -1,6 +1,7 @@ package org.clokey.notification.enums; public enum RedirectType { + NONE, HISTORY_REDIRECT, MEMBER_REDIRECT } From f8049d6a99733c662063f39ea919d7265ce8dbbd Mon Sep 17 00:00:00 2001 From: leedy5521 Date: Wed, 28 Jan 2026 01:41:22 +0900 Subject: [PATCH 4/6] =?UTF-8?q?test/refactor:=20=EC=BB=A8=ED=8A=B8?= =?UTF-8?q?=EB=A1=A4=EB=9F=AC/=EC=84=9C=EB=B9=84=EC=8A=A4=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/auth/service/AuthServiceTest.java | 4 +- .../NotificationControllerTest.java | 21 +++++++++-- .../service/NotificationServiceTest.java | 37 +++++++++++++------ 3 files changed, 45 insertions(+), 17 deletions(-) diff --git a/clokey-api/src/test/java/org/clokey/domain/auth/service/AuthServiceTest.java b/clokey-api/src/test/java/org/clokey/domain/auth/service/AuthServiceTest.java index 6398b988..535ee25a 100644 --- a/clokey-api/src/test/java/org/clokey/domain/auth/service/AuthServiceTest.java +++ b/clokey-api/src/test/java/org/clokey/domain/auth/service/AuthServiceTest.java @@ -74,6 +74,7 @@ import org.clokey.member.enums.OauthProvider; import org.clokey.member.enums.Visibility; import org.clokey.notification.entity.CodiveNotification; +import org.clokey.notification.enums.NotificationType; import org.clokey.notification.enums.RedirectType; import org.clokey.report.entity.Report; import org.clokey.report.enums.ReportReason; @@ -479,7 +480,8 @@ void setUp() { "testContent", "notificationImageUrl", "redirectInfo", - RedirectType.HISTORY_REDIRECT); + RedirectType.HISTORY_REDIRECT, + NotificationType.COMMENT); codiveNotificationRepository.save(notification); // Follow 생성 (targetMember가 팔로우하는 경우) diff --git a/clokey-api/src/test/java/org/clokey/domain/notification/controller/NotificationControllerTest.java b/clokey-api/src/test/java/org/clokey/domain/notification/controller/NotificationControllerTest.java index e55323e8..9bfc362d 100644 --- a/clokey-api/src/test/java/org/clokey/domain/notification/controller/NotificationControllerTest.java +++ b/clokey-api/src/test/java/org/clokey/domain/notification/controller/NotificationControllerTest.java @@ -13,6 +13,7 @@ import org.clokey.domain.notification.dto.response.NotificationListResponse; import org.clokey.domain.notification.dto.response.UnreadNotificationResponse; import org.clokey.domain.notification.service.CodiveNotificationService; +import org.clokey.notification.enums.NotificationType; import org.clokey.notification.enums.ReadStatus; import org.clokey.notification.enums.RedirectType; import org.clokey.response.SliceResponse; @@ -71,16 +72,18 @@ class 알림_목록_조회할_시 { 2L, "https://image.example", "테스트 알림2 내용입니다.", - "2", - RedirectType.HISTORY_REDIRECT, + NotificationType.COMMENT, + new NotificationListResponse.NotificationActionResponse( + RedirectType.HISTORY_REDIRECT, "2"), ReadStatus.NOT_READ, LocalDateTime.now()), new NotificationListResponse( 1L, "https://image.example", "테스트 알림1 내용입니다.", - "2", - RedirectType.MEMBER_REDIRECT, + NotificationType.FOLLOW, + new NotificationListResponse.NotificationActionResponse( + RedirectType.MEMBER_REDIRECT, "2"), ReadStatus.READ, LocalDateTime.now())); @@ -95,7 +98,17 @@ class 알림_목록_조회할_시 { .andExpect(jsonPath("$.code").value("COMMON200")) .andExpect(jsonPath("$.message").value("성공입니다.")) .andExpect(jsonPath("$.result.content[0].notificationId").value("2")) + .andExpect(jsonPath("$.result.content[0].notificationType").value("COMMENT")) + .andExpect( + jsonPath("$.result.content[0].action.redirectType") + .value("HISTORY_REDIRECT")) + .andExpect(jsonPath("$.result.content[0].action.redirectInfo").value("2")) .andExpect(jsonPath("$.result.content[1].notificationId").value("1")) + .andExpect(jsonPath("$.result.content[1].notificationType").value("FOLLOW")) + .andExpect( + jsonPath("$.result.content[1].action.redirectType") + .value("MEMBER_REDIRECT")) + .andExpect(jsonPath("$.result.content[1].action.redirectInfo").value("2")) .andExpect(jsonPath("$.result.isLast").value(true)); } diff --git a/clokey-api/src/test/java/org/clokey/domain/notification/service/NotificationServiceTest.java b/clokey-api/src/test/java/org/clokey/domain/notification/service/NotificationServiceTest.java index f9aef85e..7fbde904 100644 --- a/clokey-api/src/test/java/org/clokey/domain/notification/service/NotificationServiceTest.java +++ b/clokey-api/src/test/java/org/clokey/domain/notification/service/NotificationServiceTest.java @@ -40,6 +40,7 @@ import org.clokey.member.enums.OauthProvider; import org.clokey.member.enums.Visibility; import org.clokey.notification.entity.CodiveNotification; +import org.clokey.notification.enums.NotificationType; import org.clokey.notification.enums.ReadStatus; import org.clokey.notification.enums.RedirectType; import org.clokey.response.SliceResponse; @@ -354,7 +355,8 @@ void setUp() { "테스트 알림1", "http://testImageURl1.test", "1", - RedirectType.HISTORY_REDIRECT); + RedirectType.HISTORY_REDIRECT, + NotificationType.COMMENT); notification1.updateReadStatus(ReadStatus.READ); CodiveNotification notification2 = @@ -363,7 +365,8 @@ void setUp() { "테스트 알림2", "http://testImageURl2.test", "testNickname", - RedirectType.MEMBER_REDIRECT); + RedirectType.MEMBER_REDIRECT, + NotificationType.FOLLOW); notification2.updateReadStatus(ReadStatus.READ); CodiveNotification notification3 = @@ -372,14 +375,16 @@ void setUp() { "테스트 알림3", "http://testImageURl3.test", "1", - RedirectType.HISTORY_REDIRECT); + RedirectType.HISTORY_REDIRECT, + NotificationType.COMMENT); CodiveNotification notification4 = CodiveNotification.createCodiveNotification( member2, "테스트 알림4", "http://testImageURl4.test", "1", - RedirectType.HISTORY_REDIRECT); + RedirectType.HISTORY_REDIRECT, + NotificationType.COMMENT); notification4.updateReadStatus(ReadStatus.READ); notificationRepository.saveAll( List.of(notification1, notification2, notification3, notification4)); @@ -433,7 +438,8 @@ void setUp() { "테스트 알림1", "http://testImageURl1.test", "1", - RedirectType.HISTORY_REDIRECT); + RedirectType.HISTORY_REDIRECT, + NotificationType.COMMENT); notification1.updateReadStatus(ReadStatus.READ); CodiveNotification notification2 = @@ -442,7 +448,8 @@ void setUp() { "테스트 알림2", "http://testImageURl2.test", "testNickname", - RedirectType.MEMBER_REDIRECT); + RedirectType.MEMBER_REDIRECT, + NotificationType.FOLLOW); notification2.updateReadStatus(ReadStatus.READ); CodiveNotification notification3 = @@ -451,14 +458,16 @@ void setUp() { "테스트 알림3", "http://testImageURl3.test", "1", - RedirectType.HISTORY_REDIRECT); + RedirectType.HISTORY_REDIRECT, + NotificationType.COMMENT); CodiveNotification notification4 = CodiveNotification.createCodiveNotification( member2, "테스트 알림4", "http://testImageURl4.test", "1", - RedirectType.HISTORY_REDIRECT); + RedirectType.HISTORY_REDIRECT, + NotificationType.COMMENT); notification4.updateReadStatus(ReadStatus.READ); notificationRepository.saveAll( List.of(notification1, notification2, notification3, notification4)); @@ -505,7 +514,8 @@ void setUp() { "테스트 알림1", "http://testImageURl1.test", "1", - RedirectType.HISTORY_REDIRECT); + RedirectType.HISTORY_REDIRECT, + NotificationType.COMMENT); notificationRepository.save(notification1); } @@ -547,21 +557,24 @@ void setUp() { "테스트 알림1", "http://testImageURl1.test", "1", - RedirectType.HISTORY_REDIRECT); + RedirectType.HISTORY_REDIRECT, + NotificationType.COMMENT); CodiveNotification notification2 = CodiveNotification.createCodiveNotification( member1, "테스트 알림2", "http://testImageURl2.test", "2", - RedirectType.HISTORY_REDIRECT); + RedirectType.HISTORY_REDIRECT, + NotificationType.COMMENT); CodiveNotification notification3 = CodiveNotification.createCodiveNotification( member1, "테스트 알림3", "http://testImageURl3.test", "3", - RedirectType.MEMBER_REDIRECT); + RedirectType.MEMBER_REDIRECT, + NotificationType.FOLLOW); notificationRepository.saveAll(List.of(notification1, notification2, notification3)); } From dc49b90a876ad80cc9b12809845beed29ab0646f Mon Sep 17 00:00:00 2001 From: leedy5521 Date: Wed, 28 Jan 2026 01:42:13 +0900 Subject: [PATCH 5/6] =?UTF-8?q?migration:=20flyway=20migration=20V5=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...notification_type_to_codive_notification.sql | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 clokey-domain/src/main/resources/db/migration/V5__add_notification_type_to_codive_notification.sql diff --git a/clokey-domain/src/main/resources/db/migration/V5__add_notification_type_to_codive_notification.sql b/clokey-domain/src/main/resources/db/migration/V5__add_notification_type_to_codive_notification.sql new file mode 100644 index 00000000..31da0ecf --- /dev/null +++ b/clokey-domain/src/main/resources/db/migration/V5__add_notification_type_to_codive_notification.sql @@ -0,0 +1,17 @@ +ALTER TABLE codive_notification + ADD COLUMN notification_type VARCHAR(255) NOT NULL DEFAULT 'COMMENT' CHECK ( + notification_type IN ('FOLLOW', 'FOLLOW_REQUEST', 'COMMENT', 'REPLY', 'TEMPERATURE_DAILY') + ); + +UPDATE codive_notification +SET notification_type = + CASE + WHEN redirect_type = 'MEMBER_REDIRECT' THEN 'FOLLOW' + WHEN redirect_type = 'HISTORY_REDIRECT' THEN 'COMMENT' + ELSE 'COMMENT' + END; + +ALTER TABLE codive_notification + MODIFY redirect_type VARCHAR(255) NOT NULL CHECK ( + redirect_type IN ('NONE', 'HISTORY_REDIRECT', 'MEMBER_REDIRECT') + ); From 37390844973adf2e6ac130a91d66bc4c3ede11a3 Mon Sep 17 00:00:00 2001 From: Ssamssamukja <109636635+Ssamssamukja@users.noreply.github.com> Date: Wed, 4 Feb 2026 00:03:45 +1000 Subject: [PATCH 6/6] =?UTF-8?q?[Fix/#319]=20=EC=B9=B4=ED=85=8C=EA=B3=A0?= =?UTF-8?q?=EB=A6=AC=EB=B3=84=20=EA=B3=84=EC=A0=88=EC=97=90=20=EB=A7=9E?= =?UTF-8?q?=EB=8A=94=20=EC=98=B7=20=EC=A1=B0=ED=9A=8C=20api=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20(#320)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 상위카테고리로 입력 변경 * update: test category 수정 --- .../clokey/domain/cloth/controller/ClothController.java | 2 +- .../domain/cloth/repository/ClothRepositoryCustom.java | 2 +- .../domain/cloth/repository/ClothRepositoryImpl.java | 7 +++++-- .../org/clokey/domain/cloth/service/ClothServiceImpl.java | 3 ++- .../org/clokey/domain/cloth/service/ClothServiceTest.java | 7 ++++--- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/clokey-api/src/main/java/org/clokey/domain/cloth/controller/ClothController.java b/clokey-api/src/main/java/org/clokey/domain/cloth/controller/ClothController.java index b80acd4e..305e2cde 100644 --- a/clokey-api/src/main/java/org/clokey/domain/cloth/controller/ClothController.java +++ b/clokey-api/src/main/java/org/clokey/domain/cloth/controller/ClothController.java @@ -45,7 +45,7 @@ public BaseResponse> recommendCategory @Parameter(description = "이전 페이지의 옷ID (첫 요청 시 생략)") @RequestParam(required = false) Long lastClothId, @Parameter(description = "페이지당 조회할 옷 수") @RequestParam @PageSize Integer size, - @Parameter(description = "옷 카테고리 ID") @RequestParam Long categoryId, + @Parameter(description = "상위 카테고리 ID") @RequestParam Long categoryId, @Parameter(description = "요청 계절") @RequestParam Season season) { SliceResponse response = clothService.recommendCategoryClothes(lastClothId, size, categoryId, season); diff --git a/clokey-api/src/main/java/org/clokey/domain/cloth/repository/ClothRepositoryCustom.java b/clokey-api/src/main/java/org/clokey/domain/cloth/repository/ClothRepositoryCustom.java index d2cd38e5..274b3f02 100644 --- a/clokey-api/src/main/java/org/clokey/domain/cloth/repository/ClothRepositoryCustom.java +++ b/clokey-api/src/main/java/org/clokey/domain/cloth/repository/ClothRepositoryCustom.java @@ -10,7 +10,7 @@ public interface ClothRepositoryCustom { Slice findAllMemberRecommendClothesByCategoryAndSeason( - Long lastClothId, int size, Long categoryId, Long memberId, Season season); + Long lastClothId, int size, List categoryIds, Long memberId, Season season); Slice findAllMemberClothesByCategoriesAndSeasons( Long lastClothId, diff --git a/clokey-api/src/main/java/org/clokey/domain/cloth/repository/ClothRepositoryImpl.java b/clokey-api/src/main/java/org/clokey/domain/cloth/repository/ClothRepositoryImpl.java index 288b1bc5..f9d529a4 100644 --- a/clokey-api/src/main/java/org/clokey/domain/cloth/repository/ClothRepositoryImpl.java +++ b/clokey-api/src/main/java/org/clokey/domain/cloth/repository/ClothRepositoryImpl.java @@ -30,7 +30,10 @@ public class ClothRepositoryImpl implements ClothRepositoryCustom { @Override public Slice findAllMemberRecommendClothesByCategoryAndSeason( - Long lastClothId, int size, Long categoryId, Long memberId, Season season) { + Long lastClothId, int size, List categoryIds, Long memberId, Season season) { + if (categoryIds == null || categoryIds.isEmpty()) { + return new SliceImpl<>(List.of(), PageRequest.of(0, size), false); + } Season nextSeason = season.next(); Season previousSeason = season.previous(); @@ -65,7 +68,7 @@ public Slice findAllMemberRecommendClothesByCategory queryFactory .selectFrom(cloth) .where( - cloth.category.id.eq(categoryId), + cloth.category.id.in(categoryIds), cloth.member.id.eq(memberId), seasonCondition) .orderBy(seasonPriority.asc(), cloth.id.asc()) diff --git a/clokey-api/src/main/java/org/clokey/domain/cloth/service/ClothServiceImpl.java b/clokey-api/src/main/java/org/clokey/domain/cloth/service/ClothServiceImpl.java index 903ac5e2..fad8c11a 100644 --- a/clokey-api/src/main/java/org/clokey/domain/cloth/service/ClothServiceImpl.java +++ b/clokey-api/src/main/java/org/clokey/domain/cloth/service/ClothServiceImpl.java @@ -90,10 +90,11 @@ public ClothCreateResponse createClothes(ClothCreateRequests request) { public SliceResponse recommendCategoryClothes( Long lastClothId, int size, Long categoryId, Season season) { final Member currentMember = memberUtil.getCurrentMember(); + List categoryIds = resolveCategoryIds(categoryId); Slice result = clothRepository.findAllMemberRecommendClothesByCategoryAndSeason( - lastClothId, size, categoryId, currentMember.getId(), season); + lastClothId, size, categoryIds, currentMember.getId(), season); return SliceResponse.from(result); } diff --git a/clokey-api/src/test/java/org/clokey/domain/cloth/service/ClothServiceTest.java b/clokey-api/src/test/java/org/clokey/domain/cloth/service/ClothServiceTest.java index 8f54c553..fb3b3aeb 100644 --- a/clokey-api/src/test/java/org/clokey/domain/cloth/service/ClothServiceTest.java +++ b/clokey-api/src/test/java/org/clokey/domain/cloth/service/ClothServiceTest.java @@ -259,9 +259,10 @@ void setUp() { memberRepository.save(member); given(memberUtil.getCurrentMember()).willReturn(member); - Category category1 = Category.createCategory("testCategory1", null); - Category category2 = Category.createCategory("testCategory2", null); - categoryRepository.saveAll(List.of(category1, category2)); + Category parentCategory1 = Category.createCategory("testParentCategory1", null); + Category parentCategory2 = Category.createCategory("testParentCategory2", null); + Category category1 = Category.createCategory("testCategory1", parentCategory1); + categoryRepository.saveAll(List.of(parentCategory1, parentCategory2, category1)); Cloth cloth1 = Cloth.createCloth(