From a4c14c69f054c7fb746acdb966da7ceb89588fce Mon Sep 17 00:00:00 2001 From: sohot8653 Date: Fri, 22 Aug 2025 10:48:14 +0900 Subject: [PATCH] =?UTF-8?q?[=ED=9A=8C=EC=9B=90=20=EC=A0=95=EB=B3=B4=20?= =?UTF-8?q?=EC=97=85=EB=8D=B0=EC=9D=B4=ED=8A=B8]=20Member=20=EC=97=94?= =?UTF-8?q?=ED=8B=B0=ED=8B=B0=EC=97=90=20name=20=EB=B0=8F=20email=20?= =?UTF-8?q?=ED=95=84=EB=93=9C=20=EC=B6=94=EA=B0=80,=20=EA=B4=80=EB=A0=A8?= =?UTF-8?q?=20DTO=20=EB=B0=8F=20=EC=84=9C=EB=B9=84=EC=8A=A4=20=EB=A1=9C?= =?UTF-8?q?=EC=A7=81=20=EC=88=98=EC=A0=95.=20=EC=82=AC=EC=9A=A9=EC=9E=90?= =?UTF-8?q?=20=EC=97=AD=ED=95=A0=EC=97=90=EC=84=9C=20USER=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0=20=EB=B0=8F=20=EA=B2=80=EC=A6=9D=20=EC=96=B4=EB=85=B8?= =?UTF-8?q?=ED=85=8C=EC=9D=B4=EC=85=98=20=EC=B6=94=EA=B0=80.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ddl/schema.sql | 4 +++- .../base/member/dto/CreateMemberRequestDto.java | 8 ++++++++ .../domain/base/member/dto/MemberDto.java | 12 ++---------- .../domain/base/member/entity/Member.java | 6 ++++++ .../domain/base/member/enums/MemberRole.java | 1 - .../base/member/service/MemberServiceImpl.java | 10 ++++++---- 6 files changed, 25 insertions(+), 16 deletions(-) diff --git a/ddl/schema.sql b/ddl/schema.sql index 271005d..82624fe 100644 --- a/ddl/schema.sql +++ b/ddl/schema.sql @@ -7,10 +7,12 @@ oid bigint not null, updated_at timestamp(6) not null, updated_oid bigint, - role varchar(40) not null check (role in ('MEMBER','ADMIN','USER','SYSTEM_ADMIN')), + role varchar(40) not null check (role in ('MEMBER','ADMIN','SYSTEM_ADMIN')), + name varchar(100) not null, password varchar(100) not null, user_id varchar(100) not null, refresh_token varchar(200), + email varchar(255) not null, primary key (oid) ); diff --git a/src/main/java/com/bio/bio_backend/domain/base/member/dto/CreateMemberRequestDto.java b/src/main/java/com/bio/bio_backend/domain/base/member/dto/CreateMemberRequestDto.java index f3bafc6..a019624 100644 --- a/src/main/java/com/bio/bio_backend/domain/base/member/dto/CreateMemberRequestDto.java +++ b/src/main/java/com/bio/bio_backend/domain/base/member/dto/CreateMemberRequestDto.java @@ -6,6 +6,7 @@ import lombok.Data; import lombok.NoArgsConstructor; import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Email; @Data @Builder @@ -18,4 +19,11 @@ public class CreateMemberRequestDto { @NotBlank(message = "비밀번호는 필수입니다.") private String password; + + @NotBlank(message = "사용자명은 필수입니다.") + private String name; + + @NotBlank(message = "이메일은 필수입니다.") + @Email(message = "올바른 이메일 형식이 아닙니다.") + private String email; } diff --git a/src/main/java/com/bio/bio_backend/domain/base/member/dto/MemberDto.java b/src/main/java/com/bio/bio_backend/domain/base/member/dto/MemberDto.java index 04b689f..431d02a 100644 --- a/src/main/java/com/bio/bio_backend/domain/base/member/dto/MemberDto.java +++ b/src/main/java/com/bio/bio_backend/domain/base/member/dto/MemberDto.java @@ -22,6 +22,8 @@ public class MemberDto implements UserDetails { private Long oid; private String userId; private String password; + private String name; + private String email; private MemberRole role; private Boolean useFlag; private String refreshToken; @@ -39,21 +41,11 @@ public class MemberDto implements UserDetails { return this.userId; } - @Override - public boolean isAccountNonExpired() { - return true; - } - @Override public boolean isAccountNonLocked() { return this.useFlag != null && this.useFlag; } - @Override - public boolean isCredentialsNonExpired() { - return true; - } - @Override public boolean isEnabled() { return this.useFlag != null && this.useFlag; diff --git a/src/main/java/com/bio/bio_backend/domain/base/member/entity/Member.java b/src/main/java/com/bio/bio_backend/domain/base/member/entity/Member.java index cc544a0..2790ae5 100644 --- a/src/main/java/com/bio/bio_backend/domain/base/member/entity/Member.java +++ b/src/main/java/com/bio/bio_backend/domain/base/member/entity/Member.java @@ -30,6 +30,12 @@ public class Member extends BaseEntity { @Column(name = "password", nullable = false, length = 100) private String password; + @Column(name = "name", nullable = false, length = 100) + private String name; + + @Column(name = "email", nullable = false, length = 255) + private String email; + @Enumerated(EnumType.STRING) @Column(name = "role", nullable = false, length = 40) private MemberRole role; diff --git a/src/main/java/com/bio/bio_backend/domain/base/member/enums/MemberRole.java b/src/main/java/com/bio/bio_backend/domain/base/member/enums/MemberRole.java index bfce8bd..d005375 100644 --- a/src/main/java/com/bio/bio_backend/domain/base/member/enums/MemberRole.java +++ b/src/main/java/com/bio/bio_backend/domain/base/member/enums/MemberRole.java @@ -12,7 +12,6 @@ public enum MemberRole { MEMBER("MEMBER", "일반 회원"), ADMIN("ADMIN", "관리자"), - USER("USER", "사용자"), SYSTEM_ADMIN("SYSTEM_ADMIN", "시스템 관리자"); private final String value; diff --git a/src/main/java/com/bio/bio_backend/domain/base/member/service/MemberServiceImpl.java b/src/main/java/com/bio/bio_backend/domain/base/member/service/MemberServiceImpl.java index 4b3b077..f6491db 100644 --- a/src/main/java/com/bio/bio_backend/domain/base/member/service/MemberServiceImpl.java +++ b/src/main/java/com/bio/bio_backend/domain/base/member/service/MemberServiceImpl.java @@ -43,15 +43,17 @@ public class MemberServiceImpl implements MemberService { @Override @Transactional - public MemberDto createMember(MemberDto memberDTO) { + public MemberDto createMember(MemberDto memberDto) { // userId 중복 체크 - if (memberRepository.existsByUserId(memberDTO.getUserId())) { + if (memberRepository.existsByUserId(memberDto.getUserId())) { throw new ApiException(ApiResponseCode.USER_ID_DUPLICATE); } Member member = Member.builder() - .userId(memberDTO.getUserId()) - .password(bCryptPasswordEncoder.encode(memberDTO.getPassword())) + .userId(memberDto.getUserId()) + .password(bCryptPasswordEncoder.encode(memberDto.getPassword())) + .name(memberDto.getName()) + .email(memberDto.getEmail()) .role(MemberRole.getDefault()) .build();