diff --git a/src/main/java/com/leets/team2/xclone/common/entity/AbstractEntity.java b/src/main/java/com/leets/team2/xclone/common/entity/AbstractEntity.java new file mode 100644 index 0000000..f0f00ab --- /dev/null +++ b/src/main/java/com/leets/team2/xclone/common/entity/AbstractEntity.java @@ -0,0 +1,33 @@ +package com.leets.team2.xclone.common.entity; + +import jakarta.persistence.Column; +import jakarta.persistence.EntityListeners; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.MappedSuperclass; +import java.time.LocalDateTime; +import lombok.Getter; +import lombok.Setter; +import org.springframework.data.annotation.CreatedDate; +import org.springframework.data.annotation.LastModifiedDate; +import org.springframework.data.jpa.domain.support.AuditingEntityListener; + +@MappedSuperclass +@EntityListeners(AuditingEntityListener.class) +@Getter +@Setter +public abstract class AbstractEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + protected Long id; + + @CreatedDate + @Column(name = "created_at", nullable = false, updatable = false) + private LocalDateTime createdAt; + + @LastModifiedDate + @Column(name = "updated_at") + private LocalDateTime updatedAt; +} diff --git a/src/main/java/com/leets/team2/xclone/domain/member/controller/MemberController.java b/src/main/java/com/leets/team2/xclone/domain/member/controller/MemberController.java new file mode 100644 index 0000000..356da1c --- /dev/null +++ b/src/main/java/com/leets/team2/xclone/domain/member/controller/MemberController.java @@ -0,0 +1,5 @@ +package com.leets.team2.xclone.domain.member.controller; + +public interface MemberController { + +} diff --git a/src/main/java/com/leets/team2/xclone/domain/member/controller/MemberControllerImpl.java b/src/main/java/com/leets/team2/xclone/domain/member/controller/MemberControllerImpl.java new file mode 100644 index 0000000..70bca7e --- /dev/null +++ b/src/main/java/com/leets/team2/xclone/domain/member/controller/MemberControllerImpl.java @@ -0,0 +1,14 @@ +package com.leets.team2.xclone.domain.member.controller; + +import com.leets.team2.xclone.domain.member.service.MemberService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +@Controller +@RequestMapping("/api/members") +@RequiredArgsConstructor +public class MemberControllerImpl implements MemberController{ + + private final MemberService memberService; +} diff --git a/src/main/java/com/leets/team2/xclone/domain/member/entities/Member.java b/src/main/java/com/leets/team2/xclone/domain/member/entities/Member.java new file mode 100644 index 0000000..f4f2aa1 --- /dev/null +++ b/src/main/java/com/leets/team2/xclone/domain/member/entities/Member.java @@ -0,0 +1,36 @@ +package com.leets.team2.xclone.domain.member.entities; + +import com.leets.team2.xclone.common.entity.AbstractEntity; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Table; +import java.time.LocalDateTime; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Entity +@Table(name = "member") +@Builder +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor(access = AccessLevel.PRIVATE) +@Getter +public class Member extends AbstractEntity { + + @Column(name = "phone_number", nullable = false) + private String phoneNumber; + + @Column(name = "birth_date", nullable = true) + private LocalDateTime birthDate; + + @Column(name = "tag", nullable = false, unique = true) + private String tag; + + @Column(name = "nickname", nullable = false) + private String nickname; + + @Column(name = "introduction", nullable = true) + private String introduction; +} diff --git a/src/main/java/com/leets/team2/xclone/domain/member/repository/MemberRepository.java b/src/main/java/com/leets/team2/xclone/domain/member/repository/MemberRepository.java new file mode 100644 index 0000000..4b4d6c0 --- /dev/null +++ b/src/main/java/com/leets/team2/xclone/domain/member/repository/MemberRepository.java @@ -0,0 +1,9 @@ +package com.leets.team2.xclone.domain.member.repository; + +import com.leets.team2.xclone.domain.member.entities.Member; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface MemberRepository extends JpaRepository { +} diff --git a/src/main/java/com/leets/team2/xclone/domain/member/service/MemberService.java b/src/main/java/com/leets/team2/xclone/domain/member/service/MemberService.java new file mode 100644 index 0000000..b38b5cd --- /dev/null +++ b/src/main/java/com/leets/team2/xclone/domain/member/service/MemberService.java @@ -0,0 +1,12 @@ +package com.leets.team2.xclone.domain.member.service; + +import com.leets.team2.xclone.domain.member.repository.MemberRepository; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +@Service +@RequiredArgsConstructor +public class MemberService { + + private final MemberRepository memberRepository; +}