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 @@ -28,7 +28,7 @@ public interface LabelControllerDocs {

@Operation(
summary = "라벨 목록 조회",
description = "로그인한 사용자의 활성 라벨 목록을 displayOrder ASC 정렬로 반환합니다. 라벨별 읽지 않은 스레드 수와 민감 라벨 여부를 포함합니다.",
description = "로그인한 사용자의 활성 라벨 목록을 displayOrder ASC 정렬로 반환합니다. 라벨별 알림 정책, 읽지 않은 스레드 수와 민감 라벨 여부를 포함합니다.",
security = @SecurityRequirement(name = "cookieAuth")
)
@ApiResponses({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.mailsangja.core.dto.label;

import com.mailsangja.db.common.label.NotificationPolicy;
import com.mailsangja.db.entity.label.Label;
import io.swagger.v3.oas.annotations.media.Schema;

Expand All @@ -19,6 +20,9 @@ public record LabelListResponse(
@Schema(description = "표시 순서", example = "0")
int order,

@Schema(description = "알림 정책 (URGENT/INHERIT/SILENT)", example = "INHERIT")
NotificationPolicy notificationPolicy,

@Schema(description = "AI 기능에서 제외할 민감 라벨 여부", example = "false")
boolean isSensitive,

Expand All @@ -32,6 +36,7 @@ public static LabelListResponse of(Label label, long unreadThreadCount) {
label.getName(),
label.getColorCode(),
label.getDisplayOrder(),
label.getNotificationPolicy(),
label.isSensitive(),
unreadThreadCount
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,20 @@ class LabelFacadeTest {
@Test
void 라벨목록조회_미읽은스레드수매핑및누락시_0반환() {
User user = user();
Label first = label("업무", 1);
Label second = label("개인", 2);
Label first = label("업무", 1, null, NotificationPolicy.URGENT);
Label second = label("개인", 2, null, NotificationPolicy.SILENT);
when(labelQueryService.findAllActiveByUserId(user.getId())).thenReturn(List.of(first, second));
when(labelQueryService.findUnreadThreadCountsByUserId(user.getId())).thenReturn(Map.of(first.getId(), 7L));

List<LabelListResponse> responses = labelFacade.getLabels(user);

assertEquals(2, responses.size());
assertEquals(first.getId(), responses.get(0).id());
assertEquals(NotificationPolicy.URGENT, responses.get(0).notificationPolicy());
assertEquals(first.isSensitive(), responses.get(0).isSensitive());
assertEquals(7L, responses.get(0).unreadThreadCount());
assertEquals(second.getId(), responses.get(1).id());
assertEquals(NotificationPolicy.SILENT, responses.get(1).notificationPolicy());
assertEquals(second.isSensitive(), responses.get(1).isSensitive());
assertEquals(0L, responses.get(1).unreadThreadCount());
}
Expand Down Expand Up @@ -307,11 +309,15 @@ private Label label(String name, int order) {
}

private Label label(String name, int order, LabelRule rule) {
return label(name, order, rule, NotificationPolicy.INHERIT);
}

private Label label(String name, int order, LabelRule rule, NotificationPolicy notificationPolicy) {
return Label.builder()
.id(UUID.randomUUID())
.name(name)
.colorCode("#3366FF")
.notificationPolicy(NotificationPolicy.INHERIT)
.notificationPolicy(notificationPolicy)
.displayOrder(order)
.rule(rule)
.build();
Expand Down
Loading