Skip to content

Commit

Permalink
[FEATURE] E4-S3 회원가입 API - entity 재정의 #25
Browse files Browse the repository at this point in the history
  • Loading branch information
choisungwook committed Oct 7, 2021
1 parent e3f1129 commit 6494b93
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
44 changes: 44 additions & 0 deletions backend/src/main/java/com/infp/ciat/user/entity/Account.java
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;
}
}
25 changes: 25 additions & 0 deletions backend/src/main/java/com/infp/ciat/user/entity/Role.java
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;
}
}

0 comments on commit 6494b93

Please sign in to comment.