From f4dcb146be66e3144733a2e520d4e57d2ac53fdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=95=88=EC=8A=B9=ED=98=84?= Date: Wed, 1 Jan 2025 21:41:58 +0900 Subject: [PATCH 01/23] =?UTF-8?q?user=20entity=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../platform/stayfinder/user/entity/User.java | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/main/java/com/vacation/platform/stayfinder/user/entity/User.java diff --git a/src/main/java/com/vacation/platform/stayfinder/user/entity/User.java b/src/main/java/com/vacation/platform/stayfinder/user/entity/User.java new file mode 100644 index 0000000..09760b5 --- /dev/null +++ b/src/main/java/com/vacation/platform/stayfinder/user/entity/User.java @@ -0,0 +1,45 @@ +package com.vacation.platform.stayfinder.user.entity; + +import jakarta.persistence.*; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.hibernate.annotations.Comment; + +import java.sql.Timestamp; + +@Entity +@Getter +@NoArgsConstructor +@Table(name = "users") +public class User { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Comment("user 시퀀스") + @Column(name = "user_id") + private int userId; + + @Column(name = "email") + private String email; + + @Column(name = "nick_name") + private String nickName; + + @Column(name = "phone_number") + private String phoneNumber; + + @Column(name = "birthday") + private String birthday; + + @Column(name = "gender") + private boolean gender; + + @Column(name = "is_active") + private boolean isActive; + + @Column(name = "create_at") + private Timestamp createAt; + + @Column(name = "modify_at") + private Timestamp modifyAt; +} From e32ce882185f64ba7b29963a70c603f44d36f99f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=95=88=EC=8A=B9=ED=98=84?= Date: Wed, 1 Jan 2025 23:19:35 +0900 Subject: [PATCH 02/23] =?UTF-8?q?=EC=95=BD=EA=B4=80=20entity=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../stayfinder/user/entity/Terms.java | 35 ++++++++++++++++ .../stayfinder/user/entity/TermsSub.java | 42 +++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 src/main/java/com/vacation/platform/stayfinder/user/entity/Terms.java create mode 100644 src/main/java/com/vacation/platform/stayfinder/user/entity/TermsSub.java diff --git a/src/main/java/com/vacation/platform/stayfinder/user/entity/Terms.java b/src/main/java/com/vacation/platform/stayfinder/user/entity/Terms.java new file mode 100644 index 0000000..f0c7e50 --- /dev/null +++ b/src/main/java/com/vacation/platform/stayfinder/user/entity/Terms.java @@ -0,0 +1,35 @@ +package com.vacation.platform.stayfinder.user.entity; + +import jakarta.persistence.*; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.sql.Timestamp; + +@Entity +@NoArgsConstructor +@Getter +@Table(name = "terms") +public class Terms { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "terms_id") + private int termsId; + + @Column(name = "terms_main_title") + private String termsMainTile; + + @Column(name = "is_terms_required") + private String isTermsRequired; + + @Column(name = "is_active") + private boolean isActive; + + @Column(name = "create_at") + private Timestamp createAt; + + @Column(name = "modify_at") + private Timestamp modifyAt; + +} diff --git a/src/main/java/com/vacation/platform/stayfinder/user/entity/TermsSub.java b/src/main/java/com/vacation/platform/stayfinder/user/entity/TermsSub.java new file mode 100644 index 0000000..907cb9e --- /dev/null +++ b/src/main/java/com/vacation/platform/stayfinder/user/entity/TermsSub.java @@ -0,0 +1,42 @@ +package com.vacation.platform.stayfinder.user.entity; + + +import jakarta.persistence.*; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.sql.Timestamp; + +@Entity +@NoArgsConstructor +@Getter +@Table(name = "terms_sub") +public class TermsSub { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "terms_sub_id") + private int termsSubId; + + @Column(name = "terms_main_id") + private int termsMainId; + + @Column(name = "version") + private int version; + + @Column(name = "terms_details_title") + private String termsDetailsTitle; + + @Column(name = "terms_details_content") + private String termsDetailsContent; + + @Column(name = "is_active") + private boolean isActive; + + @Column(name = "create_at") + private Timestamp createAt; + + @Column(name = "modify_at") + private Timestamp modifyAt; + +} From 6842f67f9421c6428fcec62fd9ce6baa2490a1dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=95=88=EC=8A=B9=ED=98=84?= Date: Wed, 1 Jan 2025 23:45:45 +0900 Subject: [PATCH 03/23] =?UTF-8?q?=EC=9D=B8=EC=A6=9D,=20=EC=95=BD=EA=B4=80?= =?UTF-8?q?=20=EC=9D=B4=EB=A0=A5=20=ED=85=8C=EC=9D=B4=EB=B8=94=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user/entity/PhoneCertifyReq.java | 43 +++++++++++++++++++ .../user/entity/TermsUserAgreement.java | 32 ++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 src/main/java/com/vacation/platform/stayfinder/user/entity/PhoneCertifyReq.java create mode 100644 src/main/java/com/vacation/platform/stayfinder/user/entity/TermsUserAgreement.java diff --git a/src/main/java/com/vacation/platform/stayfinder/user/entity/PhoneCertifyReq.java b/src/main/java/com/vacation/platform/stayfinder/user/entity/PhoneCertifyReq.java new file mode 100644 index 0000000..5e86375 --- /dev/null +++ b/src/main/java/com/vacation/platform/stayfinder/user/entity/PhoneCertifyReq.java @@ -0,0 +1,43 @@ +package com.vacation.platform.stayfinder.user.entity; + +import jakarta.persistence.*; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.sql.Timestamp; + +@Entity +@NoArgsConstructor +@Getter +@Table(name = "phone_certify_req") +public class PhoneCertifyReq { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private int id; + + @Column(name = "phone_number") + private String phoneNumber; + + @Column(name = "req_time") + private Timestamp reqTime; + + @Column(name = "res_time") + private Timestamp resTime; + + @Column(name = "req_certify_number") + private String reqCertifyNumber; + + @Column(name = "try_number") + private int tryNumber; + + @Column(name = "certify_phone_number") + private String certifyPhoneNumber; + + @Column(name = "create_at") + private Timestamp createAt; + + @Column(name = "modify_at") + private Timestamp modifyAt; +} diff --git a/src/main/java/com/vacation/platform/stayfinder/user/entity/TermsUserAgreement.java b/src/main/java/com/vacation/platform/stayfinder/user/entity/TermsUserAgreement.java new file mode 100644 index 0000000..ada4499 --- /dev/null +++ b/src/main/java/com/vacation/platform/stayfinder/user/entity/TermsUserAgreement.java @@ -0,0 +1,32 @@ +package com.vacation.platform.stayfinder.user.entity; + +import jakarta.persistence.*; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.sql.Timestamp; + +@Entity +@NoArgsConstructor +@Getter +@Table(name = "terms_user_agreement") +public class TermsUserAgreement { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private int id; + + @Column(name = "phone_number") + private String phoneNumber; + + @Column(name = "terms_id") + private int termsId; + + @Column(name = "created_at") + private Timestamp createdAt; + + @Column(name = "modify_at") + private Timestamp modifyAt; + +} From 77ed595fbad3bbba7293baf9d11a91544bdbdf24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=95=88=EC=8A=B9=ED=98=84?= Date: Thu, 2 Jan 2025 22:50:33 +0900 Subject: [PATCH 04/23] =?UTF-8?q?entity=20=EC=83=9D=EC=84=B1=20=EC=99=84?= =?UTF-8?q?=EB=A3=8C.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/PhoneCertifyReq.java | 6 +++++- .../entity/TermsUserAgreement.java | 6 +++++- .../{user => terms}/entity/Terms.java | 6 +++++- .../{user => terms}/entity/TermsSub.java | 6 +++++- .../platform/stayfinder/user/entity/User.java | 18 ++++++++++++++++-- 5 files changed, 36 insertions(+), 6 deletions(-) rename src/main/java/com/vacation/platform/stayfinder/{user => certify}/entity/PhoneCertifyReq.java (87%) rename src/main/java/com/vacation/platform/stayfinder/{user => certify}/entity/TermsUserAgreement.java (83%) rename src/main/java/com/vacation/platform/stayfinder/{user => terms}/entity/Terms.java (84%) rename src/main/java/com/vacation/platform/stayfinder/{user => terms}/entity/TermsSub.java (87%) diff --git a/src/main/java/com/vacation/platform/stayfinder/user/entity/PhoneCertifyReq.java b/src/main/java/com/vacation/platform/stayfinder/certify/entity/PhoneCertifyReq.java similarity index 87% rename from src/main/java/com/vacation/platform/stayfinder/user/entity/PhoneCertifyReq.java rename to src/main/java/com/vacation/platform/stayfinder/certify/entity/PhoneCertifyReq.java index 5e86375..5b471c3 100644 --- a/src/main/java/com/vacation/platform/stayfinder/user/entity/PhoneCertifyReq.java +++ b/src/main/java/com/vacation/platform/stayfinder/certify/entity/PhoneCertifyReq.java @@ -1,14 +1,18 @@ -package com.vacation.platform.stayfinder.user.entity; +package com.vacation.platform.stayfinder.certify.entity; import jakarta.persistence.*; import lombok.Getter; import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; import java.sql.Timestamp; +@ToString @Entity @NoArgsConstructor @Getter +@Setter @Table(name = "phone_certify_req") public class PhoneCertifyReq { diff --git a/src/main/java/com/vacation/platform/stayfinder/user/entity/TermsUserAgreement.java b/src/main/java/com/vacation/platform/stayfinder/certify/entity/TermsUserAgreement.java similarity index 83% rename from src/main/java/com/vacation/platform/stayfinder/user/entity/TermsUserAgreement.java rename to src/main/java/com/vacation/platform/stayfinder/certify/entity/TermsUserAgreement.java index ada4499..0590ba1 100644 --- a/src/main/java/com/vacation/platform/stayfinder/user/entity/TermsUserAgreement.java +++ b/src/main/java/com/vacation/platform/stayfinder/certify/entity/TermsUserAgreement.java @@ -1,14 +1,18 @@ -package com.vacation.platform.stayfinder.user.entity; +package com.vacation.platform.stayfinder.certify.entity; import jakarta.persistence.*; import lombok.Getter; import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; import java.sql.Timestamp; +@ToString @Entity @NoArgsConstructor @Getter +@Setter @Table(name = "terms_user_agreement") public class TermsUserAgreement { diff --git a/src/main/java/com/vacation/platform/stayfinder/user/entity/Terms.java b/src/main/java/com/vacation/platform/stayfinder/terms/entity/Terms.java similarity index 84% rename from src/main/java/com/vacation/platform/stayfinder/user/entity/Terms.java rename to src/main/java/com/vacation/platform/stayfinder/terms/entity/Terms.java index f0c7e50..4e5ee4e 100644 --- a/src/main/java/com/vacation/platform/stayfinder/user/entity/Terms.java +++ b/src/main/java/com/vacation/platform/stayfinder/terms/entity/Terms.java @@ -1,14 +1,18 @@ -package com.vacation.platform.stayfinder.user.entity; +package com.vacation.platform.stayfinder.terms.entity; import jakarta.persistence.*; import lombok.Getter; import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; import java.sql.Timestamp; +@ToString @Entity @NoArgsConstructor @Getter +@Setter @Table(name = "terms") public class Terms { diff --git a/src/main/java/com/vacation/platform/stayfinder/user/entity/TermsSub.java b/src/main/java/com/vacation/platform/stayfinder/terms/entity/TermsSub.java similarity index 87% rename from src/main/java/com/vacation/platform/stayfinder/user/entity/TermsSub.java rename to src/main/java/com/vacation/platform/stayfinder/terms/entity/TermsSub.java index 907cb9e..85343d0 100644 --- a/src/main/java/com/vacation/platform/stayfinder/user/entity/TermsSub.java +++ b/src/main/java/com/vacation/platform/stayfinder/terms/entity/TermsSub.java @@ -1,15 +1,19 @@ -package com.vacation.platform.stayfinder.user.entity; +package com.vacation.platform.stayfinder.terms.entity; import jakarta.persistence.*; import lombok.Getter; import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; import java.sql.Timestamp; +@ToString @Entity @NoArgsConstructor @Getter +@Setter @Table(name = "terms_sub") public class TermsSub { diff --git a/src/main/java/com/vacation/platform/stayfinder/user/entity/User.java b/src/main/java/com/vacation/platform/stayfinder/user/entity/User.java index 09760b5..a62b1fb 100644 --- a/src/main/java/com/vacation/platform/stayfinder/user/entity/User.java +++ b/src/main/java/com/vacation/platform/stayfinder/user/entity/User.java @@ -1,14 +1,15 @@ package com.vacation.platform.stayfinder.user.entity; import jakarta.persistence.*; -import lombok.Getter; -import lombok.NoArgsConstructor; +import lombok.*; import org.hibernate.annotations.Comment; import java.sql.Timestamp; +@ToString @Entity @Getter +@Setter @NoArgsConstructor @Table(name = "users") public class User { @@ -22,6 +23,9 @@ public class User { @Column(name = "email") private String email; + @Column(name = "password") + private String password; + @Column(name = "nick_name") private String nickName; @@ -42,4 +46,14 @@ public class User { @Column(name = "modify_at") private Timestamp modifyAt; + + @Builder + public User(String email, String password, String nickName, String phoneNumber, String birthday, boolean gender) { + this.email = email; + this.password = password; + this.nickName = nickName; + this.phoneNumber = phoneNumber; + this.birthday = birthday; + this.gender = gender; + } } From 28d7fc2d26d4bc51b2f50e5a396e2377d1329aa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=95=88=EC=8A=B9=ED=98=84?= Date: Thu, 2 Jan 2025 22:51:46 +0900 Subject: [PATCH 05/23] =?UTF-8?q?user=20controller,=20service,=20repositor?= =?UTF-8?q?y=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../stayfinder/user/controller/UserController.java | 12 ++++++++++++ .../stayfinder/user/repository/UserRepository.java | 11 +++++++++++ .../stayfinder/user/service/UserService.java | 11 +++++++++++ .../user/service/serviceImpl/UserServiceImpl.java | 4 ++++ 4 files changed, 38 insertions(+) create mode 100644 src/main/java/com/vacation/platform/stayfinder/user/controller/UserController.java create mode 100644 src/main/java/com/vacation/platform/stayfinder/user/repository/UserRepository.java create mode 100644 src/main/java/com/vacation/platform/stayfinder/user/service/UserService.java create mode 100644 src/main/java/com/vacation/platform/stayfinder/user/service/serviceImpl/UserServiceImpl.java diff --git a/src/main/java/com/vacation/platform/stayfinder/user/controller/UserController.java b/src/main/java/com/vacation/platform/stayfinder/user/controller/UserController.java new file mode 100644 index 0000000..d7dc208 --- /dev/null +++ b/src/main/java/com/vacation/platform/stayfinder/user/controller/UserController.java @@ -0,0 +1,12 @@ +package com.vacation.platform.stayfinder.user.controller; + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RequestMapping("/api/v1/user") +@RestController +public class UserController { + + + +} diff --git a/src/main/java/com/vacation/platform/stayfinder/user/repository/UserRepository.java b/src/main/java/com/vacation/platform/stayfinder/user/repository/UserRepository.java new file mode 100644 index 0000000..791bb3b --- /dev/null +++ b/src/main/java/com/vacation/platform/stayfinder/user/repository/UserRepository.java @@ -0,0 +1,11 @@ +package com.vacation.platform.stayfinder.user.repository; + +import com.vacation.platform.stayfinder.user.entity.User; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface UserRepository extends JpaRepository { + + +} diff --git a/src/main/java/com/vacation/platform/stayfinder/user/service/UserService.java b/src/main/java/com/vacation/platform/stayfinder/user/service/UserService.java new file mode 100644 index 0000000..f620c16 --- /dev/null +++ b/src/main/java/com/vacation/platform/stayfinder/user/service/UserService.java @@ -0,0 +1,11 @@ +package com.vacation.platform.stayfinder.user.service; + + +import org.springframework.stereotype.Service; + +@Service +public class UserService { + + + +} diff --git a/src/main/java/com/vacation/platform/stayfinder/user/service/serviceImpl/UserServiceImpl.java b/src/main/java/com/vacation/platform/stayfinder/user/service/serviceImpl/UserServiceImpl.java new file mode 100644 index 0000000..5f59e4c --- /dev/null +++ b/src/main/java/com/vacation/platform/stayfinder/user/service/serviceImpl/UserServiceImpl.java @@ -0,0 +1,4 @@ +package com.vacation.platform.stayfinder.user.service.serviceImpl; + +public class UserServiceImpl { +} From 52c51e55afa70b825602a0dec79e3b864d1b956c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=95=88=EC=8A=B9=ED=98=84?= Date: Thu, 2 Jan 2025 22:52:14 +0900 Subject: [PATCH 06/23] =?UTF-8?q?sha256=20util=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/vacation/platform/stayfinder/util/SHA256Util.java | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 src/main/java/com/vacation/platform/stayfinder/util/SHA256Util.java diff --git a/src/main/java/com/vacation/platform/stayfinder/util/SHA256Util.java b/src/main/java/com/vacation/platform/stayfinder/util/SHA256Util.java new file mode 100644 index 0000000..450277c --- /dev/null +++ b/src/main/java/com/vacation/platform/stayfinder/util/SHA256Util.java @@ -0,0 +1,4 @@ +package com.vacation.platform.stayfinder.util; + +public class SHA256Util { +} From 5ea9d08b2785297275c0e8688f24f8e78de1c7f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=95=88=EC=8A=B9=ED=98=84?= Date: Thu, 2 Jan 2025 23:07:36 +0900 Subject: [PATCH 07/23] =?UTF-8?q?gitignore=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 0e0fa44..537b8df 100644 --- a/.gitignore +++ b/.gitignore @@ -17,7 +17,7 @@ bin/ !**/src/main/**/bin/ !**/src/test/**/bin/ -applicaion.properties +db-config.properties ### IntelliJ IDEA ### .idea From cb9561f4fc9bed7c5da225f02294f5a678db6e1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=95=88=EC=8A=B9=ED=98=84?= Date: Thu, 2 Jan 2025 23:08:23 +0900 Subject: [PATCH 08/23] =?UTF-8?q?properties=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EC=97=85=EB=A1=9C=EB=93=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application.properties | 8 +------- src/main/resources/db-config.properties | 6 ++++++ 2 files changed, 7 insertions(+), 7 deletions(-) create mode 100644 src/main/resources/db-config.properties diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 27be42f..76194f3 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,9 +1,3 @@ spring.application.name=stayfinder - -spring.h2.console.path=/h2-console -spring.datasource.url=jdbc:h2:mem:testdb -spring.datasource.driver-class-name=org.h2.Driver -spring.datasource.username=sa -spring.datasource.password=123 -spring.h2.console.enabled=true \ No newline at end of file +spring.config.import=C:\\stayfinder\\src\\main\\resources\\db-config.properties \ No newline at end of file diff --git a/src/main/resources/db-config.properties b/src/main/resources/db-config.properties new file mode 100644 index 0000000..8778d48 --- /dev/null +++ b/src/main/resources/db-config.properties @@ -0,0 +1,6 @@ +spring.h2.console.path=/h2-console +spring.datasource.url=jdbc:h2:mem:testdb +spring.datasource.driver-class-name=org.h2.Driver +spring.datasource.username=sa +spring.datasource.password=123 +spring.h2.console.enabled=true \ No newline at end of file From 2d8f68bc0fcf56fc01150d1b229dc6f262fe8156 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=95=88=EC=8A=B9=ED=98=84?= Date: Fri, 3 Jan 2025 17:01:32 +0900 Subject: [PATCH 09/23] =?UTF-8?q?gitignore=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 537b8df..4a9b8c9 100644 --- a/.gitignore +++ b/.gitignore @@ -17,7 +17,7 @@ bin/ !**/src/main/**/bin/ !**/src/test/**/bin/ -db-config.properties +!**/src/main/resources/db-config.properties ### IntelliJ IDEA ### .idea From 2e8f3df1edd781fbd19b6f8abbadfa7acba4d382 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=95=88=EC=8A=B9=ED=98=84?= Date: Fri, 3 Jan 2025 17:07:09 +0900 Subject: [PATCH 10/23] =?UTF-8?q?gitignore=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 4a9b8c9..7a5b800 100644 --- a/.gitignore +++ b/.gitignore @@ -17,7 +17,7 @@ bin/ !**/src/main/**/bin/ !**/src/test/**/bin/ -!**/src/main/resources/db-config.properties +*.properties ### IntelliJ IDEA ### .idea From dd3a6f0e868b57686ec4ddde5e0f09d157ae547b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=95=88=EC=8A=B9=ED=98=84?= Date: Sun, 5 Jan 2025 21:46:07 +0900 Subject: [PATCH 11/23] =?UTF-8?q?entity=20=ED=81=B4=EB=9E=98=EC=8A=A4=20?= =?UTF-8?q?=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../stayfinder/common/BaseEntity.java | 37 +++++++++++++++++++ .../stayfinder/terms/entity/Terms.java | 17 +++++---- .../stayfinder/terms/entity/TermsSub.java | 33 +++++------------ .../stayfinder/user/entity/Gender.java | 17 +++++++++ .../platform/stayfinder/user/entity/User.java | 36 +++++++----------- 5 files changed, 85 insertions(+), 55 deletions(-) create mode 100644 src/main/java/com/vacation/platform/stayfinder/common/BaseEntity.java create mode 100644 src/main/java/com/vacation/platform/stayfinder/user/entity/Gender.java diff --git a/src/main/java/com/vacation/platform/stayfinder/common/BaseEntity.java b/src/main/java/com/vacation/platform/stayfinder/common/BaseEntity.java new file mode 100644 index 0000000..40ed887 --- /dev/null +++ b/src/main/java/com/vacation/platform/stayfinder/common/BaseEntity.java @@ -0,0 +1,37 @@ +package com.vacation.platform.stayfinder.common; + +import jakarta.persistence.EntityListeners; +import jakarta.persistence.MappedSuperclass; +import jakarta.persistence.PrePersist; +import jakarta.persistence.PreUpdate; +import lombok.Getter; +import org.springframework.data.annotation.CreatedDate; +import org.springframework.data.annotation.LastModifiedDate; +import org.springframework.data.jpa.domain.support.AuditingEntityListener; + +import java.time.LocalDateTime; + +@MappedSuperclass +@EntityListeners(AuditingEntityListener.class) +@Getter +public class BaseEntity { + + @CreatedDate + private Long createAt; + + @LastModifiedDate + private Long modifyAt; + + @PrePersist + public void prePersist() { + long currentTimeMillis = System.currentTimeMillis(); + this.createAt = currentTimeMillis; + this.modifyAt = currentTimeMillis; + } + + @PreUpdate + public void preUpdate() { + this.modifyAt = System.currentTimeMillis(); + } + +} diff --git a/src/main/java/com/vacation/platform/stayfinder/terms/entity/Terms.java b/src/main/java/com/vacation/platform/stayfinder/terms/entity/Terms.java index 4e5ee4e..64ffaf0 100644 --- a/src/main/java/com/vacation/platform/stayfinder/terms/entity/Terms.java +++ b/src/main/java/com/vacation/platform/stayfinder/terms/entity/Terms.java @@ -1,26 +1,26 @@ package com.vacation.platform.stayfinder.terms.entity; +import com.vacation.platform.stayfinder.common.BaseEntity; import jakarta.persistence.*; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; +import lombok.*; import java.sql.Timestamp; @ToString @Entity @NoArgsConstructor -@Getter -@Setter -@Table(name = "terms") -public class Terms { +@Data +@Table +@EqualsAndHashCode(callSuper = true) +public class Terms extends BaseEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "terms_id") +// @OneToMany private int termsId; + // 유니크 해야됨. @Column(name = "terms_main_title") private String termsMainTile; @@ -30,6 +30,7 @@ public class Terms { @Column(name = "is_active") private boolean isActive; + //부모로 뺴줘야한다. @Column(name = "create_at") private Timestamp createAt; diff --git a/src/main/java/com/vacation/platform/stayfinder/terms/entity/TermsSub.java b/src/main/java/com/vacation/platform/stayfinder/terms/entity/TermsSub.java index 85343d0..2bebbb5 100644 --- a/src/main/java/com/vacation/platform/stayfinder/terms/entity/TermsSub.java +++ b/src/main/java/com/vacation/platform/stayfinder/terms/entity/TermsSub.java @@ -1,46 +1,31 @@ package com.vacation.platform.stayfinder.terms.entity; +import com.vacation.platform.stayfinder.common.BaseEntity; import jakarta.persistence.*; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; +import lombok.*; +import org.springframework.data.annotation.CreatedDate; import java.sql.Timestamp; +import java.time.LocalDateTime; @ToString @Entity @NoArgsConstructor -@Getter -@Setter -@Table(name = "terms_sub") -public class TermsSub { +@Data +@Table +@EqualsAndHashCode(callSuper = true) +public class TermsSub extends BaseEntity { @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "terms_sub_id") - private int termsSubId; - - @Column(name = "terms_main_id") private int termsMainId; - @Column(name = "version") + @Id private int version; - @Column(name = "terms_details_title") private String termsDetailsTitle; - @Column(name = "terms_details_content") private String termsDetailsContent; - @Column(name = "is_active") private boolean isActive; - - @Column(name = "create_at") - private Timestamp createAt; - - @Column(name = "modify_at") - private Timestamp modifyAt; - } diff --git a/src/main/java/com/vacation/platform/stayfinder/user/entity/Gender.java b/src/main/java/com/vacation/platform/stayfinder/user/entity/Gender.java new file mode 100644 index 0000000..55a8844 --- /dev/null +++ b/src/main/java/com/vacation/platform/stayfinder/user/entity/Gender.java @@ -0,0 +1,17 @@ +package com.vacation.platform.stayfinder.user.entity; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum Gender { + NONE(0, "NONE", "미선택"), + MALE(1, "MALE", "남자"), + FEMALE(2, "FEMALE", "여자"); + + private final int code; + private final String name; + private final String desc; + +} \ No newline at end of file diff --git a/src/main/java/com/vacation/platform/stayfinder/user/entity/User.java b/src/main/java/com/vacation/platform/stayfinder/user/entity/User.java index a62b1fb..1d83b58 100644 --- a/src/main/java/com/vacation/platform/stayfinder/user/entity/User.java +++ b/src/main/java/com/vacation/platform/stayfinder/user/entity/User.java @@ -1,5 +1,6 @@ package com.vacation.platform.stayfinder.user.entity; +import com.vacation.platform.stayfinder.common.BaseEntity; import jakarta.persistence.*; import lombok.*; import org.hibernate.annotations.Comment; @@ -8,47 +9,36 @@ @ToString @Entity -@Getter -@Setter +@Data @NoArgsConstructor -@Table(name = "users") -public class User { +@Table +@EqualsAndHashCode(callSuper = true) +public class User extends BaseEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - @Comment("user 시퀀스") - @Column(name = "user_id") private int userId; - @Column(name = "email") + // 유니크 private String email; - @Column(name = "password") private String password; - @Column(name = "nick_name") + //유니크 private String nickName; - - @Column(name = "phone_number") + + //유니크 private String phoneNumber; - @Column(name = "birthday") private String birthday; + + private Gender gender; - @Column(name = "gender") - private boolean gender; - - @Column(name = "is_active") + // enum으로 처리 private boolean isActive; - @Column(name = "create_at") - private Timestamp createAt; - - @Column(name = "modify_at") - private Timestamp modifyAt; - @Builder - public User(String email, String password, String nickName, String phoneNumber, String birthday, boolean gender) { + public User(String email, String password, String nickName, String phoneNumber, String birthday, Gender gender) { this.email = email; this.password = password; this.nickName = nickName; From a5325284d9a65a3c8848e078bc4487b2c46c4c31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=95=88=EC=8A=B9=ED=98=84?= Date: Sun, 5 Jan 2025 21:47:02 +0900 Subject: [PATCH 12/23] =?UTF-8?q?user=20=EB=B9=84=EC=A6=88=EB=8B=88?= =?UTF-8?q?=EC=8A=A4=20=ED=81=B4=EB=9E=98=EC=8A=A4=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user/controller/UserController.java | 25 ++++++++++- .../platform/stayfinder/user/dto/UserDTO.java | 20 +++++++++ .../stayfinder/user/entity/UserStatus.java | 15 +++++++ .../user/repository/UserRepository.java | 5 ++- .../stayfinder/user/service/UserService.java | 8 +++- .../service/serviceImpl/UserServiceImpl.java | 45 ++++++++++++++++++- 6 files changed, 112 insertions(+), 6 deletions(-) create mode 100644 src/main/java/com/vacation/platform/stayfinder/user/dto/UserDTO.java create mode 100644 src/main/java/com/vacation/platform/stayfinder/user/entity/UserStatus.java diff --git a/src/main/java/com/vacation/platform/stayfinder/user/controller/UserController.java b/src/main/java/com/vacation/platform/stayfinder/user/controller/UserController.java index d7dc208..9e61755 100644 --- a/src/main/java/com/vacation/platform/stayfinder/user/controller/UserController.java +++ b/src/main/java/com/vacation/platform/stayfinder/user/controller/UserController.java @@ -1,12 +1,35 @@ package com.vacation.platform.stayfinder.user.controller; +import com.vacation.platform.stayfinder.user.dto.UserDTO; +import com.vacation.platform.stayfinder.user.entity.User; +import com.vacation.platform.stayfinder.user.service.UserService; +import com.vacation.platform.stayfinder.util.Result; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -@RequestMapping("/api/v1/user") +import java.util.Map; + + @RestController +@RequestMapping("/api/v1/users") public class UserController { + private final UserService userService; + + public UserController(UserService userService) { + this.userService = userService; + } + + //user 생성 + @PostMapping("/create") + public Result createUser(@RequestBody User users) { + return userService.saveUser(users); + } + //user 수정 } diff --git a/src/main/java/com/vacation/platform/stayfinder/user/dto/UserDTO.java b/src/main/java/com/vacation/platform/stayfinder/user/dto/UserDTO.java new file mode 100644 index 0000000..9f6618a --- /dev/null +++ b/src/main/java/com/vacation/platform/stayfinder/user/dto/UserDTO.java @@ -0,0 +1,20 @@ +package com.vacation.platform.stayfinder.user.dto; + +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +public class UserDTO { + + @Data + @NoArgsConstructor + public static class saveDTO { + private String email; + private String password; + private String nickName; + private String phoneNumber; + private String birthday; + private String gender; + } + +} diff --git a/src/main/java/com/vacation/platform/stayfinder/user/entity/UserStatus.java b/src/main/java/com/vacation/platform/stayfinder/user/entity/UserStatus.java new file mode 100644 index 0000000..51dd463 --- /dev/null +++ b/src/main/java/com/vacation/platform/stayfinder/user/entity/UserStatus.java @@ -0,0 +1,15 @@ +package com.vacation.platform.stayfinder.user.entity; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum UserStatus { + UNREGISTERED(0, "UNREGISTERED", "회원 탈퇴"), + REGISTERED(1, "REGISTERED", "회원 활성화"); + + private final int code; + private final String name; + private final String desc; +} diff --git a/src/main/java/com/vacation/platform/stayfinder/user/repository/UserRepository.java b/src/main/java/com/vacation/platform/stayfinder/user/repository/UserRepository.java index 791bb3b..8c015bf 100644 --- a/src/main/java/com/vacation/platform/stayfinder/user/repository/UserRepository.java +++ b/src/main/java/com/vacation/platform/stayfinder/user/repository/UserRepository.java @@ -4,8 +4,9 @@ import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; +import java.util.List; + @Repository public interface UserRepository extends JpaRepository { - - + List findByNickName(String nickName); } diff --git a/src/main/java/com/vacation/platform/stayfinder/user/service/UserService.java b/src/main/java/com/vacation/platform/stayfinder/user/service/UserService.java index f620c16..840a271 100644 --- a/src/main/java/com/vacation/platform/stayfinder/user/service/UserService.java +++ b/src/main/java/com/vacation/platform/stayfinder/user/service/UserService.java @@ -1,11 +1,15 @@ package com.vacation.platform.stayfinder.user.service; +import com.vacation.platform.stayfinder.user.dto.UserDTO; +import com.vacation.platform.stayfinder.user.entity.User; +import com.vacation.platform.stayfinder.util.Result; import org.springframework.stereotype.Service; @Service -public class UserService { - +public interface UserService { + public Result saveUser(User user); + public Result modifyUser(UserDTO.saveDTO modifyDTO); } diff --git a/src/main/java/com/vacation/platform/stayfinder/user/service/serviceImpl/UserServiceImpl.java b/src/main/java/com/vacation/platform/stayfinder/user/service/serviceImpl/UserServiceImpl.java index 5f59e4c..ae68683 100644 --- a/src/main/java/com/vacation/platform/stayfinder/user/service/serviceImpl/UserServiceImpl.java +++ b/src/main/java/com/vacation/platform/stayfinder/user/service/serviceImpl/UserServiceImpl.java @@ -1,4 +1,47 @@ package com.vacation.platform.stayfinder.user.service.serviceImpl; -public class UserServiceImpl { +import com.vacation.platform.stayfinder.user.dto.UserDTO; +import com.vacation.platform.stayfinder.user.entity.User; +import com.vacation.platform.stayfinder.user.repository.UserRepository; +import com.vacation.platform.stayfinder.user.service.UserService; +import com.vacation.platform.stayfinder.util.ResponseCode; +import com.vacation.platform.stayfinder.util.Result; +import jakarta.transaction.Transactional; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class UserServiceImpl implements UserService { + + private final UserRepository userRepository; + + + public UserServiceImpl(UserRepository userRepository) { + this.userRepository = userRepository; + } + + @Override + @Transactional + public Result saveUser(User user) { + + List nickNameList = userRepository.findByNickName(user.getNickName()); + + if(!nickNameList.isEmpty()) { + return Result.fail(ResponseCode.SUCCESS, "요청하신 닉네임은 사용중입니다.", user.getNickName()); + } + + + + + return null; + } + + @Override + public Result modifyUser(UserDTO.saveDTO modifyDTO) { + return null; + } + + } From 546fd9deed69c5b871108a0dc96165b79fb65541 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=95=88=EC=8A=B9=ED=98=84?= Date: Sun, 5 Jan 2025 21:47:56 +0900 Subject: [PATCH 13/23] =?UTF-8?q?=EC=95=BD=EA=B4=80=20=ED=81=B4=EB=9E=98?= =?UTF-8?q?=EC=8A=A4=20=EB=B9=84=EC=A6=88=EB=8B=88=EC=8A=A4=20=EC=9E=91?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TermsUserAgreementController.java | 12 ++++++ .../certify/entity/TermsUserAgreement.java | 21 +++++++---- .../TermsUserAgreementRepository.java | 8 ++++ .../service/TermsUserAgreementService.java | 7 ++++ .../TermsUserAgreementServiceImpl.java | 11 ++++++ .../terms/controller/TermsController.java | 37 +++++++++++++++++++ .../terms/repository/TermsRepository.java | 9 +++++ .../terms/repository/TermsSubRepository.java | 9 +++++ .../terms/service/TermsService.java | 13 +++++++ .../service/serviceImpl/TermsServiceImpl.java | 30 +++++++++++++++ 10 files changed, 149 insertions(+), 8 deletions(-) create mode 100644 src/main/java/com/vacation/platform/stayfinder/certify/controller/TermsUserAgreementController.java create mode 100644 src/main/java/com/vacation/platform/stayfinder/certify/repository/TermsUserAgreementRepository.java create mode 100644 src/main/java/com/vacation/platform/stayfinder/certify/service/TermsUserAgreementService.java create mode 100644 src/main/java/com/vacation/platform/stayfinder/certify/service/serviceImpl/TermsUserAgreementServiceImpl.java create mode 100644 src/main/java/com/vacation/platform/stayfinder/terms/controller/TermsController.java create mode 100644 src/main/java/com/vacation/platform/stayfinder/terms/repository/TermsRepository.java create mode 100644 src/main/java/com/vacation/platform/stayfinder/terms/repository/TermsSubRepository.java create mode 100644 src/main/java/com/vacation/platform/stayfinder/terms/service/TermsService.java create mode 100644 src/main/java/com/vacation/platform/stayfinder/terms/service/serviceImpl/TermsServiceImpl.java diff --git a/src/main/java/com/vacation/platform/stayfinder/certify/controller/TermsUserAgreementController.java b/src/main/java/com/vacation/platform/stayfinder/certify/controller/TermsUserAgreementController.java new file mode 100644 index 0000000..81696a1 --- /dev/null +++ b/src/main/java/com/vacation/platform/stayfinder/certify/controller/TermsUserAgreementController.java @@ -0,0 +1,12 @@ +package com.vacation.platform.stayfinder.certify.controller; + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/api/v1/terms_user") +public class TermsUserAgreementController { + + + +} diff --git a/src/main/java/com/vacation/platform/stayfinder/certify/entity/TermsUserAgreement.java b/src/main/java/com/vacation/platform/stayfinder/certify/entity/TermsUserAgreement.java index 0590ba1..8378fdd 100644 --- a/src/main/java/com/vacation/platform/stayfinder/certify/entity/TermsUserAgreement.java +++ b/src/main/java/com/vacation/platform/stayfinder/certify/entity/TermsUserAgreement.java @@ -1,32 +1,37 @@ package com.vacation.platform.stayfinder.certify.entity; +import com.vacation.platform.stayfinder.common.BaseEntity; import jakarta.persistence.*; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; +import lombok.*; import java.sql.Timestamp; @ToString @Entity @NoArgsConstructor -@Getter -@Setter -@Table(name = "terms_user_agreement") -public class TermsUserAgreement { +@Data +@Table +@EqualsAndHashCode(callSuper = true) +public class TermsUserAgreement extends BaseEntity { + // 필요 없음 @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") private int id; + // 아래 3개로 복합키 + + // 유저 id로 걸어야함 @Column(name = "phone_number") private String phoneNumber; + // termsSub의 mainId @Column(name = "terms_id") private int termsId; + // version도 들어와야됨. + @Column(name = "created_at") private Timestamp createdAt; diff --git a/src/main/java/com/vacation/platform/stayfinder/certify/repository/TermsUserAgreementRepository.java b/src/main/java/com/vacation/platform/stayfinder/certify/repository/TermsUserAgreementRepository.java new file mode 100644 index 0000000..b9d8332 --- /dev/null +++ b/src/main/java/com/vacation/platform/stayfinder/certify/repository/TermsUserAgreementRepository.java @@ -0,0 +1,8 @@ +package com.vacation.platform.stayfinder.certify.repository; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface TermsUserAgreementRepository extends JpaRepository { +} diff --git a/src/main/java/com/vacation/platform/stayfinder/certify/service/TermsUserAgreementService.java b/src/main/java/com/vacation/platform/stayfinder/certify/service/TermsUserAgreementService.java new file mode 100644 index 0000000..32499d7 --- /dev/null +++ b/src/main/java/com/vacation/platform/stayfinder/certify/service/TermsUserAgreementService.java @@ -0,0 +1,7 @@ +package com.vacation.platform.stayfinder.certify.service; + +import org.springframework.stereotype.Service; + +@Service +public interface TermsUserAgreementService { +} diff --git a/src/main/java/com/vacation/platform/stayfinder/certify/service/serviceImpl/TermsUserAgreementServiceImpl.java b/src/main/java/com/vacation/platform/stayfinder/certify/service/serviceImpl/TermsUserAgreementServiceImpl.java new file mode 100644 index 0000000..1f0adde --- /dev/null +++ b/src/main/java/com/vacation/platform/stayfinder/certify/service/serviceImpl/TermsUserAgreementServiceImpl.java @@ -0,0 +1,11 @@ +package com.vacation.platform.stayfinder.certify.service.serviceImpl; + +import com.vacation.platform.stayfinder.certify.service.TermsUserAgreementService; +import org.springframework.stereotype.Service; + +@Service +public class TermsUserAgreementServiceImpl implements TermsUserAgreementService { + + + +} diff --git a/src/main/java/com/vacation/platform/stayfinder/terms/controller/TermsController.java b/src/main/java/com/vacation/platform/stayfinder/terms/controller/TermsController.java new file mode 100644 index 0000000..f72f88e --- /dev/null +++ b/src/main/java/com/vacation/platform/stayfinder/terms/controller/TermsController.java @@ -0,0 +1,37 @@ +package com.vacation.platform.stayfinder.terms.controller; + + +import com.vacation.platform.stayfinder.terms.entity.Terms; +import com.vacation.platform.stayfinder.terms.service.TermsService; +import com.vacation.platform.stayfinder.util.Result; +import jakarta.validation.Valid; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/api/v1/terms_main") +public class TermsController { + + private final TermsService termsService; + + public TermsController(TermsService termsService) { + this.termsService = termsService; + } + + //처음에 약관 동의 하는 api 전송 + //특정 고객이 약관 상세 보고 싶다면 해당 약관 sub 전송 + //메인 동의 api 에서 응답으로 필수 동의를 전체 동의 한 경우에 휴대폰 인증으로 넘어감 + @PostMapping("/getMain") + public Result getMain() { + return termsService.getTermsMain(); + } + + @PostMapping("/terms_register") + public Result termsRegistration(@Valid @RequestBody Terms terms) { + return termsService. + } + + +} diff --git a/src/main/java/com/vacation/platform/stayfinder/terms/repository/TermsRepository.java b/src/main/java/com/vacation/platform/stayfinder/terms/repository/TermsRepository.java new file mode 100644 index 0000000..a57dab1 --- /dev/null +++ b/src/main/java/com/vacation/platform/stayfinder/terms/repository/TermsRepository.java @@ -0,0 +1,9 @@ +package com.vacation.platform.stayfinder.terms.repository; + +import com.vacation.platform.stayfinder.terms.entity.Terms; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface TermsRepository extends JpaRepository { +} diff --git a/src/main/java/com/vacation/platform/stayfinder/terms/repository/TermsSubRepository.java b/src/main/java/com/vacation/platform/stayfinder/terms/repository/TermsSubRepository.java new file mode 100644 index 0000000..f6b1c6a --- /dev/null +++ b/src/main/java/com/vacation/platform/stayfinder/terms/repository/TermsSubRepository.java @@ -0,0 +1,9 @@ +package com.vacation.platform.stayfinder.terms.repository; + +import com.vacation.platform.stayfinder.terms.entity.TermsSub; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface TermsSubRepository extends JpaRepository { +} diff --git a/src/main/java/com/vacation/platform/stayfinder/terms/service/TermsService.java b/src/main/java/com/vacation/platform/stayfinder/terms/service/TermsService.java new file mode 100644 index 0000000..fd72b6c --- /dev/null +++ b/src/main/java/com/vacation/platform/stayfinder/terms/service/TermsService.java @@ -0,0 +1,13 @@ +package com.vacation.platform.stayfinder.terms.service; + +import com.vacation.platform.stayfinder.util.Result; +import org.springframework.stereotype.Service; + +@Service +public interface TermsService { + + public Result getTermsMain(); + + public Result registerTerms(); + +} diff --git a/src/main/java/com/vacation/platform/stayfinder/terms/service/serviceImpl/TermsServiceImpl.java b/src/main/java/com/vacation/platform/stayfinder/terms/service/serviceImpl/TermsServiceImpl.java new file mode 100644 index 0000000..7310ba8 --- /dev/null +++ b/src/main/java/com/vacation/platform/stayfinder/terms/service/serviceImpl/TermsServiceImpl.java @@ -0,0 +1,30 @@ +package com.vacation.platform.stayfinder.terms.service.serviceImpl; + +import com.vacation.platform.stayfinder.terms.repository.TermsRepository; +import com.vacation.platform.stayfinder.terms.repository.TermsSubRepository; +import com.vacation.platform.stayfinder.terms.service.TermsService; +import com.vacation.platform.stayfinder.util.Result; +import org.springframework.stereotype.Service; + +@Service +public class TermsServiceImpl implements TermsService { + + private final TermsRepository termsRepository; + + private final TermsSubRepository termsSubRepository; + + public TermsServiceImpl(TermsRepository termsRepository, TermsSubRepository termsSubRepository) { + this.termsRepository = termsRepository; + this.termsSubRepository = termsSubRepository; + } + + @Override + public Result getTermsMain() { + return null; + } + + @Override + public Result registerTerms() { + return null; + } +} From b79614f68a4f78c30bc226f472547bf63675065c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=95=88=EC=8A=B9=ED=98=84?= Date: Sun, 5 Jan 2025 21:48:17 +0900 Subject: [PATCH 14/23] =?UTF-8?q?=EC=95=BD=EA=B4=80=20=ED=81=B4=EB=9E=98?= =?UTF-8?q?=EC=8A=A4=20=EB=B9=84=EC=A6=88=EB=8B=88=EC=8A=A4=20=EC=9E=91?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../platform/stayfinder/terms/controller/TermsController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/vacation/platform/stayfinder/terms/controller/TermsController.java b/src/main/java/com/vacation/platform/stayfinder/terms/controller/TermsController.java index f72f88e..84fa974 100644 --- a/src/main/java/com/vacation/platform/stayfinder/terms/controller/TermsController.java +++ b/src/main/java/com/vacation/platform/stayfinder/terms/controller/TermsController.java @@ -30,7 +30,7 @@ public Result getMain() { @PostMapping("/terms_register") public Result termsRegistration(@Valid @RequestBody Terms terms) { - return termsService. + return termsService.registerTerms(); } From 76e293dfe4fa49c09cf8b37c14bd4cf807ab9298 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=95=88=EC=8A=B9=ED=98=84?= Date: Sun, 5 Jan 2025 21:50:08 +0900 Subject: [PATCH 15/23] =?UTF-8?q?properties=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application.properties | 3 --- src/main/resources/db-config.properties | 6 ------ 2 files changed, 9 deletions(-) delete mode 100644 src/main/resources/application.properties delete mode 100644 src/main/resources/db-config.properties diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties deleted file mode 100644 index 76194f3..0000000 --- a/src/main/resources/application.properties +++ /dev/null @@ -1,3 +0,0 @@ -spring.application.name=stayfinder - -spring.config.import=C:\\stayfinder\\src\\main\\resources\\db-config.properties \ No newline at end of file diff --git a/src/main/resources/db-config.properties b/src/main/resources/db-config.properties deleted file mode 100644 index 8778d48..0000000 --- a/src/main/resources/db-config.properties +++ /dev/null @@ -1,6 +0,0 @@ -spring.h2.console.path=/h2-console -spring.datasource.url=jdbc:h2:mem:testdb -spring.datasource.driver-class-name=org.h2.Driver -spring.datasource.username=sa -spring.datasource.password=123 -spring.h2.console.enabled=true \ No newline at end of file From dd0af129cd681b3212ede680877d8d066718cc9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=95=88=EC=8A=B9=ED=98=84?= Date: Sun, 5 Jan 2025 21:50:37 +0900 Subject: [PATCH 16/23] =?UTF-8?q?gradle=20=ED=99=98=EA=B2=BD=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build.gradle b/build.gradle index 368602f..7093e5a 100644 --- a/build.gradle +++ b/build.gradle @@ -33,6 +33,10 @@ dependencies { testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.security:spring-security-test' testRuntimeOnly 'org.junit.platform:junit-platform-launcher' + runtimeOnly 'com.mysql:mysql-connector-j' + implementation 'org.apache.commons:commons-lang3:3.12.0' + implementation 'io.jsonwebtoken:jjwt:0.9.1' + implementation 'org.springframework.boot:spring-boot-starter-validation:3.4.0' } tasks.named('test') { From d781ccb2998c14453e501e5d497fd5f9887bc55c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=95=88=EC=8A=B9=ED=98=84?= Date: Sun, 5 Jan 2025 21:51:24 +0900 Subject: [PATCH 17/23] =?UTF-8?q?ResponseCode,=20Result=20=EA=B3=B5?= =?UTF-8?q?=ED=86=B5=EC=BD=94=EB=93=9C=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../stayfinder/util/ResponseCode.java | 21 ++++++++++ .../platform/stayfinder/util/Result.java | 38 +++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 src/main/java/com/vacation/platform/stayfinder/util/ResponseCode.java create mode 100644 src/main/java/com/vacation/platform/stayfinder/util/Result.java diff --git a/src/main/java/com/vacation/platform/stayfinder/util/ResponseCode.java b/src/main/java/com/vacation/platform/stayfinder/util/ResponseCode.java new file mode 100644 index 0000000..ddfe2dd --- /dev/null +++ b/src/main/java/com/vacation/platform/stayfinder/util/ResponseCode.java @@ -0,0 +1,21 @@ +package com.vacation.platform.stayfinder.util; + +import lombok.Getter; +import org.springframework.http.HttpStatus; + +@Getter +public enum ResponseCode { + SUCCESS(HttpStatus.OK, "요청 성공"), + BAD_REQUEST(HttpStatus.BAD_REQUEST, "잘못된 요청 입니다."), + UNAUTHORIZED(HttpStatus.UNAUTHORIZED, "권한 없음"), + FORBIDDEN(HttpStatus.FORBIDDEN, "금지된 요청"), + NOT_FOUND(HttpStatus.NOT_FOUND, "리소스를 찾을 수 없음"); + + private final HttpStatus httpStatus; + private final String customMessage; + + ResponseCode(HttpStatus httpStatus, String customMessage) { + this.httpStatus = httpStatus; + this.customMessage = customMessage; + } +} diff --git a/src/main/java/com/vacation/platform/stayfinder/util/Result.java b/src/main/java/com/vacation/platform/stayfinder/util/Result.java new file mode 100644 index 0000000..b0efb43 --- /dev/null +++ b/src/main/java/com/vacation/platform/stayfinder/util/Result.java @@ -0,0 +1,38 @@ +package com.vacation.platform.stayfinder.util; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class Result { + + private ResponseCode code; + private String message; + private T data; + + public Result(ResponseCode code, String message, T data) { + this.code = code; + this.message = message; + this.data = data; + } + + public static Result success(T data) { + return new Result<>(ResponseCode.SUCCESS, ResponseCode.SUCCESS.getCustomMessage(), data); + } + + public static Result success() { + return new Result<>(ResponseCode.SUCCESS, ResponseCode.SUCCESS.getCustomMessage(), null); + } + + public static Result fail(ResponseCode code, String message, T data) { + return new Result<>(code, message, data); + } + + public static Result fail(ResponseCode code, String message) { + return new Result<>(code, message, null); + } + + + +} From 42e33a1d384908fd634aeec17a7bb3f82f4f0c5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=95=88=EC=8A=B9=ED=98=84?= Date: Sun, 5 Jan 2025 21:51:54 +0900 Subject: [PATCH 18/23] =?UTF-8?q?=EC=9D=B8=EC=A6=9D=20=ED=81=B4=EB=9E=98?= =?UTF-8?q?=EC=8A=A4=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/PhoneCertifyController.java | 13 +++++ .../stayfinder/certify/entity/CertifyReq.java | 37 +++++++++++++++ .../certify/entity/PhoneCertifyReq.java | 47 ------------------- .../repository/PhoneCertifyRepository.java | 9 ++++ .../certify/service/PhoneCertifyService.java | 7 +++ .../serviceImpl/PhoneCertifyServiceImpl.java | 11 +++++ 6 files changed, 77 insertions(+), 47 deletions(-) create mode 100644 src/main/java/com/vacation/platform/stayfinder/certify/controller/PhoneCertifyController.java create mode 100644 src/main/java/com/vacation/platform/stayfinder/certify/entity/CertifyReq.java delete mode 100644 src/main/java/com/vacation/platform/stayfinder/certify/entity/PhoneCertifyReq.java create mode 100644 src/main/java/com/vacation/platform/stayfinder/certify/repository/PhoneCertifyRepository.java create mode 100644 src/main/java/com/vacation/platform/stayfinder/certify/service/PhoneCertifyService.java create mode 100644 src/main/java/com/vacation/platform/stayfinder/certify/service/serviceImpl/PhoneCertifyServiceImpl.java diff --git a/src/main/java/com/vacation/platform/stayfinder/certify/controller/PhoneCertifyController.java b/src/main/java/com/vacation/platform/stayfinder/certify/controller/PhoneCertifyController.java new file mode 100644 index 0000000..a1e7290 --- /dev/null +++ b/src/main/java/com/vacation/platform/stayfinder/certify/controller/PhoneCertifyController.java @@ -0,0 +1,13 @@ +package com.vacation.platform.stayfinder.certify.controller; + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/api/v1/phone_certify") +public class PhoneCertifyController { + + // 휴대폰 인증 요청 하고 응답 받으면 + // 유저 회원 컨트롤러로 넘긴다. + +} diff --git a/src/main/java/com/vacation/platform/stayfinder/certify/entity/CertifyReq.java b/src/main/java/com/vacation/platform/stayfinder/certify/entity/CertifyReq.java new file mode 100644 index 0000000..811ab5b --- /dev/null +++ b/src/main/java/com/vacation/platform/stayfinder/certify/entity/CertifyReq.java @@ -0,0 +1,37 @@ +package com.vacation.platform.stayfinder.certify.entity; + +import com.vacation.platform.stayfinder.common.BaseEntity; +import jakarta.persistence.*; +import lombok.*; + +import java.sql.Timestamp; + +@ToString +@Entity +@NoArgsConstructor +@Data +@Table(name = "certify_req") +@EqualsAndHashCode(callSuper = true) +public class CertifyReq extends BaseEntity { + + // 인증 테이블을 공통으로 사용할수 있게 처리 + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private int id; + + private String userId; + + // create_at 을 사용하는게 좋음 + private Timestamp reqTime; + + private Timestamp resTime; + + private String reqCertifyNumber; + + private int tryNumber; + + // 삭제 대상 + // 인증 대상 enum으로 처리 + private String certifyPhoneNumber; + +} diff --git a/src/main/java/com/vacation/platform/stayfinder/certify/entity/PhoneCertifyReq.java b/src/main/java/com/vacation/platform/stayfinder/certify/entity/PhoneCertifyReq.java deleted file mode 100644 index 5b471c3..0000000 --- a/src/main/java/com/vacation/platform/stayfinder/certify/entity/PhoneCertifyReq.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.vacation.platform.stayfinder.certify.entity; - -import jakarta.persistence.*; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -import java.sql.Timestamp; - -@ToString -@Entity -@NoArgsConstructor -@Getter -@Setter -@Table(name = "phone_certify_req") -public class PhoneCertifyReq { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "id") - private int id; - - @Column(name = "phone_number") - private String phoneNumber; - - @Column(name = "req_time") - private Timestamp reqTime; - - @Column(name = "res_time") - private Timestamp resTime; - - @Column(name = "req_certify_number") - private String reqCertifyNumber; - - @Column(name = "try_number") - private int tryNumber; - - @Column(name = "certify_phone_number") - private String certifyPhoneNumber; - - @Column(name = "create_at") - private Timestamp createAt; - - @Column(name = "modify_at") - private Timestamp modifyAt; -} diff --git a/src/main/java/com/vacation/platform/stayfinder/certify/repository/PhoneCertifyRepository.java b/src/main/java/com/vacation/platform/stayfinder/certify/repository/PhoneCertifyRepository.java new file mode 100644 index 0000000..0323fdb --- /dev/null +++ b/src/main/java/com/vacation/platform/stayfinder/certify/repository/PhoneCertifyRepository.java @@ -0,0 +1,9 @@ +package com.vacation.platform.stayfinder.certify.repository; + +import com.vacation.platform.stayfinder.certify.entity.PhoneCertifyReq; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface PhoneCertifyRepository extends JpaRepository { +} diff --git a/src/main/java/com/vacation/platform/stayfinder/certify/service/PhoneCertifyService.java b/src/main/java/com/vacation/platform/stayfinder/certify/service/PhoneCertifyService.java new file mode 100644 index 0000000..c2998f8 --- /dev/null +++ b/src/main/java/com/vacation/platform/stayfinder/certify/service/PhoneCertifyService.java @@ -0,0 +1,7 @@ +package com.vacation.platform.stayfinder.certify.service; + +import org.springframework.stereotype.Service; + +@Service +public interface PhoneCertifyService { +} diff --git a/src/main/java/com/vacation/platform/stayfinder/certify/service/serviceImpl/PhoneCertifyServiceImpl.java b/src/main/java/com/vacation/platform/stayfinder/certify/service/serviceImpl/PhoneCertifyServiceImpl.java new file mode 100644 index 0000000..a75c327 --- /dev/null +++ b/src/main/java/com/vacation/platform/stayfinder/certify/service/serviceImpl/PhoneCertifyServiceImpl.java @@ -0,0 +1,11 @@ +package com.vacation.platform.stayfinder.certify.service.serviceImpl; + +import com.vacation.platform.stayfinder.certify.service.PhoneCertifyService; +import org.springframework.stereotype.Service; + +@Service +public class PhoneCertifyServiceImpl implements PhoneCertifyService { + + + +} From 136eaff22420a09cd9a436a9493abaaadb559d03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=95=88=EC=8A=B9=ED=98=84?= Date: Tue, 7 Jan 2025 22:13:07 +0900 Subject: [PATCH 19/23] =?UTF-8?q?=EC=95=BD=EA=B4=80=20=ED=81=B4=EB=9E=98?= =?UTF-8?q?=EC=8A=A4=20=ED=85=8C=EC=9D=B4=EB=B8=94=20=EB=A7=A4=ED=95=91=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../stayfinder/terms/entity/Terms.java | 26 +++++++++---------- .../stayfinder/terms/entity/TermsSub.java | 13 +++++----- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/vacation/platform/stayfinder/terms/entity/Terms.java b/src/main/java/com/vacation/platform/stayfinder/terms/entity/Terms.java index 64ffaf0..f8b2af5 100644 --- a/src/main/java/com/vacation/platform/stayfinder/terms/entity/Terms.java +++ b/src/main/java/com/vacation/platform/stayfinder/terms/entity/Terms.java @@ -5,36 +5,36 @@ import lombok.*; import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; @ToString -@Entity +@Entity(name = "Terms") @NoArgsConstructor @Data -@Table +@Table(name = "TERMS", uniqueConstraints = {@UniqueConstraint( + name = "termsId_mainTitle", + columnNames = {"terms_id", "terms_main_title"} +)}) @EqualsAndHashCode(callSuper = true) public class Terms extends BaseEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "terms_id") -// @OneToMany + @Column(name = "terms_id", nullable = false) private int termsId; // 유니크 해야됨. - @Column(name = "terms_main_title") + @Column(name = "terms_main_title", nullable = false, length = 100) private String termsMainTile; - @Column(name = "is_terms_required") + @Column(name = "is_terms_required", nullable = false, length = 20) private String isTermsRequired; - @Column(name = "is_active") + @Column(name = "is_active", nullable = false, length = 1) private boolean isActive; - //부모로 뺴줘야한다. - @Column(name = "create_at") - private Timestamp createAt; - - @Column(name = "modify_at") - private Timestamp modifyAt; + @OneToMany(mappedBy = "terms") + private List subList = new ArrayList<>(); } diff --git a/src/main/java/com/vacation/platform/stayfinder/terms/entity/TermsSub.java b/src/main/java/com/vacation/platform/stayfinder/terms/entity/TermsSub.java index 2bebbb5..0d8d555 100644 --- a/src/main/java/com/vacation/platform/stayfinder/terms/entity/TermsSub.java +++ b/src/main/java/com/vacation/platform/stayfinder/terms/entity/TermsSub.java @@ -4,10 +4,6 @@ import com.vacation.platform.stayfinder.common.BaseEntity; import jakarta.persistence.*; import lombok.*; -import org.springframework.data.annotation.CreatedDate; - -import java.sql.Timestamp; -import java.time.LocalDateTime; @ToString @Entity @@ -18,14 +14,19 @@ public class TermsSub extends BaseEntity { @Id - private int termsMainId; + @ManyToOne + @JoinColumn(name = "terms_id") + private Terms termsMainId; - @Id + @Column(name = "version", nullable = false) private int version; + @Column(name = "terms_details_title", nullable = false, length = 100) private String termsDetailsTitle; + @Column(name = "terms_details_content", nullable = false, length = 10000) private String termsDetailsContent; + @Column(name = "is_active", nullable = false, length = 1) private boolean isActive; } From 190c35e17e8cb0780d5066fc87576db5802aa318 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=95=88=EC=8A=B9=ED=98=84?= Date: Tue, 7 Jan 2025 22:44:17 +0900 Subject: [PATCH 20/23] =?UTF-8?q?=EC=95=BD=EA=B4=80=20=ED=81=B4=EB=9E=98?= =?UTF-8?q?=EC=8A=A4=20=EB=B3=B5=ED=95=A9=ED=82=A4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../platform/stayfinder/common/BaseEntity.java | 7 +++---- .../platform/stayfinder/terms/entity/Terms.java | 2 +- .../platform/stayfinder/terms/entity/TermsSub.java | 4 ++++ .../platform/stayfinder/user/entity/TermsSubId.java | 11 +++++++++++ 4 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 src/main/java/com/vacation/platform/stayfinder/user/entity/TermsSubId.java diff --git a/src/main/java/com/vacation/platform/stayfinder/common/BaseEntity.java b/src/main/java/com/vacation/platform/stayfinder/common/BaseEntity.java index 40ed887..2769f0f 100644 --- a/src/main/java/com/vacation/platform/stayfinder/common/BaseEntity.java +++ b/src/main/java/com/vacation/platform/stayfinder/common/BaseEntity.java @@ -1,9 +1,6 @@ package com.vacation.platform.stayfinder.common; -import jakarta.persistence.EntityListeners; -import jakarta.persistence.MappedSuperclass; -import jakarta.persistence.PrePersist; -import jakarta.persistence.PreUpdate; +import jakarta.persistence.*; import lombok.Getter; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.LastModifiedDate; @@ -17,9 +14,11 @@ public class BaseEntity { @CreatedDate + @Column(name = "create_at") private Long createAt; @LastModifiedDate + @Column(name = "modify_at") private Long modifyAt; @PrePersist diff --git a/src/main/java/com/vacation/platform/stayfinder/terms/entity/Terms.java b/src/main/java/com/vacation/platform/stayfinder/terms/entity/Terms.java index f8b2af5..d8bf7ef 100644 --- a/src/main/java/com/vacation/platform/stayfinder/terms/entity/Terms.java +++ b/src/main/java/com/vacation/platform/stayfinder/terms/entity/Terms.java @@ -34,7 +34,7 @@ public class Terms extends BaseEntity { @Column(name = "is_active", nullable = false, length = 1) private boolean isActive; - @OneToMany(mappedBy = "terms") + @OneToMany(mappedBy = "termsMainId") private List subList = new ArrayList<>(); } diff --git a/src/main/java/com/vacation/platform/stayfinder/terms/entity/TermsSub.java b/src/main/java/com/vacation/platform/stayfinder/terms/entity/TermsSub.java index 0d8d555..56e1370 100644 --- a/src/main/java/com/vacation/platform/stayfinder/terms/entity/TermsSub.java +++ b/src/main/java/com/vacation/platform/stayfinder/terms/entity/TermsSub.java @@ -2,6 +2,7 @@ import com.vacation.platform.stayfinder.common.BaseEntity; +import com.vacation.platform.stayfinder.user.entity.TermsSubId; import jakarta.persistence.*; import lombok.*; @@ -11,6 +12,7 @@ @Data @Table @EqualsAndHashCode(callSuper = true) +@IdClass(TermsSubId.class) // 복합 키 클래스 설정 public class TermsSub extends BaseEntity { @Id @@ -18,6 +20,8 @@ public class TermsSub extends BaseEntity { @JoinColumn(name = "terms_id") private Terms termsMainId; + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "version", nullable = false) private int version; diff --git a/src/main/java/com/vacation/platform/stayfinder/user/entity/TermsSubId.java b/src/main/java/com/vacation/platform/stayfinder/user/entity/TermsSubId.java new file mode 100644 index 0000000..acab63a --- /dev/null +++ b/src/main/java/com/vacation/platform/stayfinder/user/entity/TermsSubId.java @@ -0,0 +1,11 @@ +package com.vacation.platform.stayfinder.user.entity; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class TermsSubId implements Serializable { + private Long termsMainId; + private int version; +} From 26cecf77a900c8dcb12b9edb4ec6d14ca9784f59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=95=88=EC=8A=B9=ED=98=84?= Date: Tue, 7 Jan 2025 22:44:56 +0900 Subject: [PATCH 21/23] =?UTF-8?q?=EC=95=BD=EA=B4=80=20=EB=B9=84=EC=A6=88?= =?UTF-8?q?=EB=8B=88=EC=8A=A4=20=EC=97=85=EB=AC=B4=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../terms/controller/TermsController.java | 15 ++++++++++---- .../stayfinder/terms/dto/TermsDto.java | 10 ++++++++++ .../terms/repository/TermsRepository.java | 5 +++++ .../terms/service/TermsService.java | 6 ++++-- .../service/serviceImpl/TermsServiceImpl.java | 20 +++++++++++++++++-- 5 files changed, 48 insertions(+), 8 deletions(-) create mode 100644 src/main/java/com/vacation/platform/stayfinder/terms/dto/TermsDto.java diff --git a/src/main/java/com/vacation/platform/stayfinder/terms/controller/TermsController.java b/src/main/java/com/vacation/platform/stayfinder/terms/controller/TermsController.java index 84fa974..c77480b 100644 --- a/src/main/java/com/vacation/platform/stayfinder/terms/controller/TermsController.java +++ b/src/main/java/com/vacation/platform/stayfinder/terms/controller/TermsController.java @@ -1,8 +1,10 @@ package com.vacation.platform.stayfinder.terms.controller; +import com.vacation.platform.stayfinder.terms.dto.TermsDto; import com.vacation.platform.stayfinder.terms.entity.Terms; import com.vacation.platform.stayfinder.terms.service.TermsService; +import com.vacation.platform.stayfinder.terms.service.serviceImpl.TermsServiceImpl; import com.vacation.platform.stayfinder.util.Result; import jakarta.validation.Valid; import org.springframework.web.bind.annotation.PostMapping; @@ -16,7 +18,7 @@ public class TermsController { private final TermsService termsService; - public TermsController(TermsService termsService) { + public TermsController(TermsServiceImpl termsService) { this.termsService = termsService; } @@ -24,13 +26,18 @@ public TermsController(TermsService termsService) { //특정 고객이 약관 상세 보고 싶다면 해당 약관 sub 전송 //메인 동의 api 에서 응답으로 필수 동의를 전체 동의 한 경우에 휴대폰 인증으로 넘어감 @PostMapping("/getMain") - public Result getMain() { + public Result getMain() { return termsService.getTermsMain(); } @PostMapping("/terms_register") - public Result termsRegistration(@Valid @RequestBody Terms terms) { - return termsService.registerTerms(); + public Result termsRegistration(@Valid @RequestBody TermsDto termsDto) { + try { + return termsService.registerTerms(termsDto); + } catch(Exception e) { + e.printStackTrace(); + } + return null; } diff --git a/src/main/java/com/vacation/platform/stayfinder/terms/dto/TermsDto.java b/src/main/java/com/vacation/platform/stayfinder/terms/dto/TermsDto.java new file mode 100644 index 0000000..7f778cf --- /dev/null +++ b/src/main/java/com/vacation/platform/stayfinder/terms/dto/TermsDto.java @@ -0,0 +1,10 @@ +package com.vacation.platform.stayfinder.terms.dto; + +import lombok.Data; + +@Data +public class TermsDto { + private String mainTitle; + private String subTitle; + private String detailContent; +} diff --git a/src/main/java/com/vacation/platform/stayfinder/terms/repository/TermsRepository.java b/src/main/java/com/vacation/platform/stayfinder/terms/repository/TermsRepository.java index a57dab1..806dc75 100644 --- a/src/main/java/com/vacation/platform/stayfinder/terms/repository/TermsRepository.java +++ b/src/main/java/com/vacation/platform/stayfinder/terms/repository/TermsRepository.java @@ -4,6 +4,11 @@ import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; +import java.util.List; + @Repository public interface TermsRepository extends JpaRepository { + + List findByTermsMainTile(String mainTitle); + } diff --git a/src/main/java/com/vacation/platform/stayfinder/terms/service/TermsService.java b/src/main/java/com/vacation/platform/stayfinder/terms/service/TermsService.java index fd72b6c..01e4370 100644 --- a/src/main/java/com/vacation/platform/stayfinder/terms/service/TermsService.java +++ b/src/main/java/com/vacation/platform/stayfinder/terms/service/TermsService.java @@ -1,13 +1,15 @@ package com.vacation.platform.stayfinder.terms.service; +import com.vacation.platform.stayfinder.terms.dto.TermsDto; +import com.vacation.platform.stayfinder.terms.entity.Terms; import com.vacation.platform.stayfinder.util.Result; import org.springframework.stereotype.Service; @Service public interface TermsService { - public Result getTermsMain(); + public Result getTermsMain(); - public Result registerTerms(); + public Result registerTerms (TermsDto termsDto); } diff --git a/src/main/java/com/vacation/platform/stayfinder/terms/service/serviceImpl/TermsServiceImpl.java b/src/main/java/com/vacation/platform/stayfinder/terms/service/serviceImpl/TermsServiceImpl.java index 7310ba8..f2c995b 100644 --- a/src/main/java/com/vacation/platform/stayfinder/terms/service/serviceImpl/TermsServiceImpl.java +++ b/src/main/java/com/vacation/platform/stayfinder/terms/service/serviceImpl/TermsServiceImpl.java @@ -1,8 +1,12 @@ package com.vacation.platform.stayfinder.terms.service.serviceImpl; +import com.vacation.platform.stayfinder.terms.dto.TermsDto; +import com.vacation.platform.stayfinder.terms.entity.Terms; +import com.vacation.platform.stayfinder.terms.entity.TermsSub; import com.vacation.platform.stayfinder.terms.repository.TermsRepository; import com.vacation.platform.stayfinder.terms.repository.TermsSubRepository; import com.vacation.platform.stayfinder.terms.service.TermsService; +import com.vacation.platform.stayfinder.util.ResponseCode; import com.vacation.platform.stayfinder.util.Result; import org.springframework.stereotype.Service; @@ -19,12 +23,24 @@ public TermsServiceImpl(TermsRepository termsRepository, TermsSubRepository term } @Override - public Result getTermsMain() { + public Result getTermsMain() { + return null; } + // 약관 저장 하는것부터 처리해야함 + // 필요한것은 약관 메인 타이틀, 약관 서브 타이틀 + // 약관 내용 + // 약관 버전 + @Override - public Result registerTerms() { + public Result registerTerms(TermsDto termsDto) { + if(termsDto == null) { + return new Result<>(ResponseCode.BAD_REQUEST, ResponseCode.BAD_REQUEST.getCustomMessage(), null); + } + + + return null; } } From 9b879fccd696fb2773fcede71e523e3378ca103d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=95=88=EC=8A=B9=ED=98=84?= Date: Tue, 7 Jan 2025 22:45:41 +0900 Subject: [PATCH 22/23] =?UTF-8?q?=EC=95=BD=EA=B4=80=20=EB=8F=99=EC=9D=98?= =?UTF-8?q?=20=ED=8C=8C=EC=9D=BC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../stayfinder/certify/entity/TermsUserAgreement.java | 5 ----- .../certify/repository/TermsUserAgreementRepository.java | 3 ++- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/vacation/platform/stayfinder/certify/entity/TermsUserAgreement.java b/src/main/java/com/vacation/platform/stayfinder/certify/entity/TermsUserAgreement.java index 8378fdd..f327bb8 100644 --- a/src/main/java/com/vacation/platform/stayfinder/certify/entity/TermsUserAgreement.java +++ b/src/main/java/com/vacation/platform/stayfinder/certify/entity/TermsUserAgreement.java @@ -32,10 +32,5 @@ public class TermsUserAgreement extends BaseEntity { // version도 들어와야됨. - @Column(name = "created_at") - private Timestamp createdAt; - - @Column(name = "modify_at") - private Timestamp modifyAt; } diff --git a/src/main/java/com/vacation/platform/stayfinder/certify/repository/TermsUserAgreementRepository.java b/src/main/java/com/vacation/platform/stayfinder/certify/repository/TermsUserAgreementRepository.java index b9d8332..b46da1e 100644 --- a/src/main/java/com/vacation/platform/stayfinder/certify/repository/TermsUserAgreementRepository.java +++ b/src/main/java/com/vacation/platform/stayfinder/certify/repository/TermsUserAgreementRepository.java @@ -1,8 +1,9 @@ package com.vacation.platform.stayfinder.certify.repository; +import com.vacation.platform.stayfinder.certify.entity.TermsUserAgreement; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository -public interface TermsUserAgreementRepository extends JpaRepository { +public interface TermsUserAgreementRepository extends JpaRepository { } From e22e1d7fb188eb1d11c88d09c5397d4d0e0a2ad8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=95=88=EC=8A=B9=ED=98=84?= Date: Tue, 7 Jan 2025 22:46:11 +0900 Subject: [PATCH 23/23] =?UTF-8?q?=EA=B3=A0=EA=B0=9D=20=EB=8F=99=EC=9D=98?= =?UTF-8?q?=20repository=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{PhoneCertifyRepository.java => CertifyRepository.java} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename src/main/java/com/vacation/platform/stayfinder/certify/repository/{PhoneCertifyRepository.java => CertifyRepository.java} (54%) diff --git a/src/main/java/com/vacation/platform/stayfinder/certify/repository/PhoneCertifyRepository.java b/src/main/java/com/vacation/platform/stayfinder/certify/repository/CertifyRepository.java similarity index 54% rename from src/main/java/com/vacation/platform/stayfinder/certify/repository/PhoneCertifyRepository.java rename to src/main/java/com/vacation/platform/stayfinder/certify/repository/CertifyRepository.java index 0323fdb..36f48d0 100644 --- a/src/main/java/com/vacation/platform/stayfinder/certify/repository/PhoneCertifyRepository.java +++ b/src/main/java/com/vacation/platform/stayfinder/certify/repository/CertifyRepository.java @@ -1,9 +1,9 @@ package com.vacation.platform.stayfinder.certify.repository; -import com.vacation.platform.stayfinder.certify.entity.PhoneCertifyReq; +import com.vacation.platform.stayfinder.certify.entity.CertifyReq; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository -public interface PhoneCertifyRepository extends JpaRepository { +public interface CertifyRepository extends JpaRepository { }