-
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.
* feat: 알림 하이라이트를 조회한다 * fix: 하이라이트조회 endpoint PathVariable 파라미터명 변경 promiseId -> promsie-id * fix: PageDefault에 size=10 명시적 표기 * style: spotless
- Loading branch information
Showing
14 changed files
with
148 additions
and
16 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
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
5 changes: 5 additions & 0 deletions
5
Whatnow-Api/src/main/kotlin/com/depromeet/whatnow/api/notification/dto/HighlightsResponse.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,5 @@ | ||
package com.depromeet.whatnow.api.notification.dto | ||
|
||
data class HighlightsResponse( | ||
val highlights: List<NotificationAbstract>, | ||
) |
46 changes: 46 additions & 0 deletions
46
...otlin/com/depromeet/whatnow/api/notification/usecase/NotificationHighlightsReadUseCase.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,46 @@ | ||
package com.depromeet.whatnow.api.notification.usecase | ||
|
||
import com.depromeet.whatnow.annotation.UseCase | ||
import com.depromeet.whatnow.api.notification.dto.ArrivalNotificationResponse | ||
import com.depromeet.whatnow.api.notification.dto.HighlightsResponse | ||
import com.depromeet.whatnow.config.security.SecurityUtils | ||
import com.depromeet.whatnow.domains.notification.domain.ArrivalNotification | ||
import com.depromeet.whatnow.domains.notification.exception.NotHighlightsTypeException | ||
import com.depromeet.whatnow.domains.notification.service.NotificationDomainService | ||
import org.springframework.data.domain.Pageable | ||
|
||
@UseCase | ||
class NotificationHighlightsReadUseCase( | ||
val notificationDomainService: NotificationDomainService, | ||
) { | ||
fun execute(promiseId: Long, pageable: Pageable): HighlightsResponse { | ||
val userId = SecurityUtils.currentUserId | ||
val highlights = notificationDomainService.getNotificationHighlights(promiseId, userId, pageable) | ||
.map { notification -> | ||
when (notification) { | ||
is ArrivalNotification -> { | ||
ArrivalNotificationResponse.from(notification) | ||
} | ||
// TODO: 만났다 이벤트 생성 된 이후 MEET Type Notification 추가 | ||
else -> throw NotHighlightsTypeException.EXCEPTION | ||
} | ||
}.toList() | ||
return HighlightsResponse(highlights) | ||
} | ||
|
||
fun executeTop3(promiseId: Long): HighlightsResponse { | ||
val listMap = notificationDomainService.getNotificationHighlightsTop3(promiseId) | ||
.map { notification -> | ||
when (notification) { | ||
is ArrivalNotification -> | ||
ArrivalNotificationResponse.from(notification) | ||
// TODO: 만났다 이벤트 생성 된 이후 MEET Type Notification 추가 | ||
else -> throw NotHighlightsTypeException.EXCEPTION | ||
} | ||
} | ||
.groupBy { it.senderUserId } | ||
|
||
val result = listMap.values.map { it.first() } | ||
return HighlightsResponse(result.sortedByDescending { it.createdAt }) | ||
} | ||
} |
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
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
11 changes: 11 additions & 0 deletions
11
...kotlin/com/depromeet/whatnow/domains/notification/exception/NotHighlightsTypeException.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,11 @@ | ||
package com.depromeet.whatnow.domains.notification.exception | ||
|
||
import com.depromeet.whatnow.exception.WhatnowCodeException | ||
|
||
class NotHighlightsTypeException : WhatnowCodeException( | ||
NotificationErrorCode.NOT_HIGH_LIGHTS_TYPE, | ||
) { | ||
companion object { | ||
val EXCEPTION: WhatnowCodeException = NotHighlightsTypeException() | ||
} | ||
} |
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