diff --git a/src/main/kotlin/com/psr/psr/user/controller/UserController.kt b/src/main/kotlin/com/psr/psr/user/controller/UserController.kt index 5cdd2d0..bbb6206 100644 --- a/src/main/kotlin/com/psr/psr/user/controller/UserController.kt +++ b/src/main/kotlin/com/psr/psr/user/controller/UserController.kt @@ -179,6 +179,14 @@ class UserController( fun findPWSearch(@RequestBody @Validated findIdPwReq: FindIdPwReq): BaseResponse{ if(!StringUtils.hasText(findIdPwReq.email)) throw BaseException(BaseResponseCode.NOT_EMPTY_EMAIL) userService.findPWSearch(findIdPwReq) - return BaseResponse(BaseResponseCode.SUCCESS); + return BaseResponse(BaseResponseCode.SUCCESS) + } + + /** + * 마이페이지 알림 수신 여부 + */ + @PostMapping("/notification") + fun postNotiStatus(@AuthenticationPrincipal userAccount: UserAccount): BaseResponse{ + return BaseResponse(userService.postNotiStatus(userAccount.getUser())) } } \ No newline at end of file diff --git a/src/main/kotlin/com/psr/psr/user/dto/response/PostNotiRes.kt b/src/main/kotlin/com/psr/psr/user/dto/response/PostNotiRes.kt new file mode 100644 index 0000000..af6d780 --- /dev/null +++ b/src/main/kotlin/com/psr/psr/user/dto/response/PostNotiRes.kt @@ -0,0 +1,11 @@ +package com.psr.psr.user.dto.response + +data class PostNotiRes( + val notification: Boolean +){ + companion object { + fun toDto(notification: Boolean) : PostNotiRes{ + return PostNotiRes(notification) + } + } +} diff --git a/src/main/kotlin/com/psr/psr/user/service/UserService.kt b/src/main/kotlin/com/psr/psr/user/service/UserService.kt index 50f0f4f..9a10ed8 100644 --- a/src/main/kotlin/com/psr/psr/user/service/UserService.kt +++ b/src/main/kotlin/com/psr/psr/user/service/UserService.kt @@ -26,6 +26,7 @@ import com.psr.psr.user.dto.eidReq.BusinessListRes import com.psr.psr.user.dto.request.* import com.psr.psr.user.dto.response.EmailRes import com.psr.psr.user.dto.response.MyPageInfoRes +import com.psr.psr.user.dto.response.PostNotiRes import com.psr.psr.user.dto.response.ProfileRes import com.psr.psr.user.entity.Category import com.psr.psr.user.entity.Type @@ -318,6 +319,14 @@ class UserService( userRepository.findByEmailAndPhoneAndStatus(findIdPwReq.email!!, findIdPwReq.phone, ACTIVE_STATUS) ?: throw BaseException(NOT_FOUND_USER) } + // 마이페이지 알림 수신 여부 + @Transactional + fun postNotiStatus(user: User) : PostNotiRes{ + user.notification = !user.notification + userRepository.save(user) + return PostNotiRes.toDto(user.notification) + } + // signature private fun makeSignature(time: Long): String { val message = StringBuilder()