Skip to content

Commit

Permalink
fix: 자세 알림 조회 조건 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
DongGeon0908 committed Sep 3, 2024
1 parent 16ade79 commit d9b7295
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,10 @@ class PoseNotificationService(
private val txTemplates: TransactionTemplates,
) {
suspend fun getNotification(user: AuthUser): GetPoseNotificationResponse? {
val poseNotification = findByUidAndIsActiveOrNull(user.uid, true) ?: return null
val poseNotification = findByUidOrNull(user.uid) ?: return null
return GetPoseNotificationResponse.from(poseNotification)
}

suspend fun findByUidAndIsActiveOrNull(uid: Long, isActive: Boolean): PoseNotification? {
return withContext(Dispatchers.IO) {
poseNotificationRepository.findByUidAndIsActive(uid, isActive)
}
}

suspend fun registerNotification(
user: AuthUser,
request: RegisterPoseNotificationRequest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package com.hero.alignlab.domain.notification.model.request
import com.hero.alignlab.domain.notification.domain.vo.PoseNotificationDuration

data class PatchPoseNotificationRequest(
/** 자세 알림 활성화 여부 */
val isActive: Boolean?,
/** 자세 알림 주기 */
val duration: PoseNotificationDuration?
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package com.hero.alignlab.domain.notification.model.request
import com.hero.alignlab.domain.notification.domain.vo.PoseNotificationDuration

data class RegisterPoseNotificationRequest(
/** 자세 알림 활성화 여부 */
val isActive: Boolean,
/** 자세 알림 주기 */
val duration: PoseNotificationDuration,
)
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ class PoseNotificationResource(
) {
/**
* **저장된 자세 알림 정보를 조회**
* - 활성화된 데이터가 있는 경우에만, 데이터를 제공
* - 비활성화된 경우에는, 빈 데이터를 제공
* - 조회되는 데이터가 없는 경우, 빈 데이터를 제공
* - duration
* - IMMEDIATELY : 즉시
* - MIN_15 : 15분
Expand All @@ -34,7 +33,7 @@ class PoseNotificationResource(
user: AuthUser,
) = poseNotificationService.getNotification(user).wrapOk()

@Operation(summary = "자세 알림 등록 또는 수정")
@Operation(summary = "자세 알림 등록")
@PostMapping(path = ["/api/v1/pose-notifications"])
suspend fun registerPoseNotification(
user: AuthUser,
Expand Down

0 comments on commit d9b7295

Please sign in to comment.