Skip to content

Commit

Permalink
HOTFIX: 학과 영어로 입력 받게 다시 원상복구
Browse files Browse the repository at this point in the history
  • Loading branch information
hyxklee committed Jul 30, 2024
1 parent 865f300 commit be67639
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions src/main/java/leets/weeth/domain/user/mapper/UserMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,26 @@ public interface UserMapper {

@Mappings({
@Mapping(target = "cardinals", expression = "java( java.util.List.of(dto.cardinal()) )"),
@Mapping(target = "password", expression = "java( passwordEncoder.encode(dto.password()) )"),
@Mapping(target = "department", expression = "java( toEnum(dto.department()) )")
@Mapping(target = "password", expression = "java( passwordEncoder.encode(dto.password()) )")
})
User from(UserDTO.SignUp dto, @Context PasswordEncoder passwordEncoder);

UserDTO.Response to(User user);

@Mappings({
@Mapping(target = "absenceCount", expression = "java( user.getAbsenceCount() )"),
@Mapping(target = "department", expression = "java( toString(user.getDepartment()) )")
})
UserDTO.AdminResponse toAdminResponse(User user);

default Department toEnum(String before) {
return Arrays.stream(Department.values())
.filter(department -> department.getValue().equals(before))
.findAny()
.orElseThrow(DepartmentNotFoundException::new);
}

default String toString(Department department) {
return department.getValue();
}
//
// default Department toEnum(String before) {
// return Arrays.stream(Department.values())
// .filter(department -> department.getValue().equals(before))
// .findAny()
// .orElseThrow(DepartmentNotFoundException::new);
// }
//
// default String toString(Department department) {
// return department.getValue();
// }
}

0 comments on commit be67639

Please sign in to comment.