Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
a0c8a77
[BOOK-408] feat: apis - deviceId값을 통한 다중기기 알림기능 개발(#127)
minwoo1999 Nov 2, 2025
a4a1403
[BOOK-408] feat: apis - deviceId값을 통한 다중기기 알림기능 개발(#127)
minwoo1999 Nov 2, 2025
8436838
[BOOK-408] feat: batch - deviceId값을 통한 다중기기 알림기능 개발(#127)
minwoo1999 Nov 2, 2025
c37e419
[BOOK-408] feat: domain - deviceId값을 통한 다중기기 알림기능 개발(#127)
minwoo1999 Nov 2, 2025
55ecc79
[BOOK-408] feat: infra - deviceId값을 통한 다중기기 알림기능 개발(#127)
minwoo1999 Nov 2, 2025
e9b934b
[BOOK-408] chore: batch - 사용하지 않는 import문 제거
move-hoon Nov 5, 2025
262a0ba
[BOOK-408] refactor: apis, infra, domain - 중복된 VO 제거
move-hoon Nov 5, 2025
c898e47
[BOOK-408] refactor: domain - Device 클래스 구조를 재정비하고, 데이터 처리를 개선하기 위해 D…
move-hoon Nov 5, 2025
1d9a28f
[BOOK-408] refactor: domain, infra - User 객체 대신 userId를 사용하도록 Notific…
move-hoon Nov 5, 2025
52c2790
[BOOK-408] chore: domain - ReadingRecordDomainService에 관한 TODO 주석처리
move-hoon Nov 5, 2025
05b8910
[BOOK-408] refactor: batch, domain - FcmNotificationJobConfig를 Notifi…
move-hoon Nov 5, 2025
58e7321
[BOOK-408] fix: domain - 누락된 중괄호 추가
move-hoon Nov 5, 2025
c13b83d
[BOOK-408] chore: batch - InfraConfig에 AOP, SENTRY 추가
move-hoon Nov 5, 2025
4e35e1c
[BOOK-408] chore: infra - dev 환경에서만 flyway를 비활성화 하도록 변경
move-hoon Nov 5, 2025
2956b4e
[BOOK-408] refactor: infra - resolve build error (#128)
minwoo1999 Nov 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.yapp.apis.auth.dto.response

import io.swagger.v3.oas.annotations.media.Schema
import org.yapp.domain.token.RefreshToken.UserId
import org.yapp.domain.user.User
import java.util.*

@Schema(
Expand All @@ -13,7 +13,7 @@ data class UserIdResponse(
val userId: UUID
) {
companion object {
fun from(userId: UserId): UserIdResponse {
fun from(userId: User.Id): UserIdResponse {
return UserIdResponse(userId.value)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import jakarta.validation.Valid
import org.springframework.http.ResponseEntity
import org.springframework.security.core.annotation.AuthenticationPrincipal
import org.springframework.web.bind.annotation.*
import org.yapp.apis.user.dto.request.FcmTokenRequest
import org.yapp.apis.user.dto.request.DeviceRequest
import org.yapp.apis.user.dto.request.NotificationSettingsRequest
import org.yapp.apis.user.dto.request.TermsAgreementRequest
import org.yapp.apis.user.dto.response.UserProfileResponse
Expand Down Expand Up @@ -42,12 +42,12 @@ class UserController(
return ResponseEntity.ok(userProfile)
}

@PutMapping("/me/fcm-token")
override fun updateFcmToken(
@PutMapping("/me/devices")
override fun registerDevice(
@AuthenticationPrincipal userId: UUID,
@Valid @RequestBody request: FcmTokenRequest
@Valid @RequestBody request: DeviceRequest
): ResponseEntity<UserProfileResponse> {
val userProfile = userUseCase.updateFcmToken(userId, request)
val userProfile = userUseCase.registerDevice(userId, request)
return ResponseEntity.ok(userProfile)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PutMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.yapp.apis.user.dto.request.FcmTokenRequest
import org.yapp.apis.user.dto.request.DeviceRequest
import org.yapp.apis.user.dto.request.NotificationSettingsRequest
import org.yapp.apis.user.dto.request.TermsAgreementRequest
import org.yapp.apis.user.dto.response.UserProfileResponse
Expand Down Expand Up @@ -122,14 +122,14 @@ interface UserControllerApi {
): ResponseEntity<UserProfileResponse>

@Operation(
summary = "FCM 토큰 등록",
description = "사용자의 FCM 토큰을 등록합니다."
summary = "디바이스 등록",
description = "사용자의 디바이스를 등록합니다. 이미 등록된 디바이스인 경우 FCM 토큰을 업데이트합니다."
)
@ApiResponses(
value = [
ApiResponse(
responseCode = "200",
description = "FCM 토큰 등록 성공",
description = "디바이스 등록 또는 업데이트 성공",
content = [Content(schema = Schema(implementation = UserProfileResponse::class))]
),
ApiResponse(
Expand All @@ -149,9 +149,9 @@ interface UserControllerApi {
)
]
)
@PutMapping("/me/fcm-token")
fun updateFcmToken(
@PutMapping("/me/devices")
fun registerDevice(
@Parameter(hidden = true) @AuthenticationPrincipal userId: UUID,
@Valid @RequestBody @Parameter(description = "FCM 토큰 요청 객체") request: FcmTokenRequest
@Valid @RequestBody @Parameter(description = "디바이스 정보 요청 객체") request: DeviceRequest
): ResponseEntity<UserProfileResponse>
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@ import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotBlank

@Schema(
name = "FcmTokenRequest",
description = "DTO for FCM token update requests"
name = "DeviceRequest",
description = "DTO for device update requests"
)
data class FcmTokenRequest private constructor(
data class DeviceRequest private constructor(
@field:Schema(
description = "디바이스 아이디",
example = "c8a9d7d0-4f6a-4b1a-8f0a-9d8e7f6a4b1a",
required = true
)
@field:NotBlank(message = "디바이스 아이디는 필수입니다.")
val deviceId: String? = null,

@field:Schema(
description = "FCM 토큰",
example = "epGzIKlHScicTBrbt26pFG:APA91bG-ZPD-KMJyS-JOiflEPUIVvrp8l9DFBN2dlNG8IHw8mFlkAPok7dVPFJR4phc9061KPztkAIjBJaryZLnv6vIJXNGQsykzDcok3wFC9LrsC-F_aKY",
Expand All @@ -16,5 +24,6 @@ data class FcmTokenRequest private constructor(
@field:NotBlank(message = "FCM 토큰은 필수입니다.")
val fcmToken: String? = null
) {
fun validDeviceId(): String = deviceId!!.trim()
fun validFcmToken(): String = fcmToken!!.trim()
}
13 changes: 8 additions & 5 deletions apis/src/main/kotlin/org/yapp/apis/user/service/UserService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,21 @@ package org.yapp.apis.user.service
import jakarta.validation.Valid
import org.yapp.apis.auth.exception.AuthErrorCode
import org.yapp.apis.auth.exception.AuthException
import org.yapp.apis.user.dto.request.FcmTokenRequest
import org.yapp.apis.user.dto.request.DeviceRequest
import org.yapp.apis.user.dto.request.FindUserIdentityRequest
import org.yapp.apis.user.dto.request.NotificationSettingsRequest
import org.yapp.apis.user.dto.request.TermsAgreementRequest
import org.yapp.apis.user.dto.response.UserAuthInfoResponse
import org.yapp.apis.user.dto.response.UserProfileResponse
import org.yapp.domain.device.DeviceDomainService
import org.yapp.domain.user.UserDomainService
import org.yapp.globalutils.annotation.ApplicationService
import java.util.*

@ApplicationService
class UserService(
private val userDomainService: UserDomainService
private val userDomainService: UserDomainService,
private val deviceDomainService: DeviceDomainService
) {
fun findUserProfileByUserId(userId: UUID): UserProfileResponse {
val userProfile = userDomainService.findUserProfileById(userId)
Expand Down Expand Up @@ -45,9 +47,10 @@ class UserService(
return UserProfileResponse.from(updatedUserProfile)
}

fun updateFcmToken(userId: UUID, @Valid request: FcmTokenRequest): UserProfileResponse {
fun registerDevice(userId: UUID, @Valid request: DeviceRequest): UserProfileResponse {
validateUserExists(userId)
val updatedUserProfile = userDomainService.updateFcmToken(userId, request.validFcmToken())
return UserProfileResponse.from(updatedUserProfile)
deviceDomainService.findOrCreateDevice(userId, request.validDeviceId(), request.validFcmToken())
val userProfile = userDomainService.findUserProfileById(userId)
return UserProfileResponse.from(userProfile)
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.yapp.apis.user.usecase

import org.springframework.transaction.annotation.Transactional
import org.yapp.apis.user.dto.request.FcmTokenRequest
import org.yapp.apis.user.dto.request.DeviceRequest
import org.yapp.apis.user.dto.request.NotificationSettingsRequest
import org.yapp.apis.user.dto.request.TermsAgreementRequest
import org.yapp.apis.user.dto.response.UserProfileResponse
Expand Down Expand Up @@ -29,7 +29,7 @@ class UserUseCase(
}

@Transactional
fun updateFcmToken(userId: UUID, request: FcmTokenRequest): UserProfileResponse {
return userService.updateFcmToken(userId, request)
fun registerDevice(userId: UUID, request: DeviceRequest): UserProfileResponse {
return userService.registerDevice(userId, request)
}
}
7 changes: 4 additions & 3 deletions batch/src/main/kotlin/org/yapp/batch/config/InfraConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import org.yapp.infra.InfraBaseConfigGroup
@Configuration(proxyBeanMethods = false)
@EnableInfraBaseConfig(
[
InfraBaseConfigGroup.JPA
InfraBaseConfigGroup.JPA,
InfraBaseConfigGroup.AOP,
InfraBaseConfigGroup.SENTRY
]
)
class InfraConfig {
}
class InfraConfig
Loading