Skip to content

Commit

Permalink
#160 fix: 마이페이지 알림 수신 여부 API uri 수정 및 response 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
chaerlo127 committed Sep 5, 2023
1 parent 70fa53d commit ce9f017
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
7 changes: 3 additions & 4 deletions src/main/kotlin/com/psr/psr/user/controller/UserController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,8 @@ class UserController(
/**
* 마이페이지 알림 수신 여부
*/
@PostMapping("/noti")
fun postNotiStatus(@AuthenticationPrincipal userAccount: UserAccount, @RequestBody @Validated postNotiReq: PostNotiReq): BaseResponse<Any>{
userService.postNotiStatus(userAccount.getUser(), postNotiReq)
return BaseResponse(BaseResponseCode.SUCCESS)
@PostMapping("/notification")
fun postNotiStatus(@AuthenticationPrincipal userAccount: UserAccount): BaseResponse<Any>{
return BaseResponse(userService.postNotiStatus(userAccount.getUser()))
}
}
8 changes: 0 additions & 8 deletions src/main/kotlin/com/psr/psr/user/dto/request/PostNotiReq.kt

This file was deleted.

11 changes: 11 additions & 0 deletions src/main/kotlin/com/psr/psr/user/dto/response/PostNotiRes.kt
Original file line number Diff line number Diff line change
@@ -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)
}
}
}
6 changes: 4 additions & 2 deletions src/main/kotlin/com/psr/psr/user/service/UserService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -320,9 +321,10 @@ class UserService(

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

// signature
Expand Down

0 comments on commit ce9f017

Please sign in to comment.