From 52b7e3529fb461af98724cde84cf70198e2d603e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=B5=E1=84=8E=E1=85=A1=E1=86=AB=E1=84=8C?= =?UTF-8?q?=E1=85=B5=E1=86=AB?= Date: Wed, 28 Dec 2022 15:13:28 +0900 Subject: [PATCH] =?UTF-8?q?:recycle:=20::=20[option]=20=EC=98=B5=EC=85=98?= =?UTF-8?q?=20=EC=97=94=ED=8B=B0=ED=8B=B0=20noarg=20=EC=83=9D=EC=84=B1?= =?UTF-8?q?=EC=9E=90=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/credential/service/CredentialService.java | 2 ++ .../knockknockbackend/domain/option/domain/Option.java | 9 ++++++++- .../option/domain/repository/OptionRepository.java | 6 +++++- .../domain/option/service/OptionService.java | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/github/depromeet/knockknockbackend/domain/credential/service/CredentialService.java b/src/main/java/io/github/depromeet/knockknockbackend/domain/credential/service/CredentialService.java index 25067688..48696aea 100644 --- a/src/main/java/io/github/depromeet/knockknockbackend/domain/credential/service/CredentialService.java +++ b/src/main/java/io/github/depromeet/knockknockbackend/domain/credential/service/CredentialService.java @@ -64,6 +64,8 @@ public AfterOauthResponse oauthCodeToUser(OauthProvider oauthProvider, String co .email(email) .build(); userRepository.save(newUser); + userOptionService.initializeOption(newUser); + return newUser; }); diff --git a/src/main/java/io/github/depromeet/knockknockbackend/domain/option/domain/Option.java b/src/main/java/io/github/depromeet/knockknockbackend/domain/option/domain/Option.java index 134fa8f7..61cac1a1 100644 --- a/src/main/java/io/github/depromeet/knockknockbackend/domain/option/domain/Option.java +++ b/src/main/java/io/github/depromeet/knockknockbackend/domain/option/domain/Option.java @@ -8,12 +8,14 @@ import javax.persistence.MapsId; import javax.persistence.OneToOne; import javax.persistence.Table; +import lombok.AccessLevel; import lombok.Builder; import lombok.Getter; +import lombok.NoArgsConstructor; @Getter -@Builder @Table(name = "tbl_option") +@NoArgsConstructor(access = AccessLevel.PROTECTED) @Entity public class Option { @@ -30,6 +32,11 @@ public class Option { private boolean nightOption; + @Builder + public Option(User user) { + this.user = user; + } + public void setNewOption(boolean newOption) { this.newOption = newOption; } diff --git a/src/main/java/io/github/depromeet/knockknockbackend/domain/option/domain/repository/OptionRepository.java b/src/main/java/io/github/depromeet/knockknockbackend/domain/option/domain/repository/OptionRepository.java index d818ebb7..5a7a095c 100644 --- a/src/main/java/io/github/depromeet/knockknockbackend/domain/option/domain/repository/OptionRepository.java +++ b/src/main/java/io/github/depromeet/knockknockbackend/domain/option/domain/repository/OptionRepository.java @@ -2,6 +2,10 @@ import io.github.depromeet.knockknockbackend.domain.option.domain.Option; +import java.util.Optional; import org.springframework.data.repository.CrudRepository; -public interface OptionRepository extends CrudRepository {} +public interface OptionRepository extends CrudRepository { + + Optional