Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] 마이페이지 알림 수신 여부 API #165

Merged
merged 2 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
11 changes: 10 additions & 1 deletion src/main/kotlin/com/psr/psr/user/controller/UserController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,15 @@ class UserController(
fun findPWSearch(@RequestBody @Validated findIdPwReq: FindIdPwReq): BaseResponse<Any>{
if(!StringUtils.hasText(findIdPwReq.email)) throw BaseException(BaseResponseCode.NOT_EMPTY_EMAIL)
userService.findPWSearch(findIdPwReq)
return BaseResponse(BaseResponseCode.SUCCESS);
return BaseResponse(BaseResponseCode.SUCCESS)
}

/**
* 마이페이지 알림 수신 여부
*/
@PostMapping("/noti")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

url은 조금 길어져도 명확하게 단어 전체 적어주는 거 어때용 /notification

fun postNotiStatus(@AuthenticationPrincipal userAccount: UserAccount, @RequestBody @Validated postNotiReq: PostNotiReq): BaseResponse<Any>{
userService.postNotiStatus(userAccount.getUser(), postNotiReq)
return BaseResponse(BaseResponseCode.SUCCESS)
}
}
8 changes: 8 additions & 0 deletions src/main/kotlin/com/psr/psr/user/dto/request/PostNotiReq.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.psr.psr.user.dto.request

import jakarta.validation.constraints.NotNull

data class PostNotiReq(
@field:NotNull
val notification: Boolean
)
7 changes: 7 additions & 0 deletions src/main/kotlin/com/psr/psr/user/service/UserService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,13 @@ class UserService(
userRepository.findByEmailAndPhoneAndStatus(findIdPwReq.email!!, findIdPwReq.phone, ACTIVE_STATUS) ?: throw BaseException(NOT_FOUND_USER)
}

// 마이페이지 알림 수신 여부
@Transactional
fun postNotiStatus(user: User, postNotiReq: PostNotiReq){
user.notification = postNotiReq.notification
userRepository.save(user)
}

// signature
private fun makeSignature(time: Long): String {
val message = StringBuilder()
Expand Down
Loading