Skip to content

Commit

Permalink
[feat] #3 member 엔티티 클래스 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
SunwoongH committed Oct 26, 2023
1 parent 01c1858 commit 0ecc8aa
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/main/java/org/sopt/seminar/domain/member/domain/Member.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package org.sopt.seminar.domain.member.domain;

import jakarta.persistence.*;
import lombok.*;
import org.hibernate.annotations.DynamicUpdate;
import org.sopt.seminar.global.common.BaseTimeEntity;

@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor(access = AccessLevel.PRIVATE)
@Builder(access = AccessLevel.PRIVATE)
@DynamicUpdate
@Getter
@Entity
public class Member extends BaseTimeEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "member_id")
private Long id;
private String name;
private String nickname;
private Integer age;
@Embedded
private Sopt sopt;

public static Member createMember(final String name, final String nickname, final Integer age, final Sopt sopt) {
return Member.builder()
.name(name)
.nickname(nickname)
.age(age)
.sopt(sopt)
.build();
}

public void updateSopt(Sopt sopt) {
this.sopt = sopt;
}
}

0 comments on commit 0ecc8aa

Please sign in to comment.