Skip to content

Commit

Permalink
Merge pull request #79 from GSM-MSG/78-entire-refactoring
Browse files Browse the repository at this point in the history
🔀 :: 리팩토링이긴한데 사서 하는일
  • Loading branch information
baekteun authored Feb 18, 2023
2 parents 820d79b + f98c8ca commit 37e26e0
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ class AuthController(
private val signupImageUploadService: SignupImageUploadService,
) {
@PatchMapping
fun refresh(@RequestHeader("RefreshToken") refreshToken: String): ResponseEntity<RefreshResponseDto> =
ResponseEntity.ok(refreshService.execute(refreshToken))
fun refresh(@RequestHeader("RefreshToken") refreshToken: String): ResponseEntity<RefreshResponseDto> {
val result = refreshService.execute(refreshToken)
return ResponseEntity.ok(result)
}

@DeleteMapping
fun logout(): ResponseEntity<Void> {
Expand All @@ -35,9 +37,10 @@ class AuthController(
}

@PostMapping
fun signin(@Valid @RequestBody signinRequestDto: SigninRequestDto): ResponseEntity<SigninResponseDto> =
ResponseEntity.ok(signInService.execute(signinRequestDto))

fun signin(@Valid @RequestBody signinRequestDto: SigninRequestDto): ResponseEntity<SigninResponseDto> {
val result = signInService.execute(signinRequestDto)
return ResponseEntity.ok(result)
}

@PostMapping("/signup")
fun signUpMember(@Valid @RequestBody signUpDto: SignUpDto): ResponseEntity<Void> {
Expand All @@ -46,8 +49,10 @@ class AuthController(
}

@PatchMapping("/image")
fun uploadSignupImage(@RequestPart("image") image: MultipartFile, @RequestPart("imageUrl") previousUrl: String?, @RequestPart email: String): ResponseEntity<SignupImageResDto> =
ResponseEntity.ok(signupImageUploadService.execute(image, previousUrl, email))
fun uploadSignupImage(@RequestPart("image") image: MultipartFile, @RequestPart("imageUrl") previousUrl: String?, @RequestPart email: String): ResponseEntity<SignupImageResDto> {
val result = signupImageUploadService.execute(image, previousUrl, email)
return ResponseEntity.ok(result)
}


@PatchMapping("/password/initialize")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ class LogoutService(
) {
fun execute() {
val currentUser = userUtil.fetchCurrentUser()
refreshTokenRepository.findByUserId(currentUser.id)?.let {
refreshTokenRepository.delete(it)
}
refreshTokenRepository.deleteById(currentUser.id)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,26 @@ class OauthController(
private val getServiceNameService: GetServiceNameService,
) {
@PostMapping("/code")
fun generateOauthCode(@Valid @RequestBody oauthCodeRequestDto : OauthCodeRequestDto): ResponseEntity<OauthCodeResponseDto> =
ResponseEntity.ok(oauthCodeService.execute(oauthCodeRequestDto))
fun generateOauthCode(@Valid @RequestBody oauthCodeRequestDto : OauthCodeRequestDto): ResponseEntity<OauthCodeResponseDto> {
val result = oauthCodeService.execute(oauthCodeRequestDto)
return ResponseEntity.ok(result)
}

@PostMapping("/token")
fun generateOauthToken(@Valid @RequestBody userTokenRequestDto: UserTokenRequestDto): ResponseEntity<UserTokenResponseDto> =
ResponseEntity.ok(oauthTokenService.execute(userTokenRequestDto))
fun generateOauthToken(@Valid @RequestBody userTokenRequestDto: UserTokenRequestDto): ResponseEntity<UserTokenResponseDto> {
val result = oauthTokenService.execute(userTokenRequestDto)
return ResponseEntity.ok(result)
}

@PatchMapping("/token")
fun refreshOauthToken(@RequestHeader refreshToken: String): ResponseEntity<UserTokenResponseDto> =
ResponseEntity.ok(oauthRefreshService.execute(refreshToken))
fun refreshOauthToken(@RequestHeader refreshToken: String): ResponseEntity<UserTokenResponseDto> {
val result = oauthRefreshService.execute(refreshToken)
return ResponseEntity.ok(result)
}

@GetMapping("/{clientId}")
fun getServiceName(@PathVariable clientId: String): ResponseEntity<ServiceNameResponseDto> =
ResponseEntity.ok(getServiceNameService.execute(clientId))
fun getServiceName(@PathVariable clientId: String): ResponseEntity<ServiceNameResponseDto> {
val result = getServiceNameService.execute(clientId)
return ResponseEntity.ok(result)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ class UserController(
private val myProfileService: MyProfileService,
) {
@GetMapping
fun myProfile(): ResponseEntity<MyProfileResDto> =
ResponseEntity(myProfileService.execute(), HttpStatus.OK)
fun myProfile(): ResponseEntity<MyProfileResDto> {
val result = myProfileService.execute()
return ResponseEntity.ok(result)
}

@PatchMapping("/password")
fun changePassword(@Valid @RequestBody passwordChangeReqDto: PasswordChangeReqDto): ResponseEntity<Void>{
changePasswordService.execute(passwordChangeReqDto)
return ResponseEntity.ok().build()
return ResponseEntity.noContent().build()
}

@PatchMapping("/image")
Expand Down

0 comments on commit 37e26e0

Please sign in to comment.