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();