Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/main/java/com/back/domain/user/entity/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import lombok.*;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;

Expand All @@ -16,6 +17,7 @@

@Entity
@Table(name = "users") // 예약어 충돌 방지를 위해 "users" 권장
@EntityListeners(AuditingEntityListener.class)
@Getter
@Setter
@NoArgsConstructor
Expand Down
15 changes: 9 additions & 6 deletions src/main/java/com/back/global/init/DevInitData.java
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

initData를 롤백한 걸 pull 받지 않으셨어요!
현재 initData에 문제가 많아서 pull 받으시고 다시 한 번 pr 부탁드려요

Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,11 @@ public void notificationInit() {
public void myBarInit() {
if (myBarRepository.count() > 0) return;

User userA = userRepository.findByNickname("사용자A").orElseThrow();
User userB = userRepository.findByNickname("사용자B").orElseThrow();
User userC = userRepository.findByNickname("사용자C").orElseThrow();
User userA = userRepository.findByNickname("사용자A").orElse(null);
User userB = userRepository.findByNickname("사용자B").orElse(null);
User userC = userRepository.findByNickname("사용자C").orElse(null);

if (userA == null || userC == null) return;

// 칵테일 참조 준비
var cocktails = cocktailRepository.findAll();
Expand All @@ -290,9 +292,10 @@ public void myBarInit() {
myBarRepository.findByUser_IdAndCocktail_Id(userA.getId(), c1.getId()).ifPresent(m -> m.setKeptAt(java.time.LocalDateTime.now().minusDays(2)));
myBarRepository.findByUser_IdAndCocktail_Id(userA.getId(), c2.getId()).ifPresent(m -> m.setKeptAt(java.time.LocalDateTime.now().minusDays(1)));

// B: c3 keep 후 unkeep -> DELETED
myBarService.keep(userB.getId(), c3.getId());
myBarService.unkeep(userB.getId(), c3.getId());
if (userB != null && !userB.isDeleted()) {
myBarService.keep(userB.getId(), c3.getId());
myBarService.unkeep(userB.getId(), c3.getId());
}

// C: c2(now-3d), c3(now-2d), c4(now-1h)
myBarService.keep(userC.getId(), c2.getId());
Expand Down