Skip to content

Commit

Permalink
refactor: add hasOwnerMemberId in photo entity
Browse files Browse the repository at this point in the history
  • Loading branch information
gmkim20713 committed Jul 28, 2024
1 parent b54b3f4 commit 9f6833b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ public String getId() {
return photoId;
}

public Boolean hasOwnerMemberId() {
return this.getOwnerMemberId() != null;
}

public PhotoEntity updateOwnerMemberId(String ownerMemberId) {
this.ownerMemberId = ownerMemberId;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public Mono<PhotoEntity> updatePhotoAlbumId(String photoId, String albumId, Stri
.switchIfEmpty(Mono.error(new PhotoNotFoundException()))
.flatMap(photoEntity -> {

if (!hasOwnerId(photoEntity)) {
if (!photoEntity.hasOwnerMemberId()) {
photoRepository.save(photoEntity.updateOwnerMemberId(requestMemberId));
}

Expand All @@ -94,8 +94,4 @@ public Mono<PhotoEntity> updatePhotoAlbumId(String photoId, String albumId, Stri
});
}

private Boolean hasOwnerId(PhotoEntity photoEntity) {
return photoEntity.getOwnerMemberId() != null;
}

}

0 comments on commit 9f6833b

Please sign in to comment.