Skip to content

Commit 3d63dba

Browse files
committed
feat: 경우의 수 5800개 추가
1 parent 5bfb92e commit 3d63dba

File tree

3 files changed

+114
-15
lines changed

3 files changed

+114
-15
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package nexters.tuk.application.purpose
2+
3+
import nexters.tuk.application.purpose.dto.response.PurposeResponse
4+
import org.springframework.stereotype.Repository
5+
6+
7+
@Repository
8+
class InMemoryPurposeRepository {
9+
fun findAll(): PurposeResponse.Purposes {
10+
return PurposeResponse.Purposes(
11+
whatTags = InMemoryPurposeType.WHAT_TAG.tags,
12+
whereTags = InMemoryPurposeType.WHERE_TAG.tags,
13+
whenTags = InMemoryPurposeType.WHEN_TAG.tags
14+
)
15+
}
16+
}
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
package nexters.tuk.application.purpose
2+
3+
enum class InMemoryPurposeType(
4+
val tags: List<String>,
5+
) {
6+
WHEN_TAG(
7+
listOf(
8+
"새벽 4시쯤",
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+
WHERE_TAG(
38+
listOf(
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+
WHAT_TAG(
67+
listOf(
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+
}

tuk-api/src/main/kotlin/nexters/tuk/application/purpose/PurposeService.kt

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,14 @@ package nexters.tuk.application.purpose
22

33
import nexters.tuk.application.purpose.dto.response.PurposeResponse
44
import nexters.tuk.config.CacheConfig
5-
import nexters.tuk.domain.purpose.PurposeRepository
6-
import nexters.tuk.domain.purpose.PurposeType
75
import org.springframework.cache.annotation.Cacheable
86
import org.springframework.stereotype.Service
97

108
@Service
119
class PurposeService(
12-
private val purposeRepository: PurposeRepository
10+
private val inMemoryPurposeRepository: InMemoryPurposeRepository,
1311
) {
14-
@Cacheable(
15-
cacheNames = ["purpose:all"],
16-
cacheManager = CacheConfig.CACHE_WITH_30_DAYS
17-
)
1812
fun getAllPurposes(): PurposeResponse.Purposes {
19-
val purposes = purposeRepository.findAll().toList()
20-
val groupedPurposes = purposes.groupBy { it.type }
21-
22-
return PurposeResponse.Purposes(
23-
whenTags = groupedPurposes[PurposeType.WHEN_TAG]?.map { it.tag } ?: emptyList(),
24-
whereTags = groupedPurposes[PurposeType.WHERE_TAG]?.map { it.tag } ?: emptyList(),
25-
whatTags = groupedPurposes[PurposeType.WHAT_TAG]?.map { it.tag } ?: emptyList(),
26-
)
13+
return inMemoryPurposeRepository.findAll()
2714
}
2815
}

0 commit comments

Comments
 (0)