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 { +}