Skip to content

Commit

Permalink
신규 회원가입 여부를 유저가 생성된지 1시간 이내인 지 여부로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
KiSeungMin committed Oct 21, 2024
1 parent 72c7b3c commit 4d94b3c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main/java/com/aisip/OnO/backend/service/UserServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
Expand Down Expand Up @@ -46,9 +48,13 @@ public UserResponseDto getUserById(Long userId) {
if(optionalUser.isPresent()){

User user = optionalUser.get();
LocalDate createdAtDate = user.getCreatedAt().toLocalDate();
LocalDateTime createdAtDateTime = user.getCreatedAt(); // LocalDateTime으로 변경
LocalDateTime now = LocalDateTime.now();

if (createdAtDate.equals(LocalDate.now())) {
// 두 시간 간의 차이를 계산하여 1시간 이내인지 확인
Duration duration = Duration.between(createdAtDateTime, now);

if (duration.toHours() < 1) {
return UserConverter.convertToResponseDto(user, true);
}

Expand Down

0 comments on commit 4d94b3c

Please sign in to comment.