-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#Mon Sep 11 17:07:28 KST 2023 | ||
gradle.version=8.2.1 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.example.hicardi.domain.user.controller; | ||
|
||
import com.example.hicardi.domain.user.dto.SignUpRequestDTO; | ||
import com.example.hicardi.domain.user.service.UserService; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.validation.BindingResult; | ||
import org.springframework.validation.annotation.Validated; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/v1/user") | ||
@Slf4j | ||
public class UserController { | ||
|
||
private final UserService userService; | ||
|
||
@PostMapping("/sign-up") | ||
public ResponseEntity<?> signUpUser(@Validated @RequestBody SignUpRequestDTO dto | ||
) { | ||
log.info("/user/sign-up POST! --{}", dto); | ||
|
||
try { | ||
boolean join = userService.signUp(dto); | ||
return ResponseEntity.ok().body(join); | ||
} catch (Exception e) { | ||
log.warn("기타 예외가 발생했습니다"); | ||
e.printStackTrace(); | ||
return ResponseEntity.internalServerError().build(); | ||
} | ||
|
||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.example.hicardi.domain.user.dto; | ||
|
||
public enum BUSINESS { | ||
PERSONAL,COMPANY | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.example.hicardi.domain.user.dto; | ||
|
||
public enum GENDER { | ||
M,F | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.example.hicardi.domain.user.dto; | ||
|
||
public enum MEMBERSHIP { | ||
BUSINESSMEMEBER | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.example.hicardi.domain.user.dto; | ||
|
||
import com.example.hicardi.domain.user.entity.User; | ||
import lombok.*; | ||
import java.util.Date; | ||
|
||
@Setter | ||
@Getter | ||
@ToString | ||
@EqualsAndHashCode | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Builder | ||
public class SignUpRequestDTO { | ||
|
||
private MEMBERSHIP membershipVerification; | ||
private BUSINESS businessClassification; | ||
private String loginId; | ||
private String password; | ||
private String name; | ||
private String businessName; | ||
private String businessNumber; | ||
private String address; | ||
private String landLine; | ||
private String phoneNumber; | ||
private String email; | ||
private GENDER gender; | ||
// private Date birthDate; | ||
private String ykiho; | ||
|
||
public User toEntity() { | ||
return User.builder() | ||
.membershipVerification(this.membershipVerification) | ||
.businessClassification(this.businessClassification) | ||
.loginId(this.loginId) | ||
.password(this.password) | ||
.name(this.name) | ||
.businessName(this.businessName) | ||
.businessNumber(this.businessNumber) | ||
.address(this.address) | ||
.landLine(this.landLine) | ||
.phoneNumber(this.phoneNumber) | ||
.email(this.email) | ||
.gender(this.gender) | ||
// .birthDate(this.birthDate) | ||
.ykiho(this.ykiho) | ||
.build(); | ||
} | ||
|
||
|
||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
package com.example.hicardi.domain.user.entity; | ||
|
||
import com.example.hicardi.domain.user.dto.BUSINESS; | ||
import com.example.hicardi.domain.user.dto.GENDER; | ||
import com.example.hicardi.domain.user.dto.MEMBERSHIP; | ||
import jakarta.persistence.*; | ||
import lombok.*; | ||
import org.hibernate.annotations.CreationTimestamp; | ||
import org.hibernate.annotations.UpdateTimestamp; | ||
import org.springframework.data.relational.core.mapping.Table; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.Date; | ||
|
||
@Setter | ||
@Getter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Entity | ||
@Builder | ||
@Table(name = "member") | ||
public class User { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "member_Id") | ||
private Long memeberId; | ||
|
||
@Column(name = "membership_verification", nullable = false) | ||
@Enumerated(EnumType.STRING) | ||
@Builder.Default | ||
private MEMBERSHIP membershipVerification = MEMBERSHIP.BUSINESSMEMEBER; | ||
|
||
@Column(name = "business_classification", nullable = false) | ||
@Enumerated(EnumType.STRING) | ||
private BUSINESS businessClassification; | ||
|
||
@Column(name = "login_id", nullable = false) | ||
private String loginId; | ||
|
||
@Column(name = "password", nullable = false) | ||
private String password; | ||
|
||
@Column(name = "name", nullable = false) | ||
private String name; | ||
|
||
@Column(name = "business_name", nullable = false) | ||
private String businessName; | ||
|
||
@Column(name = "business_number", nullable = false, unique = true) | ||
private String businessNumber; | ||
|
||
@Column(name = "address", nullable = false) | ||
private String address; | ||
|
||
@Column(name = "land_line", nullable = true) | ||
private String landLine; | ||
|
||
@Column(name = "phone_number", nullable = true) | ||
private String phoneNumber; | ||
|
||
@Column(name = "user_email", nullable = false) | ||
private String email; | ||
|
||
@Column(name = "gender", nullable = false) | ||
@Enumerated(EnumType.STRING) | ||
private GENDER gender; | ||
|
||
// @Column(name = "birth_date", nullable = false) | ||
// private Date birthDate; | ||
|
||
@Column(name = "ykiho") | ||
private String ykiho; | ||
|
||
@CreationTimestamp //insert할 떄 시간 자동으로 들어== DEFAULT CURRENT_TIMESTAMP | ||
@Column(name="created_at",updatable = false) | ||
private LocalDateTime createdAt; | ||
|
||
@UpdateTimestamp //update문 돌아갈 때 자동으로 시간 저장 | ||
@Column(name="updated_at") | ||
private LocalDateTime updateAt; | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.example.hicardi.domain.user.repository; | ||
|
||
import com.example.hicardi.domain.user.entity.User; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface UserRepository extends JpaRepository<User, Long> { | ||
} |