-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 기본 시간을 정의한 entity 구현 * feat: Member 엔티티 구현 * feat: 도메인 클래스들 껍데기 구현 * rename: BaseTimeEntity -> AbstractEntity로 이름 변경 * refactor: MemberEntity 수정 - email 삭제 - tag 추가
- Loading branch information
Showing
6 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
src/main/java/com/leets/team2/xclone/common/entity/AbstractEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/java/com/leets/team2/xclone/domain/member/controller/MemberController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.leets.team2.xclone.domain.member.controller; | ||
|
||
public interface MemberController { | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/com/leets/team2/xclone/domain/member/controller/MemberControllerImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
36 changes: 36 additions & 0 deletions
36
src/main/java/com/leets/team2/xclone/domain/member/entities/Member.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/com/leets/team2/xclone/domain/member/repository/MemberRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<Member, Long> { | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/com/leets/team2/xclone/domain/member/service/MemberService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |