From df8816dc80ba235afcedc77392303a4656e040a3 Mon Sep 17 00:00:00 2001 From: Danbi Date: Wed, 25 Oct 2023 19:26:40 +0900 Subject: [PATCH] Init: Add member controll dto MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 멤버 생성 컨트롤러 DTO를 추가함. Github issue #3 --- .../member/controller/MemberController.java | 2 + .../controller/dto/CreateMemberDto.java | 48 +++++++++++++++++++ .../member/domain/PasswordHasherImpl.java | 2 + 3 files changed, 52 insertions(+) create mode 100644 src/main/java/beforespring/socialfeed/member/controller/MemberController.java create mode 100644 src/main/java/beforespring/socialfeed/member/controller/dto/CreateMemberDto.java create mode 100644 src/main/java/beforespring/socialfeed/member/domain/PasswordHasherImpl.java diff --git a/src/main/java/beforespring/socialfeed/member/controller/MemberController.java b/src/main/java/beforespring/socialfeed/member/controller/MemberController.java new file mode 100644 index 0000000..50f2235 --- /dev/null +++ b/src/main/java/beforespring/socialfeed/member/controller/MemberController.java @@ -0,0 +1,2 @@ +package beforespring.socialfeed.member.controller;public class MemberController { +} diff --git a/src/main/java/beforespring/socialfeed/member/controller/dto/CreateMemberDto.java b/src/main/java/beforespring/socialfeed/member/controller/dto/CreateMemberDto.java new file mode 100644 index 0000000..c0c0aa9 --- /dev/null +++ b/src/main/java/beforespring/socialfeed/member/controller/dto/CreateMemberDto.java @@ -0,0 +1,48 @@ +package beforespring.socialfeed.member.controller.dto; + +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.Email; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Pattern; +import javax.validation.constraints.Size; + +public class CreateMemberDto { + + @Getter + @NoArgsConstructor(access = AccessLevel.PROTECTED) + static public class Request { + @NotEmpty + private String username; + @NotEmpty + @Email(message = "이메일 형식이 올바르지 않습니다.") + private String email; + @NotEmpty + @Size(min = 10, message = "비밀번호는 최소 10자 이상이어야 합니다.") + @Pattern( + regexp = "^(?=(.*\\\\d.*)(.*[A-Za-z].*|.*[^A-Za-z\\\\d].*))|" + + "(?=(.*[A-Za-z].*)(.*[^A-Za-z\\\\d].*))(?=.*\\\\d.*)|" + + "(?=(.*[A-Za-z].*)(.*\\\\d.*))(.*[^A-Za-z\\\\d].*)$|", + message = "비밀번호는 숫자, 문자, 특수문자 중 2가지 이상을 포함해야 합니다.") + @Pattern(regexp = "(.)\\\\1{2,}", message = "3회 이상 연속되는 문자는 사용할 수 없습니다.") + private String password; + + public Request(String username, String email, String password) { + this.username = username; + this.email = email; + this.password = password; + } + } + + @Getter + @NoArgsConstructor(access = AccessLevel.PROTECTED) + static public class Response { + private Long id; + + public Response(Long id) { + this.id = id; + } + } +} diff --git a/src/main/java/beforespring/socialfeed/member/domain/PasswordHasherImpl.java b/src/main/java/beforespring/socialfeed/member/domain/PasswordHasherImpl.java new file mode 100644 index 0000000..630ed83 --- /dev/null +++ b/src/main/java/beforespring/socialfeed/member/domain/PasswordHasherImpl.java @@ -0,0 +1,2 @@ +package beforespring.socialfeed.member.domain;public class PasswordHasherImpl { +}