-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] E4-S3 회원가입 API - entity 재정의 #25
- Loading branch information
1 parent
e3f1129
commit 6494b93
Showing
2 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
backend/src/main/java/com/infp/ciat/user/entity/Account.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.infp.ciat.user.entity; | ||
|
||
import com.infp.ciat.common.BaseTimeEntity; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import javax.persistence.*; | ||
|
||
/*** | ||
* 유저 Entity | ||
*/ | ||
@Builder | ||
@NoArgsConstructor | ||
@Getter | ||
@Entity | ||
public class Account extends BaseTimeEntity { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(nullable = false, unique = true) | ||
private String email; | ||
|
||
@Column(nullable = false) | ||
private String nickname; | ||
|
||
@Column(nullable = false) | ||
private String password; | ||
|
||
@Enumerated(EnumType.STRING) | ||
@Column(nullable = false) | ||
private Role role; | ||
|
||
@Builder | ||
public Account(Long id, String email, String nickname, String password, Role role) { | ||
this.id = id; | ||
this.email = email; | ||
this.nickname = nickname; | ||
this.password = password; | ||
this.role = role; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.infp.ciat.user.entity; | ||
|
||
/*** | ||
* 회원 Role | ||
*/ | ||
public enum Role { | ||
ROLE_ADMIN("ROLE_ADMIN", "관리자"), | ||
ROLE_USER("ROLE_USER", "일반 사용자"); | ||
|
||
private String role; | ||
private String description; | ||
|
||
public String getRole() { | ||
return role; | ||
} | ||
|
||
public String getDescription() { | ||
return description; | ||
} | ||
|
||
Role(String role, String description) { | ||
this.role = role; | ||
this.description = description; | ||
} | ||
} |