Skip to content

Commit

Permalink
Merge pull request #593 from bounswe/bugfix/BE-592-bugfix-null-pointe…
Browse files Browse the repository at this point in the history
…r-exception-at-resource-and-need-entities
  • Loading branch information
volcaniqueo authored Dec 23, 2023
2 parents 9c28574 + 2df01e2 commit a7106d6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public NeedDto convertToDto(Need need) {
needDto.setLatitude(need.getLatitude());
needDto.setLongitude(need.getLongitude());
needDto.setCreatedDate(need.getCreatedAt());
needDto.setSize(need.getSize());
if (need.getSize() != null)
needDto.setSize(need.getSize());
Request request = need.getRequest();
if (request != null) {
needDto.setRequestId(request.getId());
Expand All @@ -52,11 +53,11 @@ public Need convertToEntity(NeedDto needDto) {
need.setLongitude(needDto.getLongitude());
need.setStatus(needDto.getStatus());
need.setCreatedAt(needDto.getCreatedDate());
need.setSize(needDto.getSize());
if (needDto.getSize() != null)
need.setSize(needDto.getSize());
Request request = requestRepository.findById(needDto.getRequestId()).orElse(null);
need.setRequest(request);
return need;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public ResourceDto convertToDto(Resource resource){
resourceDto.setLatitude(resource.getLatitude());
resourceDto.setLongitude(resource.getLongitude());
resourceDto.setCreatedDate(resource.getCreatedAt());
resourceDto.setSize(resource.getSize().toString());
if (resource.getSize() != null)
resourceDto.setSize(resource.getSize().toString());
return resourceDto;

}
Expand All @@ -49,7 +50,8 @@ public Resource convertToEntity(ResourceDto resourceDto){
resource.setLatitude(resourceDto.getLatitude());
resource.setLongitude(resourceDto.getLongitude());
resource.setCreatedAt(resourceDto.getCreatedDate());
resource.setSize(ESize.valueOf(resourceDto.getSize()));
if (resourceDto.getSize() != null)
resource.setSize(ESize.valueOf(resourceDto.getSize()));
return resource;
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.groupa1.resq.entity.enums;

public enum EGender {
MAN,
WOMAN,
MALE,
FEMALE,
CHILDREN_BOY, CHILDREN_GIRL,
BABY
}

0 comments on commit a7106d6

Please sign in to comment.