-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feat/#29
- Loading branch information
Showing
13 changed files
with
197 additions
and
19 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
plu-api/src/main/kotlin/com/th/plu/api/controller/member/MemberController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package com.th.plu.api.controller.member | ||
|
||
import com.th.plu.api.config.interceptor.Auth | ||
import com.th.plu.api.config.resolver.MemberId | ||
import com.th.plu.api.controller.member.dto.request.CheckNicknameRequestDto | ||
import com.th.plu.api.controller.member.dto.request.UpdateNicknameRequestDto | ||
import com.th.plu.api.controller.member.dto.response.CheckNicknameResponse | ||
import com.th.plu.api.controller.member.dto.response.MyPageResponseDto | ||
import com.th.plu.api.service.member.MemberService | ||
import com.th.plu.common.dto.response.ApiResponse | ||
import io.swagger.v3.oas.annotations.Operation | ||
import io.swagger.v3.oas.annotations.tags.Tag | ||
import org.springframework.web.bind.annotation.* | ||
|
||
@Tag(name = "Member") | ||
@RestController | ||
class MemberController( | ||
private val memberService: MemberService, | ||
) { | ||
@Operation(summary = "닉네임 중복 체크") | ||
@PostMapping("/api/v1/member/nickname/dupl") | ||
fun checkNicknameDuplication(@RequestBody request: CheckNicknameRequestDto): ApiResponse<CheckNicknameResponse> { | ||
val response = memberService.checkNicknameDuplication(request) | ||
return ApiResponse.success(response) | ||
} | ||
|
||
@Auth | ||
@Operation(summary = "[인증] 닉네임 수정") | ||
@PutMapping("/api/v1/member/{memberId}/nickname") | ||
fun updateNickname( | ||
@PathVariable memberId: Long, | ||
@RequestBody request: UpdateNicknameRequestDto | ||
): ApiResponse<Any> { | ||
memberService.updateNickname(memberId, request.newNickname) | ||
return ApiResponse.success() | ||
} | ||
|
||
@Auth | ||
@Operation(summary = "[인증] 회원 탈퇴") | ||
@DeleteMapping("/api/v1/member") | ||
fun deleteMember(@MemberId memberId: Long): ApiResponse<Any> { | ||
memberService.deleteMember(memberId) | ||
return ApiResponse.success() | ||
} | ||
|
||
@Auth | ||
@Operation(summary = "[인증] 마이페이지 조회") | ||
@GetMapping("/api/v1/mypage") | ||
fun getMyPageInfo(@MemberId memberId: Long): ApiResponse<MyPageResponseDto> { | ||
val myPageInfo = memberService.getMyPageInfo(memberId) | ||
return ApiResponse.success(data = myPageInfo) | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
...i/src/main/kotlin/com/th/plu/api/controller/member/dto/request/CheckNicknameRequestDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.th.plu.api.controller.member.dto.request | ||
|
||
data class CheckNicknameRequestDto( | ||
val nickname: String | ||
) |
5 changes: 5 additions & 0 deletions
5
.../src/main/kotlin/com/th/plu/api/controller/member/dto/request/UpdateNicknameRequestDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.th.plu.api.controller.member.dto.request | ||
|
||
data class UpdateNicknameRequestDto( | ||
val newNickname: String | ||
) |
5 changes: 5 additions & 0 deletions
5
...src/main/kotlin/com/th/plu/api/controller/member/dto/response/CheckNickNameResponseDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.th.plu.api.controller.member.dto.response | ||
|
||
data class CheckNicknameResponse( | ||
val isAvailable: Boolean | ||
) |
6 changes: 6 additions & 0 deletions
6
plu-api/src/main/kotlin/com/th/plu/api/controller/member/dto/response/MyPageResponseDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.th.plu.api.controller.member.dto.response | ||
|
||
data class MyPageResponseDto( | ||
val nickname: String, | ||
val notificationStatus: Boolean | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
plu-api/src/main/kotlin/com/th/plu/api/service/answer/AnswerValidator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.th.plu.api.service.answer | ||
|
||
import com.th.plu.common.exception.code.ErrorCode | ||
import com.th.plu.common.exception.model.ValidationException | ||
import com.th.plu.domain.domain.answer.explorer.AnswerExplorer | ||
import com.th.plu.domain.domain.answer.repository.AnswerRepository | ||
import org.springframework.stereotype.Component | ||
|
||
@Component | ||
class AnswerValidator( | ||
private val answerExplorer: AnswerExplorer, | ||
private val answerRepository: AnswerRepository | ||
) { | ||
fun validateIsMemberOwnerOfAnswer(answerId: Long, memberId: Long) { | ||
val answer = answerExplorer.findAnswerById(answerId) | ||
if (answer.member.id != memberId) { | ||
throw ValidationException(ErrorCode.INVALID_ANSWER_OWNER, | ||
"멤버 (ID: ${memberId})는 답변 (ID: ${answerId})의 답변자가 아니기 때문에 답변 정보에 접근할 수 없습니다.") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters