-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #187 from TRIP-Side-Project/dev
네이버 API 버그 및 회원 기능 수정에 의한 Main Merge
- Loading branch information
Showing
11 changed files
with
126 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/main/java/com/api/trip/domain/email/repository/EmailRedisRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.api.trip.domain.email.repository; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.data.redis.core.StringRedisTemplate; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.time.Duration; | ||
import java.util.Optional; | ||
|
||
@Slf4j | ||
@Repository | ||
@RequiredArgsConstructor | ||
public class EmailRedisRepository { | ||
|
||
private final StringRedisTemplate redisTemplate; | ||
private final static Duration EMAIL_TOKEN_TTL = Duration.ofMinutes(30); | ||
|
||
public void setToken(String email, String token) { | ||
String key = getKey(email); | ||
log.debug("set EmailAuth to Redis {}, {}", key, token); | ||
redisTemplate.opsForValue().set(key, token, EMAIL_TOKEN_TTL); | ||
} | ||
|
||
public Optional<String> getToken(String email) { | ||
String key = getKey(email); | ||
String token = redisTemplate.opsForValue().get(key); | ||
log.info("get Data from Redis {}, {}", key, token); | ||
return Optional.ofNullable(token); | ||
} | ||
|
||
public void deleteToken(String email) { | ||
String key = getKey(email); | ||
log.info("delete Data from Redis {}", key); | ||
redisTemplate.delete(key); | ||
} | ||
|
||
public boolean existToken(String email) { | ||
String key = getKey(email); | ||
return Boolean.TRUE.equals(redisTemplate.hasKey(key)); | ||
} | ||
|
||
private String getKey(String email) { | ||
return "EMAIL:" + email; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/main/java/com/api/trip/domain/interestitem/controller/dto/GetInterestItemResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.api.trip.domain.interestitem.controller.dto; | ||
|
||
import com.api.trip.domain.item.controller.dto.GetItemResponse; | ||
import com.api.trip.domain.item.model.Item; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@Builder | ||
public class GetInterestItemResponse { | ||
|
||
private Long id; | ||
|
||
private String title; | ||
|
||
private String shopName; | ||
|
||
private Integer minPrice; | ||
|
||
private String imageUrl; | ||
|
||
public static GetInterestItemResponse of(Item item){ | ||
return GetInterestItemResponse.builder() | ||
.id(item.getId()) | ||
.title(item.getTitle()) | ||
.shopName(item.getShopName()) | ||
.minPrice(item.getMinPrice()) | ||
.imageUrl(item.getImageUrl()) | ||
.build(); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters