Skip to content

Commit

Permalink
[BE] 비밀번호 마이그레이션 로직 삭제 (#386)
Browse files Browse the repository at this point in the history
* chore: 서브모듈 변경사항 반영

* hotfix: 불필요한 메서드 삭제

* refactor: 로그 레벨 debug로 수정
  • Loading branch information
ikjo39 authored Oct 10, 2024
1 parent 5cbf93d commit 1ce5d0c
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class RoutingDataSource extends AbstractRoutingDataSource {
protected Object determineCurrentLookupKey() {
boolean currentTransactionReadOnly = TransactionSynchronizationManager.isCurrentTransactionReadOnly();
String key = currentTransactionReadOnly ? DataSourceConfig.REPLICA_SERVER : DataSourceConfig.SOURCE_SERVER;
log.info("Activated Datasource: {}", key);
log.debug("Activated Datasource: {}", key);
return key;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,4 @@ public ResponseEntity<Void> logout(@PathVariable String uuid) {
public MomoApiResponse<List<String>> findAttendeesOfMeeting(@PathVariable String uuid) {
return new MomoApiResponse<>(attendeeService.findAll(uuid));
}

/**
* TEMP: 비밀번호 마이그레이션 이후 삭제될 메서드입니다.
*/
@PostMapping("/api/v1/attendee/update-password")
public MomoApiResponse<Integer> updatePassword() {
return new MomoApiResponse<>(attendeeService.updateAllPassword());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,24 +63,4 @@ public List<String> findAll(String uuid) {
.map(Attendee::name)
.toList();
}

/**
* TEMP: 비밀번호 마이그레이션 이후 삭제될 메서드입니다.
*/
@Transactional
public Integer updateAllPassword() {
List<Attendee> attendees = attendeeRepository.findAll();
List<Attendee> rawAttendees = attendees.stream()
.filter(attendee -> attendee.getPassword().getPassword().length() < 15)
.toList();
rawAttendees.forEach(
attendee -> {
String rawPassword = attendee.getPassword().getPassword();
String encodedPassword = passwordEncoder.encode(rawPassword);
attendee.updatePassword(encodedPassword);
}
);
attendeeRepository.saveAll(rawAttendees);
return rawAttendees.size();
}
}
2 changes: 1 addition & 1 deletion backend/src/main/resources/security

0 comments on commit 1ce5d0c

Please sign in to comment.