-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCakeFacade.java
More file actions
143 lines (119 loc) Β· 6.67 KB
/
CakeFacade.java
File metadata and controls
143 lines (119 loc) Β· 6.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
package com.cakey.cake.facade;
import com.cakey.cake.domain.Cake;
import com.cakey.cake.domain.DayCategory;
import com.cakey.cake.dto.*;
import com.cakey.caketheme.domain.ThemeName;
import com.cakey.store.domain.Station;
import com.cakey.store.dto.StoreBySelectedCakeDto;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Component
@RequiredArgsConstructor
public class CakeFacade {
private final CakeRetriever cakeRetriever;
//μ€ν μ΄ λν μ΄λ―Έμ§ μ‘°ν
public List<CakeMainImageDto> findMainImageByStoreIds(final List<Long> storeIds) {
return cakeRetriever.findMainImageByStoreIds(storeIds);
}
//λ©μΈμ΄λ―Έμ§ λ§€ν
public Map<Long, List<CakeMainImageDto>> getMainImageMap(final List<Long> storeIds) {
//μ€ν μ΄ λν μ΄λ―Έμ§ μ‘°ν
final List<CakeMainImageDto> cakeMainImageDtos = findMainImageByStoreIds(storeIds);
// μ΄λ―Έμ§λ₯Ό storeId κΈ°μ€μΌλ‘ κ·Έλ£Ήν
return cakeMainImageDtos.stream()
.collect(Collectors.groupingBy(CakeMainImageDto::getStoreId));
}
//ν΄λΉμ μ€ν μ΄μ λμμΈ μ‘°ν
public List<CakeInfoDto> findPopularCakesByStation(final Long userId,
final Station station,
final Integer likesCursor,
final Long cakeIdCursor,
final int size) {
return cakeRetriever.findPopularCakesByStation(userId, station, likesCursor, cakeIdCursor, size);
}
public int countCakesByStation(final Station station) {
return cakeRetriever.countCakesByStation(station);
}
public List<CakeInfoDto> findLatestCakesByStation(final Long userId, final Station station, final Long cakeIdCursor, final int size) {
return cakeRetriever.findCakesByStation(userId, station, cakeIdCursor, size);
}
public List<Cake> findAllByStoreId(final long storeId) {
return cakeRetriever.findAllByStoreId(storeId);
}
public List<CakeByPopularityDto> findCakeByRank(final Long userId) {
return cakeRetriever.findCakesByRank(userId);
}
public Cake findById(final long cakeId) {
return cakeRetriever.findById(cakeId);
}
//μ°ν λμμΈ(μΌμ΄ν¬) μ‘°ν(μ΅μ μ)
public List<CakeInfoDto> findLatestLikedCakesByUser(final Long userId,
final Long cakeIdCursor,
final int size) {
return cakeRetriever.findLatestLikedCakesByUser(userId, cakeIdCursor, size);
}
//μ°ν λμμΈ(μΌμ΄ν¬) μ‘°ν(μΈκΈ°μ)
public List<CakeInfoDto> findPopularLikedCakesByUser(final long userId,
final Long cakeIdCursor,
final Integer cakeLikesCursor,
final int size) {
return cakeRetriever.findPopularLikedCakesByUser(userId, cakeIdCursor, cakeLikesCursor, size);
}
//κ°μ μ€ν μ΄, μΉ΄ν
κ³ λ¦¬, ν
λ§μ μΌμ΄ν¬ μ‘°ν
public List<CakeSelectedInfoDto> findCakesByStoreAndConditions(final Long storeId,
final DayCategory dayCategory,
final ThemeName theme,
final Long userId,
final Long cakeId) {
return cakeRetriever.findCakesByStoreAndConditions(storeId, dayCategory, theme, userId, cakeId);
}
//λμμΈ λλ¬λ³΄κΈ° μ‘°ν(μ΅μ μ)
public List<CakeInfoDto> findCakesByCategoryAndTheme(final DayCategory dayCategory,
final ThemeName theme,
final Long userId,
final Long cakeIdCursor,
final int limit) {
return cakeRetriever.findCakesByCategoryAndTheme(dayCategory, theme, userId, cakeIdCursor, limit);
}
//λμμΈ λλ¬λ³΄κΈ° μ‘°ν(μΈκΈ°μ)
public List<CakeInfoDto> findPopularCakesByCategoryAndTheme(final DayCategory dayCategory,
final ThemeName themeName,
final Long userId,
final Long cakeIdCursor,
final Integer cakeLikesCursor,
final int size) {
return cakeRetriever.findPopularCakesByCategoryAndTheme(dayCategory, themeName, userId, cakeIdCursor, cakeLikesCursor, size);
}
//μ°ν μ€ν μ΄λ€ λμμΈ μ‘°ν(μ΅μ μ)
public List<CakeInfoDto> findCakesLikedByUser(final long userId,
final Long cakeIdCursor,
final int size) {
return cakeRetriever.findCakesLikedByUser(userId, cakeIdCursor, size);
}
//μ°ν μ€ν μ΄λ€ λμμΈ μ‘°ν(μΈκΈ°μ)
public List<CakeInfoDto> findPopularCakesLikedByUser(final long userId,
final Long cakeIdCursor,
final Integer cakeLikesCursor,
final int size) {
return cakeRetriever.findPopularCakesLikedByUser(userId, cakeIdCursor, cakeLikesCursor, size);
}
//μΉ΄ν
κ³ λ¦¬, ν
λ§μ ν΄λΉνλ μΌμ΄ν¬ κ°μ
public int countCakesByCategoryAndTheme(final DayCategory dayCategory, final ThemeName theme) {
return cakeRetriever.countCakesByCategoryAndTheme(dayCategory, theme);
}
//μ°ν λͺ¨λ μ€ν μ΄ λͺ¨λ λμμΈ κ°μ
public int countAllDesignsLikedByUser(final Long userId) {
return cakeRetriever.countAllDesignsLikedByUser(userId);
}
//μΌμ΄ν¬ μ‘΄μ¬μ¬λΆ
public void isExistCake(final long cakeId) {
cakeRetriever.isExistCake(cakeId);
}
//μ§λλ·° μ‘°νλ λμμΈ μ‘°ν
public CakeSelectedMapDto getCakeSelectedMap(final Long userId, final long cakeId) {
return cakeRetriever.getCakeSelectedMap(userId, cakeId);
}
}