Skip to content

Commit

Permalink
[feat] 멤버 도메인 구현 (#8)
Browse files Browse the repository at this point in the history
* feat: 기본 시간을 정의한 entity 구현

* feat: Member 엔티티 구현

* feat: 도메인 클래스들 껍데기 구현

* rename: BaseTimeEntity -> AbstractEntity로 이름 변경

* refactor: MemberEntity 수정

- email 삭제
- tag 추가
  • Loading branch information
soyesenna authored Oct 7, 2024
1 parent 0eac0fc commit f830c93
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 0 deletions.
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;
}
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 {

}
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;
}
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;
}
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> {
}
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;
}

0 comments on commit f830c93

Please sign in to comment.