Skip to content

Commit

Permalink
[FEAT] 유저 부분 주석 추가 (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
sangminee authored Jan 30, 2024
1 parent 5164bec commit 6d9b548
Show file tree
Hide file tree
Showing 13 changed files with 68 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/main/java/kr/sesac/aoao/server/user/domain/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
* 유저 도메인
*
* @author 이상민
* @since 2024.01.19
*/
@Getter
@AllArgsConstructor
public class User {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
import kr.sesac.aoao.server.global.exception.ErrorCode;
import lombok.RequiredArgsConstructor;

/**
* 유저 관련 에러 코드 추가
* @author 이상민
* @since 2024.01.19
*/
@RequiredArgsConstructor
public enum UserErrorCode implements ErrorCode {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {

private final JwtTokenProvider jwtTokenProvider;

/**
* jwt 필터
*
* @author 이상민
* @since 2024.01.19
*/
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response,
FilterChain filterChain) throws ServletException, IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
@Slf4j
public class JwtTokenProvider {

// @Value("${security.jwt.secret.key}")
private String secretKey =
"c2lsdmVybmluZS10ZWNoLXNwcmluZy1ib290LWp3dC10dXRvcmlhbC1zZWNyZXQtc2lsdmVybmluZS10ZWNoLXNwcmluZy1ib290LWp3dC10dXRvcmlhbC1zZWNyZXQK";

Expand Down
4 changes: 4 additions & 0 deletions src/main/java/kr/sesac/aoao/server/user/jwt/Subject.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

import lombok.Getter;

/**
* @author 이상민
* @since 2024.01.19
*/
@Getter
public class Subject {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
* @author 이상민
* @since 2024.01.19
*/
@Getter
@Entity
@NoArgsConstructor(access = AccessLevel.PROTECTED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

import org.springframework.data.jpa.repository.JpaRepository;

/**
* @author 이상민
* @since 2024.01.19
*/
public interface TokenJpaRepository extends JpaRepository<RefreshTokenEntity, String> {

Optional<RefreshTokenEntity> findByEmail(String email);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
* @author 이상민
* @since 2024.01.19
*/
@Entity
@Getter
@Table(name = "users")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

import org.springframework.data.jpa.repository.JpaRepository;

/**
* @author 이상민
* @since 2024.01.19
*/
public interface UserJpaRepository extends JpaRepository<UserEntity, Long> {

Optional<UserEntity> findByEmail(String email);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package kr.sesac.aoao.server.user.repository;

/**
* 회원가입 타입
* @author 이상민
* @since 2024.01.19
*/
public enum UserType {
BASIC, KAKAO
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
import kr.sesac.aoao.server.user.repository.UserJpaRepository;
import lombok.RequiredArgsConstructor;

/**
* @author 이상민
* @since 2024.01.24
*/
@Service
@RequiredArgsConstructor
@Transactional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
import kr.sesac.aoao.server.user.jwt.UserCustomDetails;
import kr.sesac.aoao.server.user.repository.UserEntity;

/**
* @author 이상민
* @since 2024.01.19
*/
public interface UserService {

User signUp(SignUpRequest signUpRequest);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,12 @@ public MyPageResponse getProfile(String username, Long userId) {
);
}

/**
* 이메일 중복 함수
*
* @author 이상민
* @since 2024.01.24
*/
@Override
public void duplicatedEmail(String email) {
Optional<UserEntity> user = userJpaRepository.findByEmail(email);
Expand All @@ -196,6 +202,12 @@ public void duplicatedEmail(String email) {
}
}

/**
* 닉네임 중복 함수
*
* @author 이상민
* @since 2024.01.24
*/
@Override
public void duplicationNickname(String nickname) {
Optional<UserEntity> user = userJpaRepository.findByNickname(nickname);
Expand Down Expand Up @@ -283,6 +295,12 @@ public void deleteUser(Long userId) {
userJpaRepository.delete(new UserEntity(user));
}

/**
* 로그아웃
*
* @since 2024.01.27
* @author 이상민
*/
@Override
public void logout(UserEntity userEntity) {
Optional<RefreshTokenEntity> refreshTokenEntity = tokenJpaRepository.findByEmail(userEntity.getEmail());
Expand Down

0 comments on commit 6d9b548

Please sign in to comment.