Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Jwhyee committed Sep 13, 2022
2 parents 8815d46 + 25db2fd commit 893006b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/main/java/com/matdongsan/domain/favorite/Favorite.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public class Favorite {
@ManyToOne(fetch = FetchType.LAZY)
private Member member;

@OneToMany(cascade = CascadeType.ALL)
@OneToMany
@JoinColumn
private List<Place> placeList;

public Favorite(Member member, String subject) {
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/com/matdongsan/service/FavoriteService.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,14 @@ public void replaceExistPlace(Member member, Place place, Favorite currentFavori
for (Favorite favorite : favoriteList) {
if (favorite.getPlaceList().contains(place)){
deletePlace(favorite, place);
save(favorite);
}
}
log.info("favorite -> {}", currentFavorite.getSubject());
currentFavorite.addPlace(place);
log.info("place -> {}", place.getPlaceName());
save(currentFavorite);
log.info("save success");
}

public void deletePlace(Favorite currentFavorite, Place place) {
Expand All @@ -54,6 +58,7 @@ public Favorite findByIdAndMember(Long favoriteId, Member member) {
}

public void delete(Favorite favorite) {
log.info("favorite.name in service ->{}", favorite.getSubject());
favoriteRepository.delete(favorite);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public String modifyFavorite(@AuthUser Account account, @PathVariable Long favor
public String deleteFavorite(@AuthUser Account account, @PathVariable Long favoriteId) {
Member member = account.getMember();
Favorite favorite = favoriteService.findByIdAndMember(favoriteId, member);
log.info("favorite.name -> {}",favorite.getSubject());

favoriteService.delete(favorite);
return "redirect:/profile/bookmark/view";
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/templates/fragments/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ <h6 class="item-title">Zinia Jessy</h6>
<li><a th:href="@{/profile/{nickname}(nickname=${#authentication.getName()})}">프로필</a></li>
<li><a th:href="@{/settings/profile}">프로필 설정</a></li>
<li><a th:href="@{/profile/post}">나만의 맛집</a></li>
<li><a th:href="@{/favorite/list}">맛집 리스트 관리</a></li>
<li><a th:href="@{/profile/bookmark/view}">북마크 관리</a></li>
<li>
<form action="#" name="logout" th:action="@{/logout}" method="post">
<a href="javascript:logout.submit();">
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/templates/profile/profile-bookmark.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@ <h5 class="modal-title" id="staticBackdropLabel">북마크 추가하기</h5>
<h3 th:text="${favorite.subject}"></h3>

<!-- 북마크 관리 버튼 -->
<a data-toggle="modal" data-target="#staticBackdrop2">
<a data-toggle="modal" th:data-target="'#staticBackdrop2' + ${favorite.id}">
<i class="icofont-settings-alt text-dark"></i>
</a>

<!-- 북마크 관리 nodal -->
<div class="modal fade" id="staticBackdrop2" data-backdrop="static" data-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel2" aria-hidden="true">
<div class="modal fade" th:id="'staticBackdrop2' + ${favorite.id}" data-backdrop="static" data-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel2" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="staticBackdropLabel2">북마크 관리</h5>
<h5 class="modal-title" th:id="${favorite.id}">북마크 관리</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
Expand Down

0 comments on commit 893006b

Please sign in to comment.