Skip to content

Commit

Permalink
fix method name
Browse files Browse the repository at this point in the history
  • Loading branch information
yesyash committed Aug 26, 2024
1 parent 162ab3c commit ffb33f6
Showing 1 changed file with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ public class SkillServiceImplementation implements SkillService {
private final UserSkillRepository userSkillRepository;
private final EndorsementRepository endorsementRepository;

private static UserViewModel getUserModalFromRdsDetails(
String id, RdsGetUserDetailsResDto rdsDetails) {
String firstName =
rdsDetails.getUser().getFirst_name() != null ? rdsDetails.getUser().getFirst_name() : "";
String lastName =
rdsDetails.getUser().getLast_name() != null ? rdsDetails.getUser().getLast_name() : "";

return UserViewModel.builder().id(id).name(firstName + ' ' + lastName).build();
}

@Override
public List<SkillViewModel> getAll() {
return skillRepository.findAll().stream()
Expand All @@ -46,7 +56,7 @@ public List<SkillViewModel> getAll() {
public SkillRequestsDto getAllRequests() {
List<UserSkills> skillRequests = userSkillRepository.findAll();
SkillRequestsWithUserDetailsViewModel skillRequestsWithUserDetails =
toSkillRequestsViewModel(skillRequests);
toSkillRequestsWithUserDetailsViewModel(skillRequests);

return SkillRequestsDto.toDto(
skillRequestsWithUserDetails.getSkillRequests(), skillRequestsWithUserDetails.getUsers());
Expand All @@ -56,22 +66,12 @@ public SkillRequestsDto getAllRequests() {
public SkillRequestsDto getRequestsByStatus(UserSkillStatusEnum status) {
List<UserSkills> skillRequests = userSkillRepository.findByStatus(status);
SkillRequestsWithUserDetailsViewModel skillRequestsWithUserDetails =
toSkillRequestsViewModel(skillRequests);
toSkillRequestsWithUserDetailsViewModel(skillRequests);

return SkillRequestsDto.toDto(
skillRequestsWithUserDetails.getSkillRequests(), skillRequestsWithUserDetails.getUsers());
}

private static UserViewModel getUserModalFromRdsDetails(
String id, RdsGetUserDetailsResDto rdsDetails) {
String firstName =
rdsDetails.getUser().getFirst_name() != null ? rdsDetails.getUser().getFirst_name() : "";
String lastName =
rdsDetails.getUser().getLast_name() != null ? rdsDetails.getUser().getLast_name() : "";

return UserViewModel.builder().id(id).name(firstName + ' ' + lastName).build();
}

@Override
public SkillViewModel create(CreateSkillViewModel skill) {
if (skillRepository.existsByName(skill.getName())) {
Expand Down Expand Up @@ -108,7 +108,8 @@ public GenericResponse<String> approveRejectSkillRequest(
return new GenericResponse<>("Skill {}", action.toString().toLowerCase());
}

private SkillRequestsWithUserDetailsViewModel toSkillRequestsViewModel(List<UserSkills> skills) {
private SkillRequestsWithUserDetailsViewModel toSkillRequestsWithUserDetailsViewModel(
List<UserSkills> skills) {
// store all users data that are a part of this request
Map<String, UserViewModel> userDetails = new HashMap<>();

Expand Down

0 comments on commit ffb33f6

Please sign in to comment.