Skip to content

Commit

Permalink
[Feat] RefreshToken 도메인 구현(#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjk4618 committed May 24, 2024
1 parent 16451a1 commit 5bdf659
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 43 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package org.sopt.springFirstSeminar.common.jwt.auth;


import jakarta.persistence.Id;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import org.springframework.data.redis.core.RedisHash;
import org.springframework.data.redis.core.index.Indexed;

@RedisHash(value = "", timeToLive = 60 * 60 * 24 * 1000L)
@AllArgsConstructor(access = AccessLevel.PRIVATE)
@Getter
@Builder(access = AccessLevel.PRIVATE)
public class RefreshToken {

@Id
private Long id;

@Indexed
private String refreshToken;

public static RefreshToken of(final Long userId, final String refreshToken) {
return RefreshToken.builder()
.id(userId)
.refreshToken(refreshToken)
.build();
}

public void updateRefreshToken(final String refreshToken) {
this.refreshToken = refreshToken;
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.sopt.springFirstSeminar.common.jwt.auth.redis.repository;

import org.sopt.springFirstSeminar.common.jwt.auth.RefreshToken;
import org.springframework.data.repository.CrudRepository;

import java.util.Optional;

public interface RefreshTokenRepository extends CrudRepository<RefreshToken, Long> {
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ public class MemberService {
private final JwtTokenProvider jwtTokenProvider;

@Transactional
public UserJoinResponse createMember(
MemberCreateDTO memberCreate
) {
public UserJoinResponse createMember(MemberCreateDTO memberCreate) {
Member member = memberRepository.save(
Member.create(memberCreate.name(), memberCreate.part(), memberCreate.age())
);
Expand Down

0 comments on commit 5bdf659

Please sign in to comment.