issue # 회원가입 api 구현 중
This commit is contained in:
@@ -17,6 +17,6 @@ public class MailConfig {
|
|||||||
@Value("${spring.mail.clientSecret}")
|
@Value("${spring.mail.clientSecret}")
|
||||||
private String clientSecret;
|
private String clientSecret;
|
||||||
|
|
||||||
@Value("${spring.mail.refershToken}")
|
@Value("${spring.mail.refreshToken}")
|
||||||
private String refreshToken;
|
private String refreshToken;
|
||||||
}
|
}
|
||||||
@@ -3,7 +3,6 @@ package com.baekyangdan.scheduler.entity.user;
|
|||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
import org.hibernate.annotations.CreationTimestamp;
|
import org.hibernate.annotations.CreationTimestamp;
|
||||||
|
|
||||||
import com.baekyangdan.scheduler.code.user.UserStatus;
|
import com.baekyangdan.scheduler.code.user.UserStatus;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@@ -19,14 +18,19 @@ import java.util.UUID;
|
|||||||
@Builder
|
@Builder
|
||||||
@Entity
|
@Entity
|
||||||
@Table(
|
@Table(
|
||||||
name = "USER",
|
name = "account",
|
||||||
indexes = @Index(name = "user_pk", columnList = "id")
|
indexes = @Index(name = "user_pk", columnList = "id")
|
||||||
)
|
)
|
||||||
public class UserEntity {
|
public class UserEntity {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
|
@GeneratedValue
|
||||||
|
@org.hibernate.annotations.UuidGenerator
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
private String id;
|
private UUID id;
|
||||||
|
|
||||||
|
@Column(nullable=false, length=50)
|
||||||
|
private String accountId;
|
||||||
|
|
||||||
@Column(nullable = false, length = 50)
|
@Column(nullable = false, length = 50)
|
||||||
private String name;
|
private String name;
|
||||||
@@ -34,8 +38,9 @@ public class UserEntity {
|
|||||||
@Column(nullable = false, length = 100)
|
@Column(nullable = false, length = 100)
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
|
@Builder.Default
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
private Boolean isDeleted;
|
private boolean isDeleted = false;
|
||||||
|
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
private String password;
|
private String password;
|
||||||
@@ -46,9 +51,9 @@ public class UserEntity {
|
|||||||
@Column
|
@Column
|
||||||
private LocalDateTime birthday;
|
private LocalDateTime birthday;
|
||||||
|
|
||||||
@Enumerated(EnumType.STRING)
|
@Builder.Default
|
||||||
@Column(columnDefinition = "user_status")
|
@Column
|
||||||
private UserStatus status;
|
private String status = UserStatus.WAIT.getValue();
|
||||||
|
|
||||||
@CreationTimestamp
|
@CreationTimestamp
|
||||||
@Column(updatable = false)
|
@Column(updatable = false)
|
||||||
|
|||||||
@@ -31,12 +31,11 @@ public class UserRequest {
|
|||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
public static class SignUp {
|
public static class SignUp {
|
||||||
private String id;
|
private String accountId;
|
||||||
private String email;
|
private String email;
|
||||||
private String name;
|
private String name;
|
||||||
private String nickname;
|
private String nickname;
|
||||||
private String password;
|
private String password;
|
||||||
private String passwordResetCode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 로그인
|
// 2. 로그인
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.baekyangdan.scheduler.service.user;
|
package com.baekyangdan.scheduler.service.user;
|
||||||
|
|
||||||
|
import com.baekyangdan.scheduler.code.user.UserStatus;
|
||||||
import com.baekyangdan.scheduler.entity.user.UserEntity;
|
import com.baekyangdan.scheduler.entity.user.UserEntity;
|
||||||
import com.baekyangdan.scheduler.repository.user.UserRepository;
|
import com.baekyangdan.scheduler.repository.user.UserRepository;
|
||||||
import com.baekyangdan.scheduler.request.user.UserRequest;
|
import com.baekyangdan.scheduler.request.user.UserRequest;
|
||||||
@@ -32,14 +33,13 @@ public class UserService {
|
|||||||
// 3. data 를 UserEntity 형식으로 build
|
// 3. data 를 UserEntity 형식으로 build
|
||||||
UserEntity user = UserEntity
|
UserEntity user = UserEntity
|
||||||
.builder()
|
.builder()
|
||||||
.id(data.getId())
|
.accountId(data.getAccountId())
|
||||||
.email(data.getEmail())
|
.email(data.getEmail())
|
||||||
.name(data.getName())
|
.name(data.getName())
|
||||||
.nickname(data.getNickname())
|
.nickname(data.getNickname())
|
||||||
.password(encodedPassword)
|
.password(encodedPassword)
|
||||||
.createdAt(LocalDateTime.now())
|
.createdAt(LocalDateTime.now())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// 4. build 된 entity를 UserRepository.save 로 DB에 저장
|
// 4. build 된 entity를 UserRepository.save 로 DB에 저장
|
||||||
return userRepository.save(user);
|
return userRepository.save(user);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ public class UserValidation extends BaseValidation {
|
|||||||
|
|
||||||
public static boolean validateSignUpForm(UserRequest.SignUp data) throws Exception {
|
public static boolean validateSignUpForm(UserRequest.SignUp data) throws Exception {
|
||||||
|
|
||||||
if (validateStringEmpty(data.getId())) {
|
if (validateStringEmpty(data.getAccountId())) {
|
||||||
throw new Exception(SignUpValidationCode.ID_EMPTY.getMessage());
|
throw new Exception(SignUpValidationCode.ID_EMPTY.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,4 +3,18 @@ spring.datasource.username=baekyangdan
|
|||||||
spring.datasource.password=qwas745478!
|
spring.datasource.password=qwas745478!
|
||||||
spring.datasource.driver-class-name=org.postgresql.Driver
|
spring.datasource.driver-class-name=org.postgresql.Driver
|
||||||
spring.devtools.restart.enabled=true
|
spring.devtools.restart.enabled=true
|
||||||
spring.devtools.livereload.enabled=true
|
spring.devtools.livereload.enabled=true
|
||||||
|
|
||||||
|
spring.mail.host=smtp.google.com
|
||||||
|
spring.mail.port=587
|
||||||
|
spring.mail.username=bkd.scheduler@gmail.com
|
||||||
|
spring.mail.protocol=smtp
|
||||||
|
|
||||||
|
spring.mail.clientId=688417162908-iqvnj4ceb8t1dkbjr70dtcafo27m8kqe.apps.googleusercontent.com
|
||||||
|
spring.mail.clientSecret=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
|
||||||
|
spring.mail.refreshToken=1//04_pSivNoGpPUCgYIARAAGAQSNwF-L9IrO0Kx6jSzq_eQNjdl65f0O2iqKSNpFeZ3gtIGMhOk0oiZsnKrPfWs8jvuEic1NhUoZ0g
|
||||||
|
|
||||||
|
spring.mail.properties.mail.smtp.auth=true
|
||||||
|
spring.mail.properties.mail.smtp.starttls.enable=true
|
||||||
|
spring.mail.properties.mail.smtp.starttls.required=true
|
||||||
|
spring.mail.properties.mail.smtp.auth.mechanisms=XOAUTH2
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
spring.datasource.url=jdbc:postgresql://bkdhome.p-e.kr:15454/scheduler
|
||||||
|
spring.datasource.username=baekyangdan
|
||||||
|
spring.datasource.password=qwas745478!
|
||||||
|
spring.datasource.driver-class-name=org.postgresql.Driver
|
||||||
|
spring.devtools.restart.enabled=true
|
||||||
|
spring.devtools.livereload.enabled=true
|
||||||
|
|
||||||
|
spring.mail.host=smtp.google.com
|
||||||
|
spring.mail.port=587
|
||||||
|
spring.mail.username=bkd.scheduler@gmail.com
|
||||||
|
spring.mail.protocol=smtp
|
||||||
|
|
||||||
|
spring.mail.clientId=688417162908-iqvnj4ceb8t1dkbjr70dtcafo27m8kqe.apps.googleusercontent.com
|
||||||
|
spring.mail.clientSecret=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
|
||||||
|
spring.mail.refreshToken=1//04_pSivNoGpPUCgYIARAAGAQSNwF-L9IrO0Kx6jSzq_eQNjdl65f0O2iqKSNpFeZ3gtIGMhOk0oiZsnKrPfWs8jvuEic1NhUoZ0g
|
||||||
|
|
||||||
|
spring.mail.properties.mail.smtp.auth=true
|
||||||
|
spring.mail.properties.mail.smtp.starttls.enable=true
|
||||||
|
spring.mail.properties.mail.smtp.starttls.required=true
|
||||||
|
spring.mail.properties.mail.smtp.auth.mechanisms=XOAUTH2
|
||||||
Reference in New Issue
Block a user