Skip to content

Commit

Permalink
Feat: 가게 삭제 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
marinesnow34 committed Mar 7, 2024
1 parent f75e712 commit fd2d7f5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/main/java/com/readyvery/readyverydemo/domain/Store.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import java.util.ArrayList;
import java.util.List;

import org.hibernate.annotations.ColumnDefault;

import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
Expand Down Expand Up @@ -81,6 +83,11 @@ public class Store extends BaseTimeEntity {
@Enumerated(EnumType.STRING)
private Grade grade;

// 삭제 여부
@Column
@ColumnDefault("false")
private boolean isDeleted;

//가게 사장님 연관관계 매핑
@OneToMany(mappedBy = "store")
private List<CeoInfo> ceoInfos = new ArrayList<CeoInfo>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public BoardSearchRes toBoardSearchRes(List<Store> stores) {
throw new BusinessLogicException(ExceptionCode.STORE_NOT_FOUND);
}
return BoardSearchRes.builder()
.stores(stores.stream().map(this::toSearchStoreDto).toList())
.stores(stores.stream().filter(store -> !store.isDeleted()).map(this::toSearchStoreDto).toList())
.build();
}

Expand Down

0 comments on commit fd2d7f5

Please sign in to comment.