Skip to content

Commit

Permalink
feat: 유저 도메인, 엔티티 생성
Browse files Browse the repository at this point in the history
  • Loading branch information
yeonsu00 committed Nov 26, 2024
1 parent 5ef1b46 commit 6eebdaa
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main/java/postman/bottler/user/domain/User.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
package postman.bottler.user.domain;

public class User {
private String email;

private User(String email) {
this.email = email;
}

public String getEmail() {
return email;
}
}
31 changes: 31 additions & 0 deletions src/main/java/postman/bottler/user/infra/entity/UserEntity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package postman.bottler.user.infra.entity;

import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.NoArgsConstructor;
import postman.bottler.user.domain.User;

@Entity
@Builder
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor(access = AccessLevel.PROTECTED)
@Table(name = "user")
public class UserEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long userId;

private String email;

public static UserEntity from(User user) {
return UserEntity.builder()
.email(user.getEmail())
.build();
}
}

0 comments on commit 6eebdaa

Please sign in to comment.