feat: 도메인 정보 추가
This commit is contained in:
@@ -1,33 +1,59 @@
|
|||||||
package com.example.oauthspringsecurity.domain;
|
package com.example.oauthspringsecurity.domain;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.*;
|
||||||
import javax.persistence.GeneratedValue;
|
|
||||||
import javax.persistence.GenerationType;
|
|
||||||
import javax.persistence.Id;
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
public class Member {
|
public class Member {
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
private String oauthId;
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
private String imageUrl;
|
private String imageUrl;
|
||||||
|
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
private Role role;
|
||||||
|
|
||||||
protected Member() {
|
protected Member() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Member(Long id, String name, String email, String imageUrl) {
|
public Member(String oauthId, String name, String email, String imageUrl, Role role) {
|
||||||
|
this(null, oauthId, name, email, imageUrl, role);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Member(Long id, String oauthId, String name, String email, String imageUrl, Role role) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
this.oauthId = oauthId;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.email = email;
|
this.email = email;
|
||||||
this.imageUrl = imageUrl;
|
this.imageUrl = imageUrl;
|
||||||
|
this.role = role;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Member update(String name, String email, String imageUrl) {
|
||||||
|
this.name = name;
|
||||||
|
this.email = email;
|
||||||
|
this.imageUrl = imageUrl;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoleKey() {
|
||||||
|
return this.role.getKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getOauthId() {
|
||||||
|
return oauthId;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
@@ -39,4 +65,8 @@ public class Member {
|
|||||||
public String getImageUrl() {
|
public String getImageUrl() {
|
||||||
return imageUrl;
|
return imageUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Role getRole() {
|
||||||
|
return role;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.example.oauthspringsecurity.domain;
|
||||||
|
|
||||||
|
public enum Role {
|
||||||
|
GUEST("ROLE_GUEST"),
|
||||||
|
USER("ROLE_USER");
|
||||||
|
|
||||||
|
private final String key;
|
||||||
|
|
||||||
|
Role(String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user