Skip to content

Commit

Permalink
Merge branch '48-modify-my-page'
Browse files Browse the repository at this point in the history
  • Loading branch information
meltapplee committed Oct 8, 2024
2 parents 54497b2 + 9b5e279 commit ae5855b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions src/main/kotlin/org/meogo/domain/user/domain/User.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,10 @@ class User(
@Enumerated(EnumType.STRING)
val role: UserRole
) : BaseUUIDEntity(id) {
fun updateProfile(name: String, enrolledSchool: Int, profile: String?): User {
fun updateProfile(name: String, enrolledSchool: Int, profile: String): User {
this.name = name
this.enrolledSchool = enrolledSchool
if (profile != null) {
this.profile = profile
}
this.profile = profile
return this
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class ModifyUserInfoService(
fun execute(request: UserModifyRequest, file: MultipartFile?) {
val user = userFacade.currentUser() ?: throw UserNotFoundException

if (file != null && user.profile != defaultImage) fileUtil.delete(user.profile, Path.USER)
val url = file?.let { fileUtil.upload(it, Path.USER) }
if (user.profile != defaultImage) fileUtil.delete(user.profile, Path.USER)
val url = file?.let { fileUtil.upload(it, Path.USER) } ?: defaultImage

userRepository.save(
user.updateProfile(request.name, request.enrolledSchool, url)
Expand Down

0 comments on commit ae5855b

Please sign in to comment.