From 37220b5346682f09a7f26c54dcc60bc874e3992a Mon Sep 17 00:00:00 2001 From: bongsh0112 Date: Thu, 14 Sep 2023 23:14:42 +0900 Subject: [PATCH 1/8] =?UTF-8?q?feat:=20User=20Entity=20=EC=9E=91=EC=84=B1?= =?UTF-8?q?=20&=20User=20Repository=20=EC=9E=91=EC=84=B1=20&=20UserUtils?= =?UTF-8?q?=20=EC=9E=91=EC=84=B1=20#14?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Api/build.gradle | 3 +- .../server/config/security/SecurityUtils.java | 33 ++++++++++++ .../java/playlist/server/utils/UserUtils.java | 20 +++++++ .../server/exception/GlobalException.java | 2 + .../SecurityContextNotFoundException.java | 10 ++++ .../domain/domains/AbstractTimeStamp.java | 32 +++++++++++ .../domains/user/Exception/UserException.java | 20 +++++++ .../user/Exception/UserNotFoundException.java | 13 +++++ .../domains/user/adaptor/UserAdaptor.java | 24 +++++++++ .../domains/user/domains/AccountRole.java | 7 +++ .../domains/user/domains/LoginType.java | 10 ++++ .../domain/domains/user/domains/User.java | 54 +++++++++++++++++++ .../user/repository/UserRepository.java | 10 ++++ 13 files changed, 236 insertions(+), 2 deletions(-) create mode 100644 Api/src/main/java/playlist/server/config/security/SecurityUtils.java create mode 100644 Api/src/main/java/playlist/server/utils/UserUtils.java create mode 100644 Core/src/main/java/playlist/server/exception/SecurityContextNotFoundException.java create mode 100644 Domain/src/main/java/playlist/server/domain/domains/AbstractTimeStamp.java create mode 100644 Domain/src/main/java/playlist/server/domain/domains/user/Exception/UserException.java create mode 100644 Domain/src/main/java/playlist/server/domain/domains/user/Exception/UserNotFoundException.java create mode 100644 Domain/src/main/java/playlist/server/domain/domains/user/adaptor/UserAdaptor.java create mode 100644 Domain/src/main/java/playlist/server/domain/domains/user/domains/AccountRole.java create mode 100644 Domain/src/main/java/playlist/server/domain/domains/user/domains/LoginType.java create mode 100644 Domain/src/main/java/playlist/server/domain/domains/user/domains/User.java create mode 100644 Domain/src/main/java/playlist/server/domain/domains/user/repository/UserRepository.java diff --git a/Api/build.gradle b/Api/build.gradle index d074cd6..0ac1962 100644 --- a/Api/build.gradle +++ b/Api/build.gradle @@ -27,8 +27,7 @@ dependencies { test { useJUnitPlatform() } - bootJar{ archivesBaseName = 'app' archiveFileName = 'app.jar' -} \ No newline at end of file +} diff --git a/Api/src/main/java/playlist/server/config/security/SecurityUtils.java b/Api/src/main/java/playlist/server/config/security/SecurityUtils.java new file mode 100644 index 0000000..d5e57a4 --- /dev/null +++ b/Api/src/main/java/playlist/server/config/security/SecurityUtils.java @@ -0,0 +1,33 @@ +package playlist.server.config.security; + +import org.springframework.security.core.Authentication; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.util.CollectionUtils; +import playlist.server.exception.SecurityContextNotFoundException; + +import java.util.List; + +public class SecurityUtils { + + private static SimpleGrantedAuthority swagger = new SimpleGrantedAuthority("ROLE_SWAGGER"); + + private static List notUserAuthority = List.of(swagger); + + public static Long getCurrentUserId() { + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + if (authentication == null) { + throw SecurityContextNotFoundException.EXCEPTION; + } + + if (authentication.isAuthenticated() + && !CollectionUtils.containsAny( + authentication.getAuthorities(), notUserAuthority)) { + return authentication.getName().equals("anonymousUser") + ? 0L + : Long.valueOf(authentication.getName()); + } + // 스웨거 유저일시 유저 아이디 0 반환 + return 0L; + } +} diff --git a/Api/src/main/java/playlist/server/utils/UserUtils.java b/Api/src/main/java/playlist/server/utils/UserUtils.java new file mode 100644 index 0000000..6ef9687 --- /dev/null +++ b/Api/src/main/java/playlist/server/utils/UserUtils.java @@ -0,0 +1,20 @@ +package playlist.server.utils; + +import lombok.RequiredArgsConstructor; +import playlist.server.config.security.SecurityUtils; +import playlist.server.domain.domains.user.adaptor.UserAdaptor; +import playlist.server.domain.domains.user.domains.User; + +@RequiredArgsConstructor +public class UserUtils { + + private final UserAdaptor userAdaptor; + + public Long getUserId() { + return SecurityUtils.getCurrentUserId(); + } + + public User getUser() { + return userAdaptor.query(SecurityUtils.getCurrentUserId()); + } +} diff --git a/Core/src/main/java/playlist/server/exception/GlobalException.java b/Core/src/main/java/playlist/server/exception/GlobalException.java index 175cce7..d38a68f 100644 --- a/Core/src/main/java/playlist/server/exception/GlobalException.java +++ b/Core/src/main/java/playlist/server/exception/GlobalException.java @@ -6,6 +6,7 @@ import lombok.AllArgsConstructor; import lombok.Getter; +import org.springframework.http.HttpStatus; import playlist.server.dto.ErrorDetail; @Getter @@ -19,6 +20,7 @@ public enum GlobalException implements BaseErrorCode { EXPIRED_REFRESH_TOKEN_ERROR(UNAUTHORIZED.value(), "401-1", "리프레시 토큰이 만료되었습니다."), INVALID_TOKEN_ERROR(UNAUTHORIZED.value(), "401-2", "올바르지 않은 토큰입니다."), DATE_FORMAT_ERROR(BAD_REQUEST.value(), "400-2", "날짜 형식을 확인해주세요."), + SECURITY_CONTEXT_NOT_FOUND_ERROR(INTERNAL_SERVER_ERROR.value(), "500-2", "Security Context 에러입니다.") ; private final Integer statusCode; diff --git a/Core/src/main/java/playlist/server/exception/SecurityContextNotFoundException.java b/Core/src/main/java/playlist/server/exception/SecurityContextNotFoundException.java new file mode 100644 index 0000000..076043f --- /dev/null +++ b/Core/src/main/java/playlist/server/exception/SecurityContextNotFoundException.java @@ -0,0 +1,10 @@ +package playlist.server.exception; + +public class SecurityContextNotFoundException extends BaseException { + + public static final BaseException EXCEPTION = new SecurityContextNotFoundException(); + + private SecurityContextNotFoundException() { + super(GlobalException.SECURITY_CONTEXT_NOT_FOUND_ERROR); + } +} diff --git a/Domain/src/main/java/playlist/server/domain/domains/AbstractTimeStamp.java b/Domain/src/main/java/playlist/server/domain/domains/AbstractTimeStamp.java new file mode 100644 index 0000000..24414dd --- /dev/null +++ b/Domain/src/main/java/playlist/server/domain/domains/AbstractTimeStamp.java @@ -0,0 +1,32 @@ +package playlist.server.domain.domains; + +import com.fasterxml.jackson.annotation.JsonFormat; +import jakarta.persistence.Column; +import jakarta.persistence.EntityListeners; +import jakarta.persistence.MappedSuperclass; +import lombok.Getter; +import org.hibernate.annotations.CreationTimestamp; +import org.hibernate.annotations.UpdateTimestamp; +import org.springframework.data.jpa.domain.support.AuditingEntityListener; + +import java.sql.Timestamp; + +@Getter +@MappedSuperclass +@EntityListeners(value = {AuditingEntityListener.class}) +public abstract class AbstractTimeStamp { + + @Column(name = "created_at", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") + @CreationTimestamp + @JsonFormat( + shape = JsonFormat.Shape.STRING, + pattern = "yyyy-MM-dd hh:mm:ss") + private Timestamp createdAt; + + @Column(name = "created_at", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") + @UpdateTimestamp + @JsonFormat( + shape = JsonFormat.Shape.STRING, + pattern = "yyyy-MM-dd hh:mm:ss") + private Timestamp updatedAt; +} diff --git a/Domain/src/main/java/playlist/server/domain/domains/user/Exception/UserException.java b/Domain/src/main/java/playlist/server/domain/domains/user/Exception/UserException.java new file mode 100644 index 0000000..8dd25d6 --- /dev/null +++ b/Domain/src/main/java/playlist/server/domain/domains/user/Exception/UserException.java @@ -0,0 +1,20 @@ +package playlist.server.domain.domains.user.Exception; + +import lombok.RequiredArgsConstructor; +import playlist.server.dto.ErrorDetail; +import playlist.server.exception.BaseErrorCode; +import static org.springframework.http.HttpStatus.*; + +@RequiredArgsConstructor +public enum UserException implements BaseErrorCode { + USER_NOT_FOUND_ERROR(NOT_FOUND.value(), "User_404_1", "유저를 찾을 수 없습니다."); + + private final Integer statusCode; + private final String errorCode; + private final String reason; + + @Override + public ErrorDetail getErrorDetail() { + return ErrorDetail.of(statusCode, errorCode, reason); + } +} diff --git a/Domain/src/main/java/playlist/server/domain/domains/user/Exception/UserNotFoundException.java b/Domain/src/main/java/playlist/server/domain/domains/user/Exception/UserNotFoundException.java new file mode 100644 index 0000000..9a909b4 --- /dev/null +++ b/Domain/src/main/java/playlist/server/domain/domains/user/Exception/UserNotFoundException.java @@ -0,0 +1,13 @@ +package playlist.server.domain.domains.user.Exception; + +import lombok.RequiredArgsConstructor; +import playlist.server.exception.BaseException; + +@RequiredArgsConstructor +public class UserNotFoundException extends BaseException { + public static final BaseException EXCEPTION = new UserNotFoundException(); + + private UserNotFoundException() { + super(UserException.USER_NOT_FOUND_ERROR); + } +} diff --git a/Domain/src/main/java/playlist/server/domain/domains/user/adaptor/UserAdaptor.java b/Domain/src/main/java/playlist/server/domain/domains/user/adaptor/UserAdaptor.java new file mode 100644 index 0000000..b0b294b --- /dev/null +++ b/Domain/src/main/java/playlist/server/domain/domains/user/adaptor/UserAdaptor.java @@ -0,0 +1,24 @@ +package playlist.server.domain.domains.user.adaptor; + + +import lombok.RequiredArgsConstructor; +import playlist.server.annotation.Adaptor; +import playlist.server.domain.domains.user.Exception.UserNotFoundException; +import playlist.server.domain.domains.user.domains.User; +import playlist.server.domain.domains.user.repository.UserRepository; + +@Adaptor +@RequiredArgsConstructor +public class UserAdaptor { + + private final UserAdaptor userAdaptor; + private final UserRepository userRepository; + + public User query(Long userId) { + return userRepository.findById(userId).orElseThrow(() -> UserNotFoundException.EXCEPTION); + } + + public User save(User user) { + return userRepository.save(user); + } +} diff --git a/Domain/src/main/java/playlist/server/domain/domains/user/domains/AccountRole.java b/Domain/src/main/java/playlist/server/domain/domains/user/domains/AccountRole.java new file mode 100644 index 0000000..4432ac4 --- /dev/null +++ b/Domain/src/main/java/playlist/server/domain/domains/user/domains/AccountRole.java @@ -0,0 +1,7 @@ +package playlist.server.domain.domains.user.domains; + +public enum AccountRole { + + USER, + ADMIN; +} diff --git a/Domain/src/main/java/playlist/server/domain/domains/user/domains/LoginType.java b/Domain/src/main/java/playlist/server/domain/domains/user/domains/LoginType.java new file mode 100644 index 0000000..2fa47da --- /dev/null +++ b/Domain/src/main/java/playlist/server/domain/domains/user/domains/LoginType.java @@ -0,0 +1,10 @@ +package playlist.server.domain.domains.user.domains; + +public enum LoginType { + DEFAULT, + KAKAO, + NAVER, + GOOGLE, + APPLE, + GITHUB +} diff --git a/Domain/src/main/java/playlist/server/domain/domains/user/domains/User.java b/Domain/src/main/java/playlist/server/domain/domains/user/domains/User.java new file mode 100644 index 0000000..ad1eea6 --- /dev/null +++ b/Domain/src/main/java/playlist/server/domain/domains/user/domains/User.java @@ -0,0 +1,54 @@ +package playlist.server.domain.domains.user.domains; + + +import jakarta.persistence.*; +import lombok.*; +import org.hibernate.annotations.ColumnDefault; +import org.jetbrains.annotations.NotNull; +import playlist.server.domain.domains.AbstractTimeStamp; + +@Getter +@Entity +@Table(name = "user") +@NoArgsConstructor(access = AccessLevel.PROTECTED) + +public class User extends AbstractTimeStamp { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @Column(nullable = false, length = 200) + private String email; + + @Column(nullable = false, length = 100) + private String password; + + //@Embedded private Profile profile; + + @Enumerated(EnumType.ORDINAL) + @Column(nullable = false, name = "role", columnDefinition = "varchar(32) default 'USER'") + private AccountRole accountRole; + + @Enumerated(EnumType.ORDINAL) + @Column(length = 32, nullable = false, columnDefinition = "varchar(32) default 'DEFAULT'") + private LoginType loginType; + + @NotNull + @Column(name = "fail_cnt", nullable = false) + @ColumnDefault("0") + private int failCnt; + + @NotNull + @Column(name = "rank_id", nullable = false) + @ColumnDefault("0") + private int rankId; + + @NotNull + @ColumnDefault("0") + private int exp; + + @Column(name = "update_user") + private long updateUser; + +} \ No newline at end of file diff --git a/Domain/src/main/java/playlist/server/domain/domains/user/repository/UserRepository.java b/Domain/src/main/java/playlist/server/domain/domains/user/repository/UserRepository.java new file mode 100644 index 0000000..159be36 --- /dev/null +++ b/Domain/src/main/java/playlist/server/domain/domains/user/repository/UserRepository.java @@ -0,0 +1,10 @@ +package playlist.server.domain.domains.user.repository; + +import org.springframework.data.jpa.repository.JpaRepository; +import playlist.server.domain.domains.user.domains.User; + +import java.util.Optional; + +public interface UserRepository extends JpaRepository { + Optional findUserByEmail(String email); +} From 149edbed53e3dea3fbe65853055e7b6409b10bba Mon Sep 17 00:00:00 2001 From: bongsh0112 Date: Thu, 14 Sep 2023 23:16:37 +0900 Subject: [PATCH 2/8] edit: spotlessApply #14 --- .../server/config/security/SecurityUtils.java | 44 +++++------ .../java/playlist/server/utils/UserUtils.java | 21 ++--- .../server/exception/GlobalException.java | 5 +- .../SecurityContextNotFoundException.java | 12 +-- .../domain/domains/AbstractTimeStamp.java | 34 ++++---- .../domains/user/Exception/UserException.java | 23 +++--- .../user/Exception/UserNotFoundException.java | 11 +-- .../domains/user/adaptor/UserAdaptor.java | 22 +++--- .../domains/user/domains/AccountRole.java | 5 +- .../domains/user/domains/LoginType.java | 12 +-- .../domain/domains/user/domains/User.java | 78 +++++++++---------- .../user/repository/UserRepository.java | 6 +- 12 files changed, 137 insertions(+), 136 deletions(-) diff --git a/Api/src/main/java/playlist/server/config/security/SecurityUtils.java b/Api/src/main/java/playlist/server/config/security/SecurityUtils.java index d5e57a4..331133c 100644 --- a/Api/src/main/java/playlist/server/config/security/SecurityUtils.java +++ b/Api/src/main/java/playlist/server/config/security/SecurityUtils.java @@ -1,33 +1,33 @@ package playlist.server.config.security; + +import java.util.List; import org.springframework.security.core.Authentication; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.util.CollectionUtils; import playlist.server.exception.SecurityContextNotFoundException; -import java.util.List; - public class SecurityUtils { - - private static SimpleGrantedAuthority swagger = new SimpleGrantedAuthority("ROLE_SWAGGER"); - - private static List notUserAuthority = List.of(swagger); - - public static Long getCurrentUserId() { - Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); - if (authentication == null) { - throw SecurityContextNotFoundException.EXCEPTION; - } - - if (authentication.isAuthenticated() - && !CollectionUtils.containsAny( - authentication.getAuthorities(), notUserAuthority)) { - return authentication.getName().equals("anonymousUser") - ? 0L - : Long.valueOf(authentication.getName()); + + private static SimpleGrantedAuthority swagger = new SimpleGrantedAuthority("ROLE_SWAGGER"); + + private static List notUserAuthority = List.of(swagger); + + public static Long getCurrentUserId() { + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + if (authentication == null) { + throw SecurityContextNotFoundException.EXCEPTION; + } + + if (authentication.isAuthenticated() + && !CollectionUtils.containsAny( + authentication.getAuthorities(), notUserAuthority)) { + return authentication.getName().equals("anonymousUser") + ? 0L + : Long.valueOf(authentication.getName()); + } + // 스웨거 유저일시 유저 아이디 0 반환 + return 0L; } - // 스웨거 유저일시 유저 아이디 0 반환 - return 0L; - } } diff --git a/Api/src/main/java/playlist/server/utils/UserUtils.java b/Api/src/main/java/playlist/server/utils/UserUtils.java index 6ef9687..58256be 100644 --- a/Api/src/main/java/playlist/server/utils/UserUtils.java +++ b/Api/src/main/java/playlist/server/utils/UserUtils.java @@ -1,5 +1,6 @@ package playlist.server.utils; + import lombok.RequiredArgsConstructor; import playlist.server.config.security.SecurityUtils; import playlist.server.domain.domains.user.adaptor.UserAdaptor; @@ -7,14 +8,14 @@ @RequiredArgsConstructor public class UserUtils { - - private final UserAdaptor userAdaptor; - - public Long getUserId() { - return SecurityUtils.getCurrentUserId(); - } - - public User getUser() { - return userAdaptor.query(SecurityUtils.getCurrentUserId()); - } + + private final UserAdaptor userAdaptor; + + public Long getUserId() { + return SecurityUtils.getCurrentUserId(); + } + + public User getUser() { + return userAdaptor.query(SecurityUtils.getCurrentUserId()); + } } diff --git a/Core/src/main/java/playlist/server/exception/GlobalException.java b/Core/src/main/java/playlist/server/exception/GlobalException.java index d38a68f..ee258b2 100644 --- a/Core/src/main/java/playlist/server/exception/GlobalException.java +++ b/Core/src/main/java/playlist/server/exception/GlobalException.java @@ -6,7 +6,6 @@ import lombok.AllArgsConstructor; import lombok.Getter; -import org.springframework.http.HttpStatus; import playlist.server.dto.ErrorDetail; @Getter @@ -20,8 +19,8 @@ public enum GlobalException implements BaseErrorCode { EXPIRED_REFRESH_TOKEN_ERROR(UNAUTHORIZED.value(), "401-1", "리프레시 토큰이 만료되었습니다."), INVALID_TOKEN_ERROR(UNAUTHORIZED.value(), "401-2", "올바르지 않은 토큰입니다."), DATE_FORMAT_ERROR(BAD_REQUEST.value(), "400-2", "날짜 형식을 확인해주세요."), - SECURITY_CONTEXT_NOT_FOUND_ERROR(INTERNAL_SERVER_ERROR.value(), "500-2", "Security Context 에러입니다.") - ; + SECURITY_CONTEXT_NOT_FOUND_ERROR( + INTERNAL_SERVER_ERROR.value(), "500-2", "Security Context 에러입니다."); private final Integer statusCode; private final String errorCode; diff --git a/Core/src/main/java/playlist/server/exception/SecurityContextNotFoundException.java b/Core/src/main/java/playlist/server/exception/SecurityContextNotFoundException.java index 076043f..2a88cf6 100644 --- a/Core/src/main/java/playlist/server/exception/SecurityContextNotFoundException.java +++ b/Core/src/main/java/playlist/server/exception/SecurityContextNotFoundException.java @@ -1,10 +1,10 @@ package playlist.server.exception; public class SecurityContextNotFoundException extends BaseException { - - public static final BaseException EXCEPTION = new SecurityContextNotFoundException(); - - private SecurityContextNotFoundException() { - super(GlobalException.SECURITY_CONTEXT_NOT_FOUND_ERROR); - } + + public static final BaseException EXCEPTION = new SecurityContextNotFoundException(); + + private SecurityContextNotFoundException() { + super(GlobalException.SECURITY_CONTEXT_NOT_FOUND_ERROR); + } } diff --git a/Domain/src/main/java/playlist/server/domain/domains/AbstractTimeStamp.java b/Domain/src/main/java/playlist/server/domain/domains/AbstractTimeStamp.java index 24414dd..1499006 100644 --- a/Domain/src/main/java/playlist/server/domain/domains/AbstractTimeStamp.java +++ b/Domain/src/main/java/playlist/server/domain/domains/AbstractTimeStamp.java @@ -1,32 +1,34 @@ package playlist.server.domain.domains; + import com.fasterxml.jackson.annotation.JsonFormat; import jakarta.persistence.Column; import jakarta.persistence.EntityListeners; import jakarta.persistence.MappedSuperclass; +import java.sql.Timestamp; import lombok.Getter; import org.hibernate.annotations.CreationTimestamp; import org.hibernate.annotations.UpdateTimestamp; import org.springframework.data.jpa.domain.support.AuditingEntityListener; -import java.sql.Timestamp; - @Getter @MappedSuperclass @EntityListeners(value = {AuditingEntityListener.class}) public abstract class AbstractTimeStamp { - - @Column(name = "created_at", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") - @CreationTimestamp - @JsonFormat( - shape = JsonFormat.Shape.STRING, - pattern = "yyyy-MM-dd hh:mm:ss") - private Timestamp createdAt; - - @Column(name = "created_at", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") - @UpdateTimestamp - @JsonFormat( - shape = JsonFormat.Shape.STRING, - pattern = "yyyy-MM-dd hh:mm:ss") - private Timestamp updatedAt; + + @Column( + name = "created_at", + nullable = false, + columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") + @CreationTimestamp + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd hh:mm:ss") + private Timestamp createdAt; + + @Column( + name = "created_at", + nullable = false, + columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") + @UpdateTimestamp + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd hh:mm:ss") + private Timestamp updatedAt; } diff --git a/Domain/src/main/java/playlist/server/domain/domains/user/Exception/UserException.java b/Domain/src/main/java/playlist/server/domain/domains/user/Exception/UserException.java index 8dd25d6..e63eb29 100644 --- a/Domain/src/main/java/playlist/server/domain/domains/user/Exception/UserException.java +++ b/Domain/src/main/java/playlist/server/domain/domains/user/Exception/UserException.java @@ -1,20 +1,21 @@ package playlist.server.domain.domains.user.Exception; +import static org.springframework.http.HttpStatus.*; + import lombok.RequiredArgsConstructor; import playlist.server.dto.ErrorDetail; import playlist.server.exception.BaseErrorCode; -import static org.springframework.http.HttpStatus.*; @RequiredArgsConstructor public enum UserException implements BaseErrorCode { - USER_NOT_FOUND_ERROR(NOT_FOUND.value(), "User_404_1", "유저를 찾을 수 없습니다."); - - private final Integer statusCode; - private final String errorCode; - private final String reason; - - @Override - public ErrorDetail getErrorDetail() { - return ErrorDetail.of(statusCode, errorCode, reason); - } + USER_NOT_FOUND_ERROR(NOT_FOUND.value(), "User_404_1", "유저를 찾을 수 없습니다."); + + private final Integer statusCode; + private final String errorCode; + private final String reason; + + @Override + public ErrorDetail getErrorDetail() { + return ErrorDetail.of(statusCode, errorCode, reason); + } } diff --git a/Domain/src/main/java/playlist/server/domain/domains/user/Exception/UserNotFoundException.java b/Domain/src/main/java/playlist/server/domain/domains/user/Exception/UserNotFoundException.java index 9a909b4..de55b10 100644 --- a/Domain/src/main/java/playlist/server/domain/domains/user/Exception/UserNotFoundException.java +++ b/Domain/src/main/java/playlist/server/domain/domains/user/Exception/UserNotFoundException.java @@ -1,13 +1,14 @@ package playlist.server.domain.domains.user.Exception; + import lombok.RequiredArgsConstructor; import playlist.server.exception.BaseException; @RequiredArgsConstructor public class UserNotFoundException extends BaseException { - public static final BaseException EXCEPTION = new UserNotFoundException(); - - private UserNotFoundException() { - super(UserException.USER_NOT_FOUND_ERROR); - } + public static final BaseException EXCEPTION = new UserNotFoundException(); + + private UserNotFoundException() { + super(UserException.USER_NOT_FOUND_ERROR); + } } diff --git a/Domain/src/main/java/playlist/server/domain/domains/user/adaptor/UserAdaptor.java b/Domain/src/main/java/playlist/server/domain/domains/user/adaptor/UserAdaptor.java index b0b294b..b075566 100644 --- a/Domain/src/main/java/playlist/server/domain/domains/user/adaptor/UserAdaptor.java +++ b/Domain/src/main/java/playlist/server/domain/domains/user/adaptor/UserAdaptor.java @@ -10,15 +10,15 @@ @Adaptor @RequiredArgsConstructor public class UserAdaptor { - - private final UserAdaptor userAdaptor; - private final UserRepository userRepository; - - public User query(Long userId) { - return userRepository.findById(userId).orElseThrow(() -> UserNotFoundException.EXCEPTION); - } - - public User save(User user) { - return userRepository.save(user); - } + + private final UserAdaptor userAdaptor; + private final UserRepository userRepository; + + public User query(Long userId) { + return userRepository.findById(userId).orElseThrow(() -> UserNotFoundException.EXCEPTION); + } + + public User save(User user) { + return userRepository.save(user); + } } diff --git a/Domain/src/main/java/playlist/server/domain/domains/user/domains/AccountRole.java b/Domain/src/main/java/playlist/server/domain/domains/user/domains/AccountRole.java index 4432ac4..4e9c2bb 100644 --- a/Domain/src/main/java/playlist/server/domain/domains/user/domains/AccountRole.java +++ b/Domain/src/main/java/playlist/server/domain/domains/user/domains/AccountRole.java @@ -1,7 +1,6 @@ package playlist.server.domain.domains.user.domains; public enum AccountRole { - - USER, - ADMIN; + USER, + ADMIN; } diff --git a/Domain/src/main/java/playlist/server/domain/domains/user/domains/LoginType.java b/Domain/src/main/java/playlist/server/domain/domains/user/domains/LoginType.java index 2fa47da..cac7dc8 100644 --- a/Domain/src/main/java/playlist/server/domain/domains/user/domains/LoginType.java +++ b/Domain/src/main/java/playlist/server/domain/domains/user/domains/LoginType.java @@ -1,10 +1,10 @@ package playlist.server.domain.domains.user.domains; public enum LoginType { - DEFAULT, - KAKAO, - NAVER, - GOOGLE, - APPLE, - GITHUB + DEFAULT, + KAKAO, + NAVER, + GOOGLE, + APPLE, + GITHUB } diff --git a/Domain/src/main/java/playlist/server/domain/domains/user/domains/User.java b/Domain/src/main/java/playlist/server/domain/domains/user/domains/User.java index ad1eea6..590044d 100644 --- a/Domain/src/main/java/playlist/server/domain/domains/user/domains/User.java +++ b/Domain/src/main/java/playlist/server/domain/domains/user/domains/User.java @@ -11,44 +11,42 @@ @Entity @Table(name = "user") @NoArgsConstructor(access = AccessLevel.PROTECTED) - public class User extends AbstractTimeStamp { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Long id; - - @Column(nullable = false, length = 200) - private String email; - - @Column(nullable = false, length = 100) - private String password; - - //@Embedded private Profile profile; - - @Enumerated(EnumType.ORDINAL) - @Column(nullable = false, name = "role", columnDefinition = "varchar(32) default 'USER'") - private AccountRole accountRole; - - @Enumerated(EnumType.ORDINAL) - @Column(length = 32, nullable = false, columnDefinition = "varchar(32) default 'DEFAULT'") - private LoginType loginType; - - @NotNull - @Column(name = "fail_cnt", nullable = false) - @ColumnDefault("0") - private int failCnt; - - @NotNull - @Column(name = "rank_id", nullable = false) - @ColumnDefault("0") - private int rankId; - - @NotNull - @ColumnDefault("0") - private int exp; - - @Column(name = "update_user") - private long updateUser; - -} \ No newline at end of file + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @Column(nullable = false, length = 200) + private String email; + + @Column(nullable = false, length = 100) + private String password; + + // @Embedded private Profile profile; + + @Enumerated(EnumType.ORDINAL) + @Column(nullable = false, name = "role", columnDefinition = "varchar(32) default 'USER'") + private AccountRole accountRole; + + @Enumerated(EnumType.ORDINAL) + @Column(length = 32, nullable = false, columnDefinition = "varchar(32) default 'DEFAULT'") + private LoginType loginType; + + @NotNull + @Column(name = "fail_cnt", nullable = false) + @ColumnDefault("0") + private int failCnt; + + @NotNull + @Column(name = "rank_id", nullable = false) + @ColumnDefault("0") + private int rankId; + + @NotNull + @ColumnDefault("0") + private int exp; + + @Column(name = "update_user") + private long updateUser; +} diff --git a/Domain/src/main/java/playlist/server/domain/domains/user/repository/UserRepository.java b/Domain/src/main/java/playlist/server/domain/domains/user/repository/UserRepository.java index 159be36..ac849f6 100644 --- a/Domain/src/main/java/playlist/server/domain/domains/user/repository/UserRepository.java +++ b/Domain/src/main/java/playlist/server/domain/domains/user/repository/UserRepository.java @@ -1,10 +1,10 @@ package playlist.server.domain.domains.user.repository; -import org.springframework.data.jpa.repository.JpaRepository; -import playlist.server.domain.domains.user.domains.User; import java.util.Optional; +import org.springframework.data.jpa.repository.JpaRepository; +import playlist.server.domain.domains.user.domains.User; public interface UserRepository extends JpaRepository { - Optional findUserByEmail(String email); + Optional findUserByEmail(String email); } From bc293680da977986a69c1a4979a19914c335f743 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=B5=E1=84=89=E1=85=B3=E1=86=BC=E1=84=92?= =?UTF-8?q?=E1=85=A7=E1=86=A8?= Date: Fri, 15 Sep 2023 10:55:32 +0900 Subject: [PATCH 3/8] =?UTF-8?q?feat:=20User=20Test=20api=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84=20(TODO=20:=20User=20=EC=83=9D=EC=84=B1=EA=B4=80?= =?UTF-8?q?=EB=A0=A8=20=EC=9D=B4=EC=8A=88=20=ED=95=B4=EA=B2=B0=ED=95=B4?= =?UTF-8?q?=EC=95=BC=ED=95=A8=20#14?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user/controller/UserController.java | 32 +++++++++++++++++++ .../server/user/model/dto/UserCreateDTO.java | 16 ++++++++++ .../server/user/service/devLoginService.java | 23 +++++++++++++ .../java/playlist/server/utils/UserUtils.java | 2 +- .../domains/user/adaptor/UserAdaptor.java | 3 +- .../domains/user/domain/AccountRole.java | 6 ++++ .../user/{domains => domain}/LoginType.java | 2 +- .../user/{domains => domain}/User.java | 9 +++++- .../domains/user/domains/AccountRole.java | 6 ---- .../user/repository/UserRepository.java | 2 +- 10 files changed, 89 insertions(+), 12 deletions(-) create mode 100644 Api/src/main/java/playlist/server/user/controller/UserController.java create mode 100644 Api/src/main/java/playlist/server/user/model/dto/UserCreateDTO.java create mode 100644 Api/src/main/java/playlist/server/user/service/devLoginService.java create mode 100644 Domain/src/main/java/playlist/server/domain/domains/user/domain/AccountRole.java rename Domain/src/main/java/playlist/server/domain/domains/user/{domains => domain}/LoginType.java (64%) rename Domain/src/main/java/playlist/server/domain/domains/user/{domains => domain}/User.java (84%) delete mode 100644 Domain/src/main/java/playlist/server/domain/domains/user/domains/AccountRole.java diff --git a/Api/src/main/java/playlist/server/user/controller/UserController.java b/Api/src/main/java/playlist/server/user/controller/UserController.java new file mode 100644 index 0000000..89f8f63 --- /dev/null +++ b/Api/src/main/java/playlist/server/user/controller/UserController.java @@ -0,0 +1,32 @@ +package playlist.server.user.controller; + + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import playlist.server.user.model.dto.UserCreateDTO; +import playlist.server.user.service.devLoginService; + +@RestController +@RequestMapping("/users") +@RequiredArgsConstructor +@Slf4j +public class UserController { + + private final devLoginService devLoginService; + + @GetMapping("/create") + public void createDevUser(@RequestParam String email, @RequestParam String password) { + log.info("email, password : " + email + " " + password); + + UserCreateDTO userCreateDTO = new UserCreateDTO(email, password); + devLoginService.execute(userCreateDTO); + + // model.addAttribute("email", email); + // model.addAttribute("password",password); + + } +} diff --git a/Api/src/main/java/playlist/server/user/model/dto/UserCreateDTO.java b/Api/src/main/java/playlist/server/user/model/dto/UserCreateDTO.java new file mode 100644 index 0000000..ea034c5 --- /dev/null +++ b/Api/src/main/java/playlist/server/user/model/dto/UserCreateDTO.java @@ -0,0 +1,16 @@ +package playlist.server.user.model.dto; + + +import lombok.Getter; + +@Getter +public class UserCreateDTO { + private final String email; + private final String password; + + // @QueryProjection + public UserCreateDTO(String email, String password) { + this.email = email; + this.password = password; + } +} diff --git a/Api/src/main/java/playlist/server/user/service/devLoginService.java b/Api/src/main/java/playlist/server/user/service/devLoginService.java new file mode 100644 index 0000000..495f779 --- /dev/null +++ b/Api/src/main/java/playlist/server/user/service/devLoginService.java @@ -0,0 +1,23 @@ +package playlist.server.user.service; + + +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import playlist.server.domain.domains.user.adaptor.UserAdaptor; +import playlist.server.domain.domains.user.domain.AccountRole; +import playlist.server.domain.domains.user.domain.User; +import playlist.server.user.model.dto.UserCreateDTO; + +@Service +@RequiredArgsConstructor +@Transactional +public class devLoginService { + private final UserAdaptor userAdaptor; + + public void execute(UserCreateDTO userCreateDTO) { +// User user = new User(userCreateDTO.getEmail(), userCreateDTO.getPassword()); +// User user = User.builder(userCreateDTO.getEmail(), userCreateDTO.getPassword(), AccountRole.ADMIN); +// userAdaptor.save(user); + } +} diff --git a/Api/src/main/java/playlist/server/utils/UserUtils.java b/Api/src/main/java/playlist/server/utils/UserUtils.java index 58256be..a989967 100644 --- a/Api/src/main/java/playlist/server/utils/UserUtils.java +++ b/Api/src/main/java/playlist/server/utils/UserUtils.java @@ -4,7 +4,7 @@ import lombok.RequiredArgsConstructor; import playlist.server.config.security.SecurityUtils; import playlist.server.domain.domains.user.adaptor.UserAdaptor; -import playlist.server.domain.domains.user.domains.User; +import playlist.server.domain.domains.user.domain.User; @RequiredArgsConstructor public class UserUtils { diff --git a/Domain/src/main/java/playlist/server/domain/domains/user/adaptor/UserAdaptor.java b/Domain/src/main/java/playlist/server/domain/domains/user/adaptor/UserAdaptor.java index b075566..359e558 100644 --- a/Domain/src/main/java/playlist/server/domain/domains/user/adaptor/UserAdaptor.java +++ b/Domain/src/main/java/playlist/server/domain/domains/user/adaptor/UserAdaptor.java @@ -4,14 +4,13 @@ import lombok.RequiredArgsConstructor; import playlist.server.annotation.Adaptor; import playlist.server.domain.domains.user.Exception.UserNotFoundException; -import playlist.server.domain.domains.user.domains.User; +import playlist.server.domain.domains.user.domain.User; import playlist.server.domain.domains.user.repository.UserRepository; @Adaptor @RequiredArgsConstructor public class UserAdaptor { - private final UserAdaptor userAdaptor; private final UserRepository userRepository; public User query(Long userId) { diff --git a/Domain/src/main/java/playlist/server/domain/domains/user/domain/AccountRole.java b/Domain/src/main/java/playlist/server/domain/domains/user/domain/AccountRole.java new file mode 100644 index 0000000..14712eb --- /dev/null +++ b/Domain/src/main/java/playlist/server/domain/domains/user/domain/AccountRole.java @@ -0,0 +1,6 @@ +package playlist.server.domain.domains.user.domain; + +public enum AccountRole { + USER, + ADMIN; +} diff --git a/Domain/src/main/java/playlist/server/domain/domains/user/domains/LoginType.java b/Domain/src/main/java/playlist/server/domain/domains/user/domain/LoginType.java similarity index 64% rename from Domain/src/main/java/playlist/server/domain/domains/user/domains/LoginType.java rename to Domain/src/main/java/playlist/server/domain/domains/user/domain/LoginType.java index cac7dc8..c13e6ae 100644 --- a/Domain/src/main/java/playlist/server/domain/domains/user/domains/LoginType.java +++ b/Domain/src/main/java/playlist/server/domain/domains/user/domain/LoginType.java @@ -1,4 +1,4 @@ -package playlist.server.domain.domains.user.domains; +package playlist.server.domain.domains.user.domain; public enum LoginType { DEFAULT, diff --git a/Domain/src/main/java/playlist/server/domain/domains/user/domains/User.java b/Domain/src/main/java/playlist/server/domain/domains/user/domain/User.java similarity index 84% rename from Domain/src/main/java/playlist/server/domain/domains/user/domains/User.java rename to Domain/src/main/java/playlist/server/domain/domains/user/domain/User.java index 590044d..11afb11 100644 --- a/Domain/src/main/java/playlist/server/domain/domains/user/domains/User.java +++ b/Domain/src/main/java/playlist/server/domain/domains/user/domain/User.java @@ -1,4 +1,4 @@ -package playlist.server.domain.domains.user.domains; +package playlist.server.domain.domains.user.domain; import jakarta.persistence.*; @@ -49,4 +49,11 @@ public class User extends AbstractTimeStamp { @Column(name = "update_user") private long updateUser; + + @Builder + public User(String email, String password, AccountRole role) { + this.email = email; + this.accountRole = role; + this.password = password; + } } diff --git a/Domain/src/main/java/playlist/server/domain/domains/user/domains/AccountRole.java b/Domain/src/main/java/playlist/server/domain/domains/user/domains/AccountRole.java deleted file mode 100644 index 4e9c2bb..0000000 --- a/Domain/src/main/java/playlist/server/domain/domains/user/domains/AccountRole.java +++ /dev/null @@ -1,6 +0,0 @@ -package playlist.server.domain.domains.user.domains; - -public enum AccountRole { - USER, - ADMIN; -} diff --git a/Domain/src/main/java/playlist/server/domain/domains/user/repository/UserRepository.java b/Domain/src/main/java/playlist/server/domain/domains/user/repository/UserRepository.java index ac849f6..42f38b0 100644 --- a/Domain/src/main/java/playlist/server/domain/domains/user/repository/UserRepository.java +++ b/Domain/src/main/java/playlist/server/domain/domains/user/repository/UserRepository.java @@ -3,7 +3,7 @@ import java.util.Optional; import org.springframework.data.jpa.repository.JpaRepository; -import playlist.server.domain.domains.user.domains.User; +import playlist.server.domain.domains.user.domain.User; public interface UserRepository extends JpaRepository { Optional findUserByEmail(String email); From 5a9e0e7df6735ca8df89df289a844eb175c39f03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=B5=E1=84=89=E1=85=B3=E1=86=BC=E1=84=92?= =?UTF-8?q?=E1=85=A7=E1=86=A8?= Date: Fri, 15 Sep 2023 14:41:37 +0900 Subject: [PATCH 4/8] =?UTF-8?q?feat:=20User=20Test=20api=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84=20(TODO=20:=20User=20=EC=83=9D=EC=84=B1=EA=B4=80?= =?UTF-8?q?=EB=A0=A8=20=EC=9D=B4=EC=8A=88=20=ED=95=B4=EA=B2=B0=ED=95=B4?= =?UTF-8?q?=EC=95=BC=ED=95=A8)=20#14?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../playlist/server/user/service/devLoginService.java | 10 +++++----- .../domains/user/Exception/UserNotFoundException.java | 2 -- .../server/domain/domains/user/domain/User.java | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Api/src/main/java/playlist/server/user/service/devLoginService.java b/Api/src/main/java/playlist/server/user/service/devLoginService.java index 495f779..3e75603 100644 --- a/Api/src/main/java/playlist/server/user/service/devLoginService.java +++ b/Api/src/main/java/playlist/server/user/service/devLoginService.java @@ -5,8 +5,6 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import playlist.server.domain.domains.user.adaptor.UserAdaptor; -import playlist.server.domain.domains.user.domain.AccountRole; -import playlist.server.domain.domains.user.domain.User; import playlist.server.user.model.dto.UserCreateDTO; @Service @@ -16,8 +14,10 @@ public class devLoginService { private final UserAdaptor userAdaptor; public void execute(UserCreateDTO userCreateDTO) { -// User user = new User(userCreateDTO.getEmail(), userCreateDTO.getPassword()); -// User user = User.builder(userCreateDTO.getEmail(), userCreateDTO.getPassword(), AccountRole.ADMIN); -// userAdaptor.save(user); + // User user = new User(userCreateDTO.getEmail(), + // userCreateDTO.getPassword()); + // User user = User.builder(userCreateDTO.getEmail(), + // userCreateDTO.getPassword(), AccountRole.ADMIN); + // userAdaptor.save(user); } } diff --git a/Domain/src/main/java/playlist/server/domain/domains/user/Exception/UserNotFoundException.java b/Domain/src/main/java/playlist/server/domain/domains/user/Exception/UserNotFoundException.java index de55b10..d88ff1c 100644 --- a/Domain/src/main/java/playlist/server/domain/domains/user/Exception/UserNotFoundException.java +++ b/Domain/src/main/java/playlist/server/domain/domains/user/Exception/UserNotFoundException.java @@ -1,10 +1,8 @@ package playlist.server.domain.domains.user.Exception; -import lombok.RequiredArgsConstructor; import playlist.server.exception.BaseException; -@RequiredArgsConstructor public class UserNotFoundException extends BaseException { public static final BaseException EXCEPTION = new UserNotFoundException(); diff --git a/Domain/src/main/java/playlist/server/domain/domains/user/domain/User.java b/Domain/src/main/java/playlist/server/domain/domains/user/domain/User.java index 11afb11..5498cb1 100644 --- a/Domain/src/main/java/playlist/server/domain/domains/user/domain/User.java +++ b/Domain/src/main/java/playlist/server/domain/domains/user/domain/User.java @@ -51,7 +51,7 @@ public class User extends AbstractTimeStamp { private long updateUser; @Builder - public User(String email, String password, AccountRole role) { + public User(String email, String password, AccountRole role) { this.email = email; this.accountRole = role; this.password = password; From ca8bb3ef0c8b5b0055bd1c375035e9eaaea9a23c Mon Sep 17 00:00:00 2001 From: dongyoungs Date: Fri, 15 Sep 2023 19:21:46 +0900 Subject: [PATCH 5/8] =?UTF-8?q?feat=20:=20=EC=9C=A0=EC=A0=80=20=EC=97=94?= =?UTF-8?q?=ED=84=B0=ED=8B=B0=20=EC=83=9D=EC=84=B1=20=EB=B9=8C=EB=8D=94?= =?UTF-8?q?=ED=8C=A8=ED=84=B4=EC=9C=BC=EB=A1=9C=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/user/service/devLoginService.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Api/src/main/java/playlist/server/user/service/devLoginService.java b/Api/src/main/java/playlist/server/user/service/devLoginService.java index 3e75603..117cedd 100644 --- a/Api/src/main/java/playlist/server/user/service/devLoginService.java +++ b/Api/src/main/java/playlist/server/user/service/devLoginService.java @@ -5,6 +5,8 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import playlist.server.domain.domains.user.adaptor.UserAdaptor; +import playlist.server.domain.domains.user.domain.AccountRole; +import playlist.server.domain.domains.user.domain.User; import playlist.server.user.model.dto.UserCreateDTO; @Service @@ -14,10 +16,11 @@ public class devLoginService { private final UserAdaptor userAdaptor; public void execute(UserCreateDTO userCreateDTO) { - // User user = new User(userCreateDTO.getEmail(), - // userCreateDTO.getPassword()); - // User user = User.builder(userCreateDTO.getEmail(), - // userCreateDTO.getPassword(), AccountRole.ADMIN); - // userAdaptor.save(user); + User user = User.builder() + .email(userCreateDTO.getEmail()) + .password(userCreateDTO.getPassword()) + .role(AccountRole.ADMIN) + .build(); + userAdaptor.save(user); } } From fdd3f41573f40c2de63222b37f317a1948f45bc3 Mon Sep 17 00:00:00 2001 From: dongyoungs Date: Fri, 15 Sep 2023 19:47:42 +0900 Subject: [PATCH 6/8] =?UTF-8?q?feat:=20Auth=20=EA=B4=80=EB=A0=A8=20?= =?UTF-8?q?=ED=85=8C=EC=9D=B4=EB=B8=94=20=EA=B0=9D=EC=B2=B4(=EC=97=94?= =?UTF-8?q?=ED=84=B0=ED=8B=B0)=20=EC=83=9D=EC=84=B1=20fix=20:=20=20?= =?UTF-8?q?=EA=B5=AC=EA=B8=80=20=EC=8A=A4=ED=83=80=EC=9D=BC=20=ED=98=95?= =?UTF-8?q?=EC=8B=9D=EC=97=90=20=EB=A7=9E=EA=B2=8C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/user/service/devLoginService.java | 17 ++++--- .../java/playlist/server/utils/UserUtils.java | 4 +- .../Exception/UserException.java | 2 +- .../Exception/UserNotFoundException.java | 2 +- .../{user => auth}/adaptor/UserAdaptor.java | 8 +-- .../domains/auth/domain/AccountRole.java | 6 +++ .../{user => auth}/domain/LoginType.java | 2 +- .../domains/{user => auth}/domain/User.java | 2 +- .../domain/domains/auth/domain/follow.java | 31 ++++++++++++ .../domain/domains/auth/domain/following.java | 31 ++++++++++++ .../domain/domains/auth/domain/history.java | 49 +++++++++++++++++++ .../domains/auth/domain/suspensionDate.java | 33 +++++++++++++ .../repository/UserRepository.java | 4 +- .../domains/user/domain/AccountRole.java | 6 --- 14 files changed, 171 insertions(+), 26 deletions(-) rename Domain/src/main/java/playlist/server/domain/domains/{user => auth}/Exception/UserException.java (91%) rename Domain/src/main/java/playlist/server/domain/domains/{user => auth}/Exception/UserNotFoundException.java (83%) rename Domain/src/main/java/playlist/server/domain/domains/{user => auth}/adaptor/UserAdaptor.java (65%) create mode 100644 Domain/src/main/java/playlist/server/domain/domains/auth/domain/AccountRole.java rename Domain/src/main/java/playlist/server/domain/domains/{user => auth}/domain/LoginType.java (64%) rename Domain/src/main/java/playlist/server/domain/domains/{user => auth}/domain/User.java (96%) create mode 100644 Domain/src/main/java/playlist/server/domain/domains/auth/domain/follow.java create mode 100644 Domain/src/main/java/playlist/server/domain/domains/auth/domain/following.java create mode 100644 Domain/src/main/java/playlist/server/domain/domains/auth/domain/history.java create mode 100644 Domain/src/main/java/playlist/server/domain/domains/auth/domain/suspensionDate.java rename Domain/src/main/java/playlist/server/domain/domains/{user => auth}/repository/UserRepository.java (65%) delete mode 100644 Domain/src/main/java/playlist/server/domain/domains/user/domain/AccountRole.java diff --git a/Api/src/main/java/playlist/server/user/service/devLoginService.java b/Api/src/main/java/playlist/server/user/service/devLoginService.java index 117cedd..dfddd75 100644 --- a/Api/src/main/java/playlist/server/user/service/devLoginService.java +++ b/Api/src/main/java/playlist/server/user/service/devLoginService.java @@ -4,9 +4,9 @@ import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import playlist.server.domain.domains.user.adaptor.UserAdaptor; -import playlist.server.domain.domains.user.domain.AccountRole; -import playlist.server.domain.domains.user.domain.User; +import playlist.server.domain.domains.auth.adaptor.UserAdaptor; +import playlist.server.domain.domains.auth.domain.AccountRole; +import playlist.server.domain.domains.auth.domain.User; import playlist.server.user.model.dto.UserCreateDTO; @Service @@ -16,11 +16,12 @@ public class devLoginService { private final UserAdaptor userAdaptor; public void execute(UserCreateDTO userCreateDTO) { - User user = User.builder() - .email(userCreateDTO.getEmail()) - .password(userCreateDTO.getPassword()) - .role(AccountRole.ADMIN) - .build(); + User user = + User.builder() + .email(userCreateDTO.getEmail()) + .password(userCreateDTO.getPassword()) + .role(AccountRole.ADMIN) + .build(); userAdaptor.save(user); } } diff --git a/Api/src/main/java/playlist/server/utils/UserUtils.java b/Api/src/main/java/playlist/server/utils/UserUtils.java index a989967..43dbd62 100644 --- a/Api/src/main/java/playlist/server/utils/UserUtils.java +++ b/Api/src/main/java/playlist/server/utils/UserUtils.java @@ -3,8 +3,8 @@ import lombok.RequiredArgsConstructor; import playlist.server.config.security.SecurityUtils; -import playlist.server.domain.domains.user.adaptor.UserAdaptor; -import playlist.server.domain.domains.user.domain.User; +import playlist.server.domain.domains.auth.adaptor.UserAdaptor; +import playlist.server.domain.domains.auth.domain.User; @RequiredArgsConstructor public class UserUtils { diff --git a/Domain/src/main/java/playlist/server/domain/domains/user/Exception/UserException.java b/Domain/src/main/java/playlist/server/domain/domains/auth/Exception/UserException.java similarity index 91% rename from Domain/src/main/java/playlist/server/domain/domains/user/Exception/UserException.java rename to Domain/src/main/java/playlist/server/domain/domains/auth/Exception/UserException.java index e63eb29..c4a5dfc 100644 --- a/Domain/src/main/java/playlist/server/domain/domains/user/Exception/UserException.java +++ b/Domain/src/main/java/playlist/server/domain/domains/auth/Exception/UserException.java @@ -1,4 +1,4 @@ -package playlist.server.domain.domains.user.Exception; +package playlist.server.domain.domains.auth.Exception; import static org.springframework.http.HttpStatus.*; diff --git a/Domain/src/main/java/playlist/server/domain/domains/user/Exception/UserNotFoundException.java b/Domain/src/main/java/playlist/server/domain/domains/auth/Exception/UserNotFoundException.java similarity index 83% rename from Domain/src/main/java/playlist/server/domain/domains/user/Exception/UserNotFoundException.java rename to Domain/src/main/java/playlist/server/domain/domains/auth/Exception/UserNotFoundException.java index d88ff1c..69e1621 100644 --- a/Domain/src/main/java/playlist/server/domain/domains/user/Exception/UserNotFoundException.java +++ b/Domain/src/main/java/playlist/server/domain/domains/auth/Exception/UserNotFoundException.java @@ -1,4 +1,4 @@ -package playlist.server.domain.domains.user.Exception; +package playlist.server.domain.domains.auth.Exception; import playlist.server.exception.BaseException; diff --git a/Domain/src/main/java/playlist/server/domain/domains/user/adaptor/UserAdaptor.java b/Domain/src/main/java/playlist/server/domain/domains/auth/adaptor/UserAdaptor.java similarity index 65% rename from Domain/src/main/java/playlist/server/domain/domains/user/adaptor/UserAdaptor.java rename to Domain/src/main/java/playlist/server/domain/domains/auth/adaptor/UserAdaptor.java index 359e558..5019a86 100644 --- a/Domain/src/main/java/playlist/server/domain/domains/user/adaptor/UserAdaptor.java +++ b/Domain/src/main/java/playlist/server/domain/domains/auth/adaptor/UserAdaptor.java @@ -1,11 +1,11 @@ -package playlist.server.domain.domains.user.adaptor; +package playlist.server.domain.domains.auth.adaptor; import lombok.RequiredArgsConstructor; import playlist.server.annotation.Adaptor; -import playlist.server.domain.domains.user.Exception.UserNotFoundException; -import playlist.server.domain.domains.user.domain.User; -import playlist.server.domain.domains.user.repository.UserRepository; +import playlist.server.domain.domains.auth.Exception.UserNotFoundException; +import playlist.server.domain.domains.auth.domain.User; +import playlist.server.domain.domains.auth.repository.UserRepository; @Adaptor @RequiredArgsConstructor diff --git a/Domain/src/main/java/playlist/server/domain/domains/auth/domain/AccountRole.java b/Domain/src/main/java/playlist/server/domain/domains/auth/domain/AccountRole.java new file mode 100644 index 0000000..5367808 --- /dev/null +++ b/Domain/src/main/java/playlist/server/domain/domains/auth/domain/AccountRole.java @@ -0,0 +1,6 @@ +package playlist.server.domain.domains.auth.domain; + +public enum AccountRole { + USER, + ADMIN; +} diff --git a/Domain/src/main/java/playlist/server/domain/domains/user/domain/LoginType.java b/Domain/src/main/java/playlist/server/domain/domains/auth/domain/LoginType.java similarity index 64% rename from Domain/src/main/java/playlist/server/domain/domains/user/domain/LoginType.java rename to Domain/src/main/java/playlist/server/domain/domains/auth/domain/LoginType.java index c13e6ae..c82973f 100644 --- a/Domain/src/main/java/playlist/server/domain/domains/user/domain/LoginType.java +++ b/Domain/src/main/java/playlist/server/domain/domains/auth/domain/LoginType.java @@ -1,4 +1,4 @@ -package playlist.server.domain.domains.user.domain; +package playlist.server.domain.domains.auth.domain; public enum LoginType { DEFAULT, diff --git a/Domain/src/main/java/playlist/server/domain/domains/user/domain/User.java b/Domain/src/main/java/playlist/server/domain/domains/auth/domain/User.java similarity index 96% rename from Domain/src/main/java/playlist/server/domain/domains/user/domain/User.java rename to Domain/src/main/java/playlist/server/domain/domains/auth/domain/User.java index 5498cb1..99c37b3 100644 --- a/Domain/src/main/java/playlist/server/domain/domains/user/domain/User.java +++ b/Domain/src/main/java/playlist/server/domain/domains/auth/domain/User.java @@ -1,4 +1,4 @@ -package playlist.server.domain.domains.user.domain; +package playlist.server.domain.domains.auth.domain; import jakarta.persistence.*; diff --git a/Domain/src/main/java/playlist/server/domain/domains/auth/domain/follow.java b/Domain/src/main/java/playlist/server/domain/domains/auth/domain/follow.java new file mode 100644 index 0000000..bfd8244 --- /dev/null +++ b/Domain/src/main/java/playlist/server/domain/domains/auth/domain/follow.java @@ -0,0 +1,31 @@ +package playlist.server.domain.domains.auth.domain; + + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; +import playlist.server.domain.domains.AbstractTimeStamp; + +@Getter +@Entity +// @Table(name = "follow") +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class follow extends AbstractTimeStamp { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + // 이 밑으로는 뭔가 기록할만한 요소 들 + + @Column(nullable = false) + private Long userId; + + @Column(nullable = false) + private Long followUserId; +} diff --git a/Domain/src/main/java/playlist/server/domain/domains/auth/domain/following.java b/Domain/src/main/java/playlist/server/domain/domains/auth/domain/following.java new file mode 100644 index 0000000..d16b514 --- /dev/null +++ b/Domain/src/main/java/playlist/server/domain/domains/auth/domain/following.java @@ -0,0 +1,31 @@ +package playlist.server.domain.domains.auth.domain; + + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; +import playlist.server.domain.domains.AbstractTimeStamp; + +@Getter +@Entity +// @Table(name = "following") +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class following extends AbstractTimeStamp { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + // 이 밑으로는 뭔가 기록할만한 요소 들 + + @Column(nullable = false) + private Long userId; + + @Column(nullable = false) + private Long followingUserId; +} diff --git a/Domain/src/main/java/playlist/server/domain/domains/auth/domain/history.java b/Domain/src/main/java/playlist/server/domain/domains/auth/domain/history.java new file mode 100644 index 0000000..1a6b92f --- /dev/null +++ b/Domain/src/main/java/playlist/server/domain/domains/auth/domain/history.java @@ -0,0 +1,49 @@ +package playlist.server.domain.domains.auth.domain; + + +import com.fasterxml.jackson.annotation.JsonFormat; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.Table; +import java.sql.Timestamp; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.hibernate.annotations.CreationTimestamp; +import playlist.server.domain.domains.AbstractTimeStamp; + +@Getter +@Entity +@Table(name = "user_login_history") +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class history extends AbstractTimeStamp { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @Column(name = "login_at", nullable = false) + @CreationTimestamp + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd hh:mm:ss") + private Timestamp loginAt; + + // 이 밑으로는 뭔가 기록할만한 요소 들 + + @Column(nullable = false, length = 200) + private String param1; + + @Column(nullable = false, length = 200) + private String param2; + + @Column(nullable = false, length = 200) + private String param3; + + @Column(nullable = false, length = 200) + private String param4; + + @Column(nullable = false, length = 200) + private String param5; +} diff --git a/Domain/src/main/java/playlist/server/domain/domains/auth/domain/suspensionDate.java b/Domain/src/main/java/playlist/server/domain/domains/auth/domain/suspensionDate.java new file mode 100644 index 0000000..4f830d5 --- /dev/null +++ b/Domain/src/main/java/playlist/server/domain/domains/auth/domain/suspensionDate.java @@ -0,0 +1,33 @@ +package playlist.server.domain.domains.auth.domain; + + +import com.fasterxml.jackson.annotation.JsonFormat; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.Table; +import java.sql.Timestamp; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; +import playlist.server.domain.domains.AbstractTimeStamp; + +@Getter +@Entity +@Table(name = "suspension_date") +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class suspensionDate extends AbstractTimeStamp { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @Column(nullable = false) + private Long userId; + + @Column(nullable = false) + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd hh:mm:ss") + private Timestamp suspensionAt; +} diff --git a/Domain/src/main/java/playlist/server/domain/domains/user/repository/UserRepository.java b/Domain/src/main/java/playlist/server/domain/domains/auth/repository/UserRepository.java similarity index 65% rename from Domain/src/main/java/playlist/server/domain/domains/user/repository/UserRepository.java rename to Domain/src/main/java/playlist/server/domain/domains/auth/repository/UserRepository.java index 42f38b0..a1a4cd4 100644 --- a/Domain/src/main/java/playlist/server/domain/domains/user/repository/UserRepository.java +++ b/Domain/src/main/java/playlist/server/domain/domains/auth/repository/UserRepository.java @@ -1,9 +1,9 @@ -package playlist.server.domain.domains.user.repository; +package playlist.server.domain.domains.auth.repository; import java.util.Optional; import org.springframework.data.jpa.repository.JpaRepository; -import playlist.server.domain.domains.user.domain.User; +import playlist.server.domain.domains.auth.domain.User; public interface UserRepository extends JpaRepository { Optional findUserByEmail(String email); diff --git a/Domain/src/main/java/playlist/server/domain/domains/user/domain/AccountRole.java b/Domain/src/main/java/playlist/server/domain/domains/user/domain/AccountRole.java deleted file mode 100644 index 14712eb..0000000 --- a/Domain/src/main/java/playlist/server/domain/domains/user/domain/AccountRole.java +++ /dev/null @@ -1,6 +0,0 @@ -package playlist.server.domain.domains.user.domain; - -public enum AccountRole { - USER, - ADMIN; -} From 3703b14a4c6e6358aedcca5628e73c0f4fe5796f Mon Sep 17 00:00:00 2001 From: dongyoungs Date: Fri, 15 Sep 2023 19:56:16 +0900 Subject: [PATCH 7/8] =?UTF-8?q?feat=20:=20Notificate=20=EA=B4=80=EB=A0=A8?= =?UTF-8?q?=20=EC=97=94=ED=84=B0=ED=8B=B0=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/domains/AbstractTimeStamp.java | 2 +- .../auth/domain/{follow.java => Follow.java} | 2 +- .../domain/{following.java => Following.java} | 2 +- .../domain/{history.java => History.java} | 2 +- ...uspensionDate.java => SuspensionDate.java} | 2 +- .../domains/notificate/domain/Setting.java | 49 +++++++++++++++++++ 6 files changed, 54 insertions(+), 5 deletions(-) rename Domain/src/main/java/playlist/server/domain/domains/auth/domain/{follow.java => Follow.java} (93%) rename Domain/src/main/java/playlist/server/domain/domains/auth/domain/{following.java => Following.java} (93%) rename Domain/src/main/java/playlist/server/domain/domains/auth/domain/{history.java => History.java} (96%) rename Domain/src/main/java/playlist/server/domain/domains/auth/domain/{suspensionDate.java => SuspensionDate.java} (94%) create mode 100644 Domain/src/main/java/playlist/server/domain/domains/notificate/domain/Setting.java diff --git a/Domain/src/main/java/playlist/server/domain/domains/AbstractTimeStamp.java b/Domain/src/main/java/playlist/server/domain/domains/AbstractTimeStamp.java index 1499006..3ecae9f 100644 --- a/Domain/src/main/java/playlist/server/domain/domains/AbstractTimeStamp.java +++ b/Domain/src/main/java/playlist/server/domain/domains/AbstractTimeStamp.java @@ -25,7 +25,7 @@ public abstract class AbstractTimeStamp { private Timestamp createdAt; @Column( - name = "created_at", + name = "updated_at", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") @UpdateTimestamp diff --git a/Domain/src/main/java/playlist/server/domain/domains/auth/domain/follow.java b/Domain/src/main/java/playlist/server/domain/domains/auth/domain/Follow.java similarity index 93% rename from Domain/src/main/java/playlist/server/domain/domains/auth/domain/follow.java rename to Domain/src/main/java/playlist/server/domain/domains/auth/domain/Follow.java index bfd8244..1a60c71 100644 --- a/Domain/src/main/java/playlist/server/domain/domains/auth/domain/follow.java +++ b/Domain/src/main/java/playlist/server/domain/domains/auth/domain/Follow.java @@ -15,7 +15,7 @@ @Entity // @Table(name = "follow") @NoArgsConstructor(access = AccessLevel.PROTECTED) -public class follow extends AbstractTimeStamp { +public class Follow extends AbstractTimeStamp { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) diff --git a/Domain/src/main/java/playlist/server/domain/domains/auth/domain/following.java b/Domain/src/main/java/playlist/server/domain/domains/auth/domain/Following.java similarity index 93% rename from Domain/src/main/java/playlist/server/domain/domains/auth/domain/following.java rename to Domain/src/main/java/playlist/server/domain/domains/auth/domain/Following.java index d16b514..5488be7 100644 --- a/Domain/src/main/java/playlist/server/domain/domains/auth/domain/following.java +++ b/Domain/src/main/java/playlist/server/domain/domains/auth/domain/Following.java @@ -15,7 +15,7 @@ @Entity // @Table(name = "following") @NoArgsConstructor(access = AccessLevel.PROTECTED) -public class following extends AbstractTimeStamp { +public class Following extends AbstractTimeStamp { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) diff --git a/Domain/src/main/java/playlist/server/domain/domains/auth/domain/history.java b/Domain/src/main/java/playlist/server/domain/domains/auth/domain/History.java similarity index 96% rename from Domain/src/main/java/playlist/server/domain/domains/auth/domain/history.java rename to Domain/src/main/java/playlist/server/domain/domains/auth/domain/History.java index 1a6b92f..84938d2 100644 --- a/Domain/src/main/java/playlist/server/domain/domains/auth/domain/history.java +++ b/Domain/src/main/java/playlist/server/domain/domains/auth/domain/History.java @@ -19,7 +19,7 @@ @Entity @Table(name = "user_login_history") @NoArgsConstructor(access = AccessLevel.PROTECTED) -public class history extends AbstractTimeStamp { +public class History extends AbstractTimeStamp { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) diff --git a/Domain/src/main/java/playlist/server/domain/domains/auth/domain/suspensionDate.java b/Domain/src/main/java/playlist/server/domain/domains/auth/domain/SuspensionDate.java similarity index 94% rename from Domain/src/main/java/playlist/server/domain/domains/auth/domain/suspensionDate.java rename to Domain/src/main/java/playlist/server/domain/domains/auth/domain/SuspensionDate.java index 4f830d5..aa9c174 100644 --- a/Domain/src/main/java/playlist/server/domain/domains/auth/domain/suspensionDate.java +++ b/Domain/src/main/java/playlist/server/domain/domains/auth/domain/SuspensionDate.java @@ -18,7 +18,7 @@ @Entity @Table(name = "suspension_date") @NoArgsConstructor(access = AccessLevel.PROTECTED) -public class suspensionDate extends AbstractTimeStamp { +public class SuspensionDate extends AbstractTimeStamp { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) diff --git a/Domain/src/main/java/playlist/server/domain/domains/notificate/domain/Setting.java b/Domain/src/main/java/playlist/server/domain/domains/notificate/domain/Setting.java new file mode 100644 index 0000000..845721f --- /dev/null +++ b/Domain/src/main/java/playlist/server/domain/domains/notificate/domain/Setting.java @@ -0,0 +1,49 @@ +package playlist.server.domain.domains.notificate.domain; + + +import com.fasterxml.jackson.annotation.JsonFormat; +import jakarta.persistence.*; +import java.sql.Timestamp; +import lombok.*; +import org.hibernate.annotations.UpdateTimestamp; +import playlist.server.domain.domains.AbstractTimeStamp; + +@Getter +@Entity +@Table(name = "setting") +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class Setting extends AbstractTimeStamp { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @Column(nullable = false, length = 200) + private String email; + + boolean etc_param1; + + boolean etc_param2; + + boolean etc_param3; + + boolean etc_param4; + + boolean etc_param5; + + boolean etc_param6; + + boolean etc_param7; + + boolean etc_param8; + + boolean etc_param9; + + @Column( + name = "updated_at", + nullable = false, + columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") + @UpdateTimestamp + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd hh:mm:ss") + private Timestamp createdAt; +} From c7d7ebc293521b5a92a8ddb58e7bb1665159e268 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=B5=E1=84=89=E1=85=B3=E1=86=BC=E1=84=92?= =?UTF-8?q?=E1=85=A7=E1=86=A8?= Date: Wed, 20 Sep 2023 14:02:14 +0900 Subject: [PATCH 8/8] =?UTF-8?q?feat:=20User=20entity=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/domains/auth/domain/User.java | 9 +++-- .../domains/notificate/domain/Setting.java | 34 +++++++++---------- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/Domain/src/main/java/playlist/server/domain/domains/auth/domain/User.java b/Domain/src/main/java/playlist/server/domain/domains/auth/domain/User.java index 99c37b3..b6f5ad4 100644 --- a/Domain/src/main/java/playlist/server/domain/domains/auth/domain/User.java +++ b/Domain/src/main/java/playlist/server/domain/domains/auth/domain/User.java @@ -9,7 +9,7 @@ @Getter @Entity -@Table(name = "user") +@Table(name = "tbl_user") @NoArgsConstructor(access = AccessLevel.PROTECTED) public class User extends AbstractTimeStamp { @@ -34,12 +34,12 @@ public class User extends AbstractTimeStamp { private LoginType loginType; @NotNull - @Column(name = "fail_cnt", nullable = false) + @Column(nullable = false) @ColumnDefault("0") private int failCnt; @NotNull - @Column(name = "rank_id", nullable = false) + @Column(nullable = false) @ColumnDefault("0") private int rankId; @@ -47,8 +47,7 @@ public class User extends AbstractTimeStamp { @ColumnDefault("0") private int exp; - @Column(name = "update_user") - private long updateUser; + @Column private long updateUser; @Builder public User(String email, String password, AccountRole role) { diff --git a/Domain/src/main/java/playlist/server/domain/domains/notificate/domain/Setting.java b/Domain/src/main/java/playlist/server/domain/domains/notificate/domain/Setting.java index 845721f..2a502eb 100644 --- a/Domain/src/main/java/playlist/server/domain/domains/notificate/domain/Setting.java +++ b/Domain/src/main/java/playlist/server/domain/domains/notificate/domain/Setting.java @@ -21,23 +21,23 @@ public class Setting extends AbstractTimeStamp { @Column(nullable = false, length = 200) private String email; - boolean etc_param1; - - boolean etc_param2; - - boolean etc_param3; - - boolean etc_param4; - - boolean etc_param5; - - boolean etc_param6; - - boolean etc_param7; - - boolean etc_param8; - - boolean etc_param9; + // boolean etc_param1; + // + // boolean etc_param2; + // + // boolean etc_param3; + // + // boolean etc_param4; + // + // boolean etc_param5; + // + // boolean etc_param6; + // + // boolean etc_param7; + // + // boolean etc_param8; + // + // boolean etc_param9; @Column( name = "updated_at",