-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUser.java
More file actions
63 lines (54 loc) · 1.4 KB
/
User.java
File metadata and controls
63 lines (54 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package com.golab.talk.domain;
import javax.persistence.*;
import com.golab.talk.dto.UserDto;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.DynamicInsert;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.ToString;
@Entity
@Table(name = "USER")
@Getter
@Builder
@ToString(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
@DynamicInsert
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "ID", nullable = false)
private int id;
@Column(name = "USER_ID", nullable = false, unique = true)
private String userId;
@Column(name = "NAME", nullable = false, unique = true)
private String name;
@Column(name = "EMAIL", nullable = false)
private String email;
@Column(name = "PASSWORD", nullable = false)
private String password;
@Column(name = "PROFILE_IMG_URL")
private String profileImgUrl;
@Column(name = "CREATED_AT")
private String createdAt;
@Column(name = "UPDATED_AT")
private String updatedAt;
public User(int id, String userId, String name, String email, String password){
this.id = id;
this.userId = userId;
this.name = name;
this.email = email;
this.password = password;
}
public UserDto toDto() {
return UserDto.builder()
.id(id)
.userId(userId)
.name(name)
.email(email)
.password(password)
.build();
}
}