Skip to content

Commit

Permalink
fix: throw the exception if the user does not exist
Browse files Browse the repository at this point in the history
fix #22
  • Loading branch information
emmysteven committed Nov 1, 2023
1 parent 8d52b87 commit e514268
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public ApiResponse<DepartmentDto> add(DepartmentRequest request) {
public ApiResponse<DepartmentDto> update(UUID id, DepartmentRequest request) {
boolean isUnitExists = repository.existsById(id);

if(isUnitExists) {
if(!isUnitExists) {
throw new AppException("Id does not exists");
}

Expand All @@ -105,7 +105,7 @@ public ApiResponse<DepartmentDto> update(UUID id, DepartmentRequest request) {
public ApiResponse<DepartmentDto> delete(UUID id) {
boolean isDepartmentExists = repository.existsById(id);

if(isDepartmentExists){
if(!isDepartmentExists){
throw new ResourceNotFoundException("User", "id", id);
}

Expand Down
4 changes: 2 additions & 2 deletions backend/src/main/java/meetona/meeting/MeetingService.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public ApiResponse<MeetingDto> add(MeetingRequest request) {
public ApiResponse<MeetingDto> update(UUID id, MeetingRequest request) {
boolean isMeetingExists = meetingRepository.existsById(id);

if(isMeetingExists) {
if(!isMeetingExists) {
throw new AppException("Id does not exists");
}

Expand All @@ -96,7 +96,7 @@ public ApiResponse<MeetingDto> update(UUID id, MeetingRequest request) {
public ApiResponse<MeetingDto> delete(UUID id) {
boolean isUnitExists = meetingRepository.existsById(id);

if(isUnitExists){
if(!isUnitExists){
throw new ResourceNotFoundException("User", "id", id);
}

Expand Down
4 changes: 2 additions & 2 deletions backend/src/main/java/meetona/member/MemberService.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public ApiResponse<MemberDto> add(MemberRequest request) {
public ApiResponse<MemberDto> update(UUID id, MemberRequest request) {
boolean isUnitExists = memberRepository.existsById(id);

if(isUnitExists) {
if(!isUnitExists) {
throw new AppException("Id does not exists");
}

Expand All @@ -128,7 +128,7 @@ public ApiResponse<MemberDto> update(UUID id, MemberRequest request) {
public ApiResponse<MemberDto> delete(UUID id) {
boolean isUnitExists = memberRepository.existsById(id);

if(isUnitExists){
if(!isUnitExists){
throw new ResourceNotFoundException("User", "id", id);
}

Expand Down
4 changes: 2 additions & 2 deletions backend/src/main/java/meetona/unit/UnitService.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public ApiResponse<UnitDto> add(UnitRequest request) {
public ApiResponse<UnitDto> update(UUID id, UnitRequest request) {
boolean isUnitExists = unitRepository.existsById(id);

if(isUnitExists) {
if(!isUnitExists) {
throw new ResourceNotFoundException("User", "id", id);
}

Expand All @@ -103,7 +103,7 @@ public ApiResponse<UnitDto> update(UUID id, UnitRequest request) {
public ApiResponse<UnitDto> delete(UUID id) {
boolean isUnitExists = unitRepository.existsById(id);

if(isUnitExists){
if(!isUnitExists){
throw new ResourceNotFoundException("User", "id", id);
}

Expand Down
4 changes: 2 additions & 2 deletions backend/src/main/java/meetona/user/UserService.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public ApiResponse<UserDto> add(UserRequest userRequest) {
public ApiResponse<UserDto> update(UUID id, UserRequest request) {
boolean isUserExists = userRepository.existsById(id);

if(isUserExists) {
if(!isUserExists) {
throw new ResourceNotFoundException("User", "id", id);
}

Expand All @@ -146,7 +146,7 @@ public ApiResponse<UserDto> update(UUID id, UserRequest request) {
public ApiResponse<UserDto> delete(UUID id) {
boolean isUserExists = userRepository.existsById(id);

if(isUserExists){
if(!isUserExists){
throw new ResourceNotFoundException("User", "id", id);
}

Expand Down

0 comments on commit e514268

Please sign in to comment.