Skip to content

Commit

Permalink
Merge pull request #26 from KONKUK-MAP-Service/feat-spot
Browse files Browse the repository at this point in the history
✔️ [Fix] :  장소 외래키 제약조건 오류 수정 #26
  • Loading branch information
evergreenn authored Mar 30, 2024
2 parents 5062f22 + 49ea18d commit 21746c2
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 8 deletions.
1 change: 0 additions & 1 deletion Ku-suk-Ku-suk
Submodule Ku-suk-Ku-suk deleted from b2540a
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ public class Comment extends BaseEntity {
@Column(nullable = false)
private String comment;


}
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ protected void successfulAuthentication(HttpServletRequest request, HttpServletR

String password = customUserDetails.getPassword();
//AT : 6분
String accessToken = jwtUtil.createJwt(username, password, 60*60*100L);
String accessToken = jwtUtil.createJwt(username, password, 60*60*1000L);
//RT : 7일
String refreshToken = jwtUtil.createRefreshToken(username, password, 86400000*7L);

Expand Down
7 changes: 4 additions & 3 deletions src/main/java/com/cona/KUsukKusuk/spot/domain/Spot.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.cona.KUsukKusuk.like.UserLike;
import com.cona.KUsukKusuk.picture.Picture;
import com.cona.KUsukKusuk.user.domain.User;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.ElementCollection;
import jakarta.persistence.Entity;
Expand Down Expand Up @@ -36,16 +37,16 @@ public class Spot extends BaseEntity {
@JoinColumn(name = "user_id")
private User user;

@OneToMany(mappedBy = "spot")
@OneToMany(mappedBy = "spot", cascade = CascadeType.REMOVE)
private List<UserLike> userLikes = new ArrayList<>();

@OneToMany(mappedBy = "spot")
private List<Picture> pictures = new ArrayList<>();

@OneToMany(mappedBy = "spot")
@OneToMany(mappedBy = "spot",cascade = CascadeType.REMOVE)
private List<Comment> comments = new ArrayList<>();

@OneToMany(mappedBy = "spot")
@OneToMany(mappedBy = "spot", cascade = CascadeType.REMOVE)
private List<Bookmark> bookmarks = new ArrayList<>();
@Column(nullable = false)
private String spotName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
public record BoomarkLikeResponseDto(

String spotName,
Long spotId,
String review,
LocalDateTime createDate,

Expand All @@ -26,6 +27,8 @@ public static BoomarkLikeResponseDto of(Spot spot, Boolean isBookmark, Boolean i
return BoomarkLikeResponseDto.builder()
.spotName(spot.getSpotName())
.spotImageurl(spot.getImageUrls().get(0))
.createDate(spot.getCreatedDate())
.spotId(spot.getId())
.review(spot.getReview())
.author(spot.getUser().getNickname())
.bookmark(isBookmark)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.RandomStringUtils;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
Expand All @@ -44,6 +45,7 @@

@Service
@RequiredArgsConstructor
@Slf4j
public class UserService {
private final UserRepository userRepository;
private final CommentRepository commentRepository;
Expand Down Expand Up @@ -136,12 +138,13 @@ public String findPassword(String userId, String email) {
User member=userRepository.findByUserId(userId)
.orElseThrow(() -> new UserNotFoundException(HttpExceptionCode.USERID_NOT_FOUND));

if (member.getEmail() != email) {
if (!member.getEmail().equals(email)) {
throw new UserNotFoundException(HttpExceptionCode.EMAIL_USER_NOT_EQUAL);
}

String newPassword = generateNewPassword();
member.setPassword(bCryptPasswordEncoder.encode(newPassword));
member.setNoCryptpassword(newPassword);
userRepository.save(member);

String title = "쿠석쿠석 임시 비밀번호 발급";
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ spring:
password : ${redis_password}
servlet:
multipart:
maxFileSize: 10MB
maxRequestSize: 30MB
maxFileSize: 30MB
maxRequestSize: 60MB

decorator:
datasource:
Expand Down

0 comments on commit 21746c2

Please sign in to comment.