Skip to content

Commit

Permalink
Merge pull request #2 from Kusitms-28th-Hicardi-C/feat/#1
Browse files Browse the repository at this point in the history
Feat/#1
  • Loading branch information
emilywin825 authored Sep 13, 2023
2 parents b643a50 + 595f91e commit 4757e17
Show file tree
Hide file tree
Showing 45 changed files with 461 additions and 0 deletions.
Binary file added .gradle/8.2.1/checksums/checksums.lock
Binary file not shown.
Binary file added .gradle/8.2.1/checksums/md5-checksums.bin
Binary file not shown.
Binary file added .gradle/8.2.1/checksums/sha1-checksums.bin
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Binary file added .gradle/8.2.1/fileChanges/last-build.bin
Binary file not shown.
Binary file added .gradle/8.2.1/fileHashes/fileHashes.bin
Binary file not shown.
Binary file added .gradle/8.2.1/fileHashes/fileHashes.lock
Binary file not shown.
Binary file added .gradle/8.2.1/fileHashes/resourceHashesCache.bin
Binary file not shown.
Empty file added .gradle/8.2.1/gc.properties
Empty file.
Binary file added .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
2 changes: 2 additions & 0 deletions .gradle/buildOutputCleanup/cache.properties
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
Binary file added .gradle/buildOutputCleanup/outputFiles.bin
Binary file not shown.
Binary file added .gradle/file-system.probe
Binary file not shown.
Empty file added .gradle/vcs-1/gc.properties
Empty file.
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/aws.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/modules/hiCardi.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/modules/hiCardi.main.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/modules/hiCardi.test.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions .idea/sonarlint/issuestore/index.pb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions .idea/sonarlint/securityhotspotstore/index.pb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-web'
// implementation 'org.springframework.boot:spring-boot-starter-security'
compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'com.mysql:mysql-connector-j'
Expand Down
Binary file not shown.
1 change: 1 addition & 0 deletions build/resources/main/application.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Binary file not shown.
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
}
5 changes: 5 additions & 0 deletions src/main/java/com/example/hicardi/domain/user/dto/GENDER.java
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();
}



}
83 changes: 83 additions & 0 deletions src/main/java/com/example/hicardi/domain/user/entity/User.java
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> {
}
Loading

0 comments on commit 4757e17

Please sign in to comment.