Skip to content

Commit 490df6e

Browse files
authored
merge: 운영배포 - 250918
운영배포 - 250918
2 parents 3fc65d4 + c5fdbb5 commit 490df6e

File tree

6 files changed

+48
-22
lines changed

6 files changed

+48
-22
lines changed

src/main/java/com/permitseoul/permitserver/domain/eventtimetable/category/core/domain/TimetableCategory.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@ public class TimetableCategory {
1010
private final Long timetableCategoryId;
1111
private final long timetableId;
1212
private final String categoryName;
13-
private final String categoryColor;
13+
private final String categoryBackgroundColor;
14+
private final String categoryLineColor;
1415

1516
public static TimetableCategory fromEntity(final TimetableCategoryEntity timetableCategoryEntity) {
1617
return new TimetableCategory(
1718
timetableCategoryEntity.getTimetableCategoryId(),
1819
timetableCategoryEntity.getTimetableId(),
1920
timetableCategoryEntity.getCategoryName(),
20-
timetableCategoryEntity.getCategoryColor()
21+
timetableCategoryEntity.getCategoryBackgroundColor(),
22+
timetableCategoryEntity.getCategoryLineColor()
2123
);
2224
}
2325

src/main/java/com/permitseoul/permitserver/domain/eventtimetable/category/core/domain/entity/TimetableCategoryEntity.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,23 @@ public class TimetableCategoryEntity {
2222
@Column(name = "category_name", nullable = false)
2323
private String categoryName;
2424

25-
@Column(name = "category_color", nullable = false)
26-
private String categoryColor;
25+
@Column(name = "category_background_color", nullable = false)
26+
private String categoryBackgroundColor;
2727

28-
private TimetableCategoryEntity(long timetableId, String categoryName, String categoryColor) {
28+
@Column(name = "category_line_color", nullable = false)
29+
private String categoryLineColor;
30+
31+
private TimetableCategoryEntity(long timetableId, String categoryName, String categoryBackgroundColor, String categoryLineColor) {
2932
this.timetableId = timetableId;
3033
this.categoryName = categoryName;
31-
this.categoryColor = categoryColor;
34+
this.categoryBackgroundColor = categoryBackgroundColor;
35+
this.categoryLineColor = categoryLineColor;
3236
}
3337

3438
public static TimetableCategoryEntity create(final long timetableId,
3539
final String categoryName,
36-
final String categoryColor) {
37-
return new TimetableCategoryEntity(timetableId, categoryName, categoryColor);
40+
final String categoryBackgroundColor,
41+
final String categoryLineColor) {
42+
return new TimetableCategoryEntity(timetableId, categoryName, categoryBackgroundColor, categoryLineColor);
3843
}
3944
}

src/main/java/com/permitseoul/permitserver/domain/eventtimetable/timetable/api/dto/TimetableDetailResponse.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
public record TimetableDetailResponse(
99
String blockName,
1010
String blockCategory,
11-
String categoryColor,
11+
String categoryBackgroundColor,
12+
String categoryLineColor,
1213
boolean isLiked,
1314
String information,
1415
String area,
@@ -22,7 +23,8 @@ public record TimetableDetailResponse(
2223
) {
2324
public static TimetableDetailResponse of(final String blockName,
2425
final String blockCategory,
25-
final String categoryColor,
26+
final String categoryBackgroundColor,
27+
final String categoryLineColor,
2628
final boolean isLiked,
2729
final String information,
2830
final String area,
@@ -33,7 +35,8 @@ public static TimetableDetailResponse of(final String blockName,
3335
return new TimetableDetailResponse(
3436
blockName,
3537
blockCategory,
36-
categoryColor,
38+
categoryBackgroundColor,
39+
categoryLineColor,
3740
isLiked,
3841
information,
3942
area,

src/main/java/com/permitseoul/permitserver/domain/eventtimetable/timetable/api/dto/TimetableResponse.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ public static Area of(final long areaId, final String areaName, final int sequen
3737
public record Block(
3838
String blockId,
3939
String blockName,
40-
String blockColor,
40+
String blockBackgroundColor,
41+
String blockLineColor,
4142
@JsonFormat(pattern = "yyyy.MM.dd HH:mm")
4243
LocalDateTime blockStartDate,
4344
@JsonFormat(pattern = "yyyy.MM.dd HH:mm")
@@ -47,12 +48,13 @@ public record Block(
4748
) {
4849
public static Block of(final String blockId,
4950
final String blockName,
50-
final String blockColor,
51+
final String blockBackgroundColor,
52+
final String blockLineColor,
5153
final LocalDateTime blockStartDate,
5254
final LocalDateTime blockEndDate,
5355
final long blockAreaId,
5456
boolean isUserLiked) {
55-
return new Block(blockId, blockName, blockColor, blockStartDate, blockEndDate, blockAreaId, isUserLiked);
57+
return new Block(blockId, blockName, blockBackgroundColor, blockLineColor, blockStartDate, blockEndDate, blockAreaId, isUserLiked);
5658
}
5759
}
5860
}

src/main/java/com/permitseoul/permitserver/domain/eventtimetable/timetable/api/service/TimetableService.java

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import com.permitseoul.permitserver.domain.eventtimetable.timetable.api.exception.NotfoundTimetableException;
2020
import com.permitseoul.permitserver.domain.eventtimetable.timetable.core.component.TimetableRetriever;
2121
import com.permitseoul.permitserver.domain.eventtimetable.timetable.core.domain.Timetable;
22+
import com.permitseoul.permitserver.domain.eventtimetable.timetable.core.domain.TimetableCategoryColor;
2223
import com.permitseoul.permitserver.domain.eventtimetable.timetable.core.exception.TimetableNotFoundException;
2324
import com.permitseoul.permitserver.domain.eventtimetable.userlike.core.component.TimetableUserLikeRetriever;
2425
import com.permitseoul.permitserver.global.response.code.ErrorCode;
@@ -79,7 +80,7 @@ public TimetableResponse getEventTimetable(final long eventId, final Long userId
7980
? Set.of()
8081
: new HashSet<>(timetableUserLikeRetriever.findLikedBlockIdsIn(userId, blockIds));
8182

82-
final Map<Long, String> categoryColorMap = mapCategoryColors(categoryList);
83+
final Map<Long, TimetableCategoryColor> categoryColorMap = mapCategoryColors(categoryList);
8384
final List<TimetableResponse.Area> areaResponses = mapAreasToResponse(areaList);
8485
final List<TimetableResponse.Block> blockResponses = mapBlocksToResponse(blockList, categoryColorMap, likedBlockIds);
8586

@@ -117,7 +118,8 @@ public TimetableDetailResponse getEventTimetableDetail(final long blockId, final
117118
return TimetableDetailResponse.of(
118119
timetableBlock.getBlockName(),
119120
timetableCategory.getCategoryName(),
120-
timetableCategory.getCategoryColor(),
121+
timetableCategory.getCategoryBackgroundColor(),
122+
timetableCategory.getCategoryLineColor(),
121123
isUserLiked,
122124
timetableBlock.getInformation(),
123125
timetableArea.getAreaName(),
@@ -143,11 +145,14 @@ private List<TimetableDetailResponse.MediaInfo> sortTimetableBlockMedia(final Li
143145
.toList();
144146
}
145147

146-
private Map<Long, String> mapCategoryColors(final List<TimetableCategory> categoryList) {
148+
private Map<Long, TimetableCategoryColor> mapCategoryColors(final List<TimetableCategory> categoryList) {
147149
return categoryList.stream()
148150
.collect(Collectors.toMap(
149151
TimetableCategory::getTimetableCategoryId,
150-
TimetableCategory::getCategoryColor
152+
category -> new TimetableCategoryColor(
153+
category.getCategoryBackgroundColor(),
154+
category.getCategoryLineColor()
155+
)
151156
));
152157
}
153158

@@ -163,20 +168,23 @@ private List<TimetableResponse.Area> mapAreasToResponse(final List<TimetableArea
163168

164169
private List<TimetableResponse.Block> mapBlocksToResponse(
165170
final List<TimetableBlock> blockList,
166-
final Map<Long, String> categoryColorMap,
171+
final Map<Long, TimetableCategoryColor> categoryColorMap,
167172
final Set<Long> likedBlockIds
168173
) {
169174
return blockList.stream()
170175
.sorted(Comparator.comparing(TimetableBlock::getStartAt))
171176
.map(block -> {
172-
final String categoryColor = Optional.ofNullable(
177+
final TimetableCategoryColor categoryColor = Optional.ofNullable(
173178
categoryColorMap.get(block.getTimetableCategoryId()))
174179
.orElseThrow(() -> new NotfoundTimetableException(ErrorCode.NOT_FOUND_TIMETABLE_CATEGORY_COLOR));
175180

176181
final String encodedBlockId = secureUrlUtil.encode(block.getTimetableBlockId());
177182

178-
return TimetableResponse.Block.of(encodedBlockId,block.getBlockName(),
179-
categoryColor,
183+
return TimetableResponse.Block.of(
184+
encodedBlockId,
185+
block.getBlockName(),
186+
categoryColor.backgroundColor(),
187+
categoryColor.lineColor(),
180188
block.getStartAt(),
181189
block.getEndAt(),
182190
block.getTimetableAreaId(),
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package com.permitseoul.permitserver.domain.eventtimetable.timetable.core.domain;
2+
3+
public record TimetableCategoryColor(
4+
String backgroundColor,
5+
String lineColor
6+
) { }

0 commit comments

Comments
 (0)