Skip to content

Commit

Permalink
feat: 유저 정보 업데이트 기능 변경
Browse files Browse the repository at this point in the history
동물 정보를 변경 할 수 없게 함
  • Loading branch information
GGHDMS committed Dec 17, 2023
1 parent f098445 commit 0c7388e
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import com.yourssu.ssudateserver.dto.request.RefreshTokenRequestDto
import com.yourssu.ssudateserver.dto.request.RegisterCodeRequestDto
import com.yourssu.ssudateserver.dto.request.RegisterFemaleRequestDto
import com.yourssu.ssudateserver.dto.request.RegisterMaleRequestDto
import com.yourssu.ssudateserver.dto.request.UpdateFemaleRequestDto
import com.yourssu.ssudateserver.dto.request.UpdateMaleRequestDto
import com.yourssu.ssudateserver.dto.request.UpdateRequestDto
import com.yourssu.ssudateserver.dto.response.RefreshTokenResponseDto
import com.yourssu.ssudateserver.dto.response.RegisterResponseDto
import com.yourssu.ssudateserver.dto.response.UpdateResponseDto
Expand Down Expand Up @@ -84,36 +83,13 @@ class UserController(
return userService.getMyInfo(oauthName = userPrincipal.name)
}

@PatchMapping("/users/my/male")
@PatchMapping("/users/my")
fun updateMaleInfo(
@RequestBody updateRequestDto: UpdateMaleRequestDto,
@RequestBody updateRequestDto: UpdateRequestDto,
@AuthenticationPrincipal userPrincipal: UserPrincipal,
): UpdateResponseDto {
if (updateRequestDto.animals == MaleAnimals.ALL) {
throw AllCanNotRegisterException("ALL은 등록불가능 합니다.")
}

return userService.updateUserInfo(
Animals.valueOf(updateRequestDto.animals.toString()),
updateRequestDto.nickName,
updateRequestDto.mbti,
updateRequestDto.introduce,
updateRequestDto.contact,
userPrincipal.name
)
}

@PatchMapping("/users/my/female")
fun updateFemaleInfo(
@RequestBody updateRequestDto: UpdateFemaleRequestDto,
@AuthenticationPrincipal userPrincipal: UserPrincipal,
): UpdateResponseDto {
if (updateRequestDto.animals == FemaleAnimals.ALL) {
throw AllCanNotRegisterException("ALL은 등록불가능 합니다.")
}

return userService.updateUserInfo(
Animals.valueOf(updateRequestDto.animals.toString()),
updateRequestDto.nickName,
updateRequestDto.mbti,
updateRequestDto.introduce,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package com.yourssu.ssudateserver.dto.request

import com.yourssu.ssudateserver.enums.MBTI
import com.yourssu.ssudateserver.enums.MaleAnimals
import javax.validation.constraints.Size

data class UpdateMaleRequestDto(
val animals: MaleAnimals,
data class UpdateRequestDto(
@field:Size(message = "닉네임은 최대 9글자 입니다.", min = 1, max = 9)
val nickName: String,
val mbti: MBTI,
Expand Down
4 changes: 1 addition & 3 deletions src/main/kotlin/com/yourssu/ssudateserver/entity/User.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class User(

@field:Column(name = "animals")
@field:Enumerated(EnumType.STRING)
var animals: Animals,
val animals: Animals,

@field:Column(name = "mbti")
@field:Enumerated(EnumType.STRING)
Expand Down Expand Up @@ -64,13 +64,11 @@ class User(
val createdAt: LocalDateTime,
) {
fun updateInfo(
animals: Animals,
nickName: String,
mbti: MBTI,
introduce: String,
contact: String,
): User {
this.animals = animals
this.nickName = nickName
this.mbti = mbti
this.introduce = introduce
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ class UserService(

@Transactional
fun updateUserInfo(
animals: Animals,
nickName: String,
mbti: MBTI,
introduce: String,
Expand All @@ -135,7 +134,6 @@ class UserService(
}

val updatedUser = user.updateInfo(
animals = animals,
nickName = nickName,
mbti = mbti,
introduce = introduce,
Expand Down

0 comments on commit 0c7388e

Please sign in to comment.