From ab357f8ba876e55df267cfea86daee40040e6484 Mon Sep 17 00:00:00 2001 From: choyeongju Date: Wed, 8 Jan 2025 06:36:02 +0900 Subject: [PATCH] =?UTF-8?q?:sparkles:=20[feat]=20#7=20Token=20=EA=B4=80?= =?UTF-8?q?=EB=A0=A8=20=ED=81=B4=EB=9E=98=EC=8A=A4=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bbangzip/domain/token/entity/Token.java | 27 +++++++++++++++++++ .../token/repository/TokenRepository.java | 7 +++++ 2 files changed, 34 insertions(+) create mode 100644 src/main/java/com/sopt/bbangzip/domain/token/entity/Token.java create mode 100644 src/main/java/com/sopt/bbangzip/domain/token/repository/TokenRepository.java diff --git a/src/main/java/com/sopt/bbangzip/domain/token/entity/Token.java b/src/main/java/com/sopt/bbangzip/domain/token/entity/Token.java new file mode 100644 index 0000000..5a4c0b5 --- /dev/null +++ b/src/main/java/com/sopt/bbangzip/domain/token/entity/Token.java @@ -0,0 +1,27 @@ +package com.sopt.bbangzip.domain.token.entity; + +import lombok.AccessLevel; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.springframework.data.annotation.Id; +import org.springframework.data.redis.core.RedisHash; +import org.springframework.data.redis.core.index.Indexed; + +@Getter +@RedisHash(value="token", timeToLive = 60 * 60 * 24 * 14) +@NoArgsConstructor(access= AccessLevel.PROTECTED) +public class Token { + + @Id + private Long id; + + @Indexed + private String refreshToken; + + @Builder + public Token(Long id, String refreshToken) { + this.id = id; + this.refreshToken = refreshToken; + } +} diff --git a/src/main/java/com/sopt/bbangzip/domain/token/repository/TokenRepository.java b/src/main/java/com/sopt/bbangzip/domain/token/repository/TokenRepository.java new file mode 100644 index 0000000..c8cbc0d --- /dev/null +++ b/src/main/java/com/sopt/bbangzip/domain/token/repository/TokenRepository.java @@ -0,0 +1,7 @@ +package com.sopt.bbangzip.domain.token.repository; + +import com.sopt.bbangzip.domain.token.entity.Token; +import org.springframework.data.repository.CrudRepository; + +public interface TokenRepository extends CrudRepository { +}