-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
445 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
Whatnow-Api/src/main/kotlin/com/depromeet/whatnow/api/image/dto/ImageCommentElement.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.depromeet.whatnow.api.image.dto | ||
|
||
import com.depromeet.whatnow.domains.image.domain.PromiseImageCommentType | ||
import com.depromeet.whatnow.domains.promiseuser.domain.PromiseUserType | ||
|
||
data class ImageCommentElement( | ||
val promiseUserType: PromiseUserType, | ||
val comments: List<PromiseImageCommentType>, | ||
) |
18 changes: 18 additions & 0 deletions
18
...ow-Api/src/main/kotlin/com/depromeet/whatnow/api/image/usecase/ImageCommentReadUseCase.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.depromeet.whatnow.api.image.usecase | ||
|
||
import com.depromeet.whatnow.annotation.UseCase | ||
import com.depromeet.whatnow.api.image.dto.ImageCommentElement | ||
import com.depromeet.whatnow.domains.image.domain.PromiseImageCommentType | ||
|
||
@UseCase | ||
class ImageCommentReadUseCase { | ||
fun execute(): List<ImageCommentElement> { | ||
return PromiseImageCommentType.values().groupBy { | ||
p -> | ||
p.promiseUserType | ||
}.map { | ||
(k, value) -> | ||
ImageCommentElement(k, value) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...test/kotlin/com/depromeet/whatnow/api/promiseuser/usecase/PromiseUserDomainServiceTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.depromeet.whatnow.api.promiseuser.usecase | ||
|
||
import com.depromeet.whatnow.common.vo.CoordinateVo | ||
import com.depromeet.whatnow.domains.promiseuser.adaptor.PromiseUserAdaptor | ||
import com.depromeet.whatnow.domains.promiseuser.domain.PromiseUser | ||
import com.depromeet.whatnow.domains.promiseuser.service.PromiseUserDomainService | ||
import org.junit.jupiter.api.Assertions.assertEquals | ||
import org.junit.jupiter.api.BeforeEach | ||
import org.junit.jupiter.api.Test | ||
import org.mockito.Mock | ||
import org.mockito.MockitoAnnotations | ||
|
||
class PromiseUserDomainServiceTest { | ||
@Mock | ||
private lateinit var promiseUserAdaptor: PromiseUserAdaptor | ||
|
||
private lateinit var promiseUserDomainService: PromiseUserDomainService | ||
|
||
@BeforeEach | ||
fun setUp() { | ||
MockitoAnnotations.openMocks(this) | ||
promiseUserDomainService = PromiseUserDomainService(promiseUserAdaptor = promiseUserAdaptor) | ||
} | ||
|
||
@Test | ||
fun `500미터 안에 인접해 있으면 도착했다 정의`() { | ||
val a = PromiseUser(userLocation = CoordinateVo(35.866334, 127.146223), promiseId = 1L, userId = 1L) | ||
val b = CoordinateVo(35.866355, 127.146230) | ||
// 실제 거리 : 2.41878882096224 m | ||
// when and return | ||
val arrived = promiseUserDomainService.isArrived(a, b) | ||
assertEquals(true, arrived) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
Whatnow-Domain/src/main/kotlin/com/depromeet/whatnow/config/RedisMessageListenerConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.depromeet.whatnow.config | ||
|
||
import com.depromeet.whatnow.consts.REDIS_EXPIRE_EVENT_PATTERN | ||
import com.depromeet.whatnow.domains.promiseactive.listener.RedisExpireEventRedisMessageListener | ||
import org.springframework.context.annotation.Bean | ||
import org.springframework.context.annotation.Configuration | ||
import org.springframework.data.redis.connection.RedisConnectionFactory | ||
import org.springframework.data.redis.listener.PatternTopic | ||
import org.springframework.data.redis.listener.RedisMessageListenerContainer | ||
|
||
@Configuration | ||
class RedisMessageListenerConfig { | ||
@Bean | ||
fun redisMessageListenerContainer( | ||
redisConnectionFactory: RedisConnectionFactory, | ||
redisExpireEventRedisMessageListener: RedisExpireEventRedisMessageListener, | ||
): RedisMessageListenerContainer { | ||
val redisMessageListenerContainer = RedisMessageListenerContainer() | ||
redisMessageListenerContainer.setConnectionFactory(redisConnectionFactory) | ||
redisMessageListenerContainer.addMessageListener(redisExpireEventRedisMessageListener, PatternTopic(REDIS_EXPIRE_EVENT_PATTERN)) | ||
return redisMessageListenerContainer | ||
} | ||
} |
31 changes: 20 additions & 11 deletions
31
...ain/src/main/kotlin/com/depromeet/whatnow/domains/image/domain/PromiseImageCommentType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,28 @@ | ||
package com.depromeet.whatnow.domains.image.domain | ||
|
||
import com.depromeet.whatnow.consts.ASSERT_IMAGE_DOMAIN | ||
import com.depromeet.whatnow.domains.promiseuser.domain.PromiseUserType | ||
import com.fasterxml.jackson.annotation.JsonFormat | ||
|
||
enum class PromiseImageCommentType(val value: String, val promiseUserType: PromiseUserType?) { | ||
@JsonFormat(shape = JsonFormat.Shape.OBJECT) | ||
enum class PromiseImageCommentType( | ||
val promiseUserType: PromiseUserType, | ||
val kr: String, | ||
val code: String, | ||
val image: String, | ||
val imageSmall: String, | ||
) { | ||
// Can LATE | ||
RUNNING("달려가는 중️", PromiseUserType.LATE), | ||
GASPING("헐레벌떡", PromiseUserType.LATE), | ||
LEAVE_SOME("남겨놔!", PromiseUserType.LATE), | ||
WAIT_A_BIT("조금만 기다려", PromiseUserType.LATE), | ||
SORRY_LATE("늦어서 미안해", PromiseUserType.LATE), | ||
RUNNING(PromiseUserType.LATE, "달려가는 중️", "RUNNING", "$ASSERT_IMAGE_DOMAIN/comments/RUNNING.svg", "$ASSERT_IMAGE_DOMAIN/comments/RUNNING_SMALL.svg"), | ||
GASPING(PromiseUserType.LATE, "헐레벌떡", "GASPING", "$ASSERT_IMAGE_DOMAIN/comments/GASPING.svg", "$ASSERT_IMAGE_DOMAIN/comments/GASPING_SMALL.svg"), | ||
LEAVE_SOME(PromiseUserType.LATE, "남겨놔!", "LEAVE_SOME", "$ASSERT_IMAGE_DOMAIN/comments/LEAVE_SOME.svg", "$ASSERT_IMAGE_DOMAIN/comments/LEAVE_SOME_SMALL.svg"), | ||
WAIT_A_BIT(PromiseUserType.LATE, "조금만 기다려", "WAIT_A_BIT", "$ASSERT_IMAGE_DOMAIN/comments/WAIT_A_BIT.svg", "$ASSERT_IMAGE_DOMAIN/comments/WAIT_A_BIT_SMALL.svg"), | ||
SORRY_LATE(PromiseUserType.LATE, "늦어서 미안해", "SORRY_LATE", "$ASSERT_IMAGE_DOMAIN/comments/SORRY_LATE.svg", "$ASSERT_IMAGE_DOMAIN/comments/SORRY_LATE_SMALL.svg"), | ||
|
||
// Can WAIT | ||
WHAT_ARE_YOU_DOING("뭐해 심심해", PromiseUserType.WAIT), | ||
WHAT_TIME_IS_IT_NOW("지금이 몇시야!", PromiseUserType.WAIT), | ||
DID_YOU_COME("왔나..?", PromiseUserType.WAIT), | ||
I_LL_EAT_FIRST("먼저 먹을게~", PromiseUserType.WAIT), | ||
WHERE_ARE_YOU("너 어디야?", PromiseUserType.WAIT), | ||
WHAT_ARE_YOU_DOING(PromiseUserType.WAIT, "뭐해 심심해", "WHAT_ARE_YOU_DOING", "$ASSERT_IMAGE_DOMAIN/comments/WHAT_ARE_YOU_DOING.svg", "$ASSERT_IMAGE_DOMAIN/comments/WHAT_ARE_YOU_DOING_SMALL.svg"), | ||
WHAT_TIME_IS_IT_NOW(PromiseUserType.WAIT, "지금이 몇시야!", "WHAT_TIME_IS_IT_NOW", "$ASSERT_IMAGE_DOMAIN/comments/WHAT_TIME_IS_IT_NOW.svg", "$ASSERT_IMAGE_DOMAIN/comments/WHAT_TIME_IS_IT_NOW_SMALL.svg"), | ||
DID_YOU_COME(PromiseUserType.WAIT, "왔나..?", "DID_YOU_COME", "$ASSERT_IMAGE_DOMAIN/comments/DID_YOU_COME.svg", "$ASSERT_IMAGE_DOMAIN/comments/DID_YOU_COME_SMALL.svg"), | ||
I_LL_EAT_FIRST(PromiseUserType.WAIT, "먼저 먹을게~", "I_LL_EAT_FIRST", "$ASSERT_IMAGE_DOMAIN/comments/I_LL_EAT_FIRST.svg", "$ASSERT_IMAGE_DOMAIN/comments/I_LL_EAT_FIRST_SMALL.svg"), | ||
WHERE_ARE_YOU(PromiseUserType.WAIT, "너 어디야?", "WHERE_ARE_YOU", "$ASSERT_IMAGE_DOMAIN/comments/WHERE_ARE_YOU.svg", "$ASSERT_IMAGE_DOMAIN/comments/WHERE_ARE_YOU_SMALL.svg"), | ||
} |
28 changes: 15 additions & 13 deletions
28
...n/src/main/kotlin/com/depromeet/whatnow/domains/progresshistory/domain/PromiseProgress.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,26 @@ | ||
package com.depromeet.whatnow.domains.progresshistory.domain | ||
|
||
import com.depromeet.whatnow.consts.ASSERT_IMAGE_DOMAIN | ||
import com.fasterxml.jackson.annotation.JsonFormat | ||
|
||
@JsonFormat(shape = JsonFormat.Shape.OBJECT) | ||
enum class PromiseProgress( | ||
val progressGroup: PromiseProgressGroup, | ||
val kr: String, | ||
val code: String, | ||
val image: String, | ||
) { | ||
SHOWER(PromiseProgressGroup.PREPARING, "씻는 중", "SHOWER"), | ||
LEAVE_SOON(PromiseProgressGroup.PREPARING, "곧 나가", "LEAVE_SOON"), | ||
BED(PromiseProgressGroup.PREPARING, "아직 침대", "BED"), | ||
WALKING(PromiseProgressGroup.MOVING, "걸어가는 중", "WALKING"), | ||
RUNNING(PromiseProgressGroup.MOVING, "뛰고 있어", "RUNNING"), | ||
BOARDING(PromiseProgressGroup.MOVING, "탑승 중", "BOARDING"), | ||
SORRY(PromiseProgressGroup.LATE, "미안해", "SORRY"), | ||
TEAR(PromiseProgressGroup.LATE, "눈물 줄줄", "TEAR"), | ||
URGENCY(PromiseProgressGroup.LATE, "급하다!!", "URGENCY"), | ||
AFTER_SOON(PromiseProgressGroup.EXPECTED_TIME, "곧 도착", "AFTER_SOON"), | ||
AFTER_5(PromiseProgressGroup.EXPECTED_TIME, "5분 뒤 도착", "AFTER_5"), | ||
AFTER_10(PromiseProgressGroup.EXPECTED_TIME, "10분 뒤 도착", "AFTER_10"), | ||
DEFAULT(PromiseProgressGroup.DEFAULT, "기본", "DEFAULT"), | ||
SHOWER(PromiseProgressGroup.PREPARING, "씻는 중", "SHOWER", "$ASSERT_IMAGE_DOMAIN/progresses/SHOWER.svg"), | ||
LEAVE_SOON(PromiseProgressGroup.PREPARING, "곧 나가", "LEAVE_SOON", "$ASSERT_IMAGE_DOMAIN/progresses/LEAVE_SOON.svg"), | ||
BED(PromiseProgressGroup.PREPARING, "아직 침대", "BED", "$ASSERT_IMAGE_DOMAIN/progresses/BED.svg"), | ||
WALKING(PromiseProgressGroup.MOVING, "걸어가는 중", "WALKING", "$ASSERT_IMAGE_DOMAIN/progresses/WALKING.svg"), | ||
RUNNING(PromiseProgressGroup.MOVING, "뛰고 있어", "RUNNING", "$ASSERT_IMAGE_DOMAIN/progresses/RUNNING.svg"), | ||
BOARDING(PromiseProgressGroup.MOVING, "탑승 중", "BOARDING", "$ASSERT_IMAGE_DOMAIN/progresses/BOARDING.svg"), | ||
SORRY(PromiseProgressGroup.LATE, "미안해", "SORRY", "$ASSERT_IMAGE_DOMAIN/progresses/SORRY.svg"), | ||
TEAR(PromiseProgressGroup.LATE, "눈물 줄줄", "TEAR", "$ASSERT_IMAGE_DOMAIN/progresses/TEAR.svg"), | ||
URGENCY(PromiseProgressGroup.LATE, "급하다!!", "URGENCY", "$ASSERT_IMAGE_DOMAIN/progresses/URGENCY.svg"), | ||
AFTER_SOON(PromiseProgressGroup.EXPECTED_TIME, "곧 도착", "AFTER_SOON", "$ASSERT_IMAGE_DOMAIN/progresses/AFTER_SOON.svg"), | ||
AFTER_5(PromiseProgressGroup.EXPECTED_TIME, "5분 뒤 도착", "AFTER_5", "$ASSERT_IMAGE_DOMAIN/progresses/AFTER_5.svg"), | ||
AFTER_10(PromiseProgressGroup.EXPECTED_TIME, "10분 뒤 도착", "AFTER_10", "$ASSERT_IMAGE_DOMAIN/progresses/AFTER_10.svg"), | ||
DEFAULT(PromiseProgressGroup.DEFAULT, "기본", "DEFAULT", "$ASSERT_IMAGE_DOMAIN/progresses/DEFAULT.svg"), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...c/main/kotlin/com/depromeet/whatnow/domains/promiseactive/adapter/PromiseActiveAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.depromeet.whatnow.domains.promiseactive.adapter | ||
|
||
import com.depromeet.whatnow.annotation.Adapter | ||
import com.depromeet.whatnow.domains.promiseactive.domain.PromiseActiveRedisEntity | ||
import com.depromeet.whatnow.domains.promiseactive.repository.PromiseActiveRepository | ||
|
||
@Adapter | ||
class PromiseActiveAdapter( | ||
val promiseActiveRepository: PromiseActiveRepository, | ||
) { | ||
fun save(promiseActiveRedisEntity: PromiseActiveRedisEntity): PromiseActiveRedisEntity { | ||
return promiseActiveRepository.save(promiseActiveRedisEntity) | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...ain/kotlin/com/depromeet/whatnow/domains/promiseactive/domain/PromiseActiveRedisEntity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.depromeet.whatnow.domains.promiseactive.domain | ||
|
||
import org.springframework.data.annotation.Id | ||
import org.springframework.data.redis.core.RedisHash | ||
import org.springframework.data.redis.core.TimeToLive | ||
|
||
@RedisHash(value = "promiseActive") | ||
class PromiseActiveRedisEntity( | ||
@Id | ||
var key: String, | ||
|
||
@TimeToLive // TTL | ||
var ttl: Long, | ||
) |
Oops, something went wrong.