-
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.
Browse files
Browse the repository at this point in the history
[refactor] yml 파일 변경(#1)
- Loading branch information
Showing
9 changed files
with
138 additions
and
36 deletions.
There are no files selected for viewing
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,22 @@ | ||
package com.mediflix.backend.config; | ||
|
||
import lombok.Getter; | ||
import org.springframework.data.annotation.CreatedDate; | ||
import org.springframework.data.annotation.LastModifiedDate; | ||
import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
|
||
import javax.persistence.EntityListeners; | ||
import javax.persistence.MappedSuperclass; | ||
import java.time.LocalDateTime; | ||
|
||
@Getter | ||
@MappedSuperclass | ||
@EntityListeners(AuditingEntityListener.class) | ||
public abstract class BaseTime { | ||
|
||
@CreatedDate | ||
protected LocalDateTime createdAt; | ||
|
||
@LastModifiedDate | ||
protected LocalDateTime updatedAt; | ||
} |
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
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.mediflix.backend.entity; | ||
|
||
import com.mediflix.backend.config.BaseTime; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import javax.persistence.*; | ||
|
||
@Getter | ||
@Table(name = "hashtag") | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Builder | ||
@Entity | ||
public class Hashtag extends BaseTime { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "hashtag_id") | ||
private Long hashtagId; | ||
|
||
@Column(length = 20, nullable = false) | ||
private String name; | ||
|
||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "video_id") | ||
private Video video; | ||
|
||
|
||
} |
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
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,39 @@ | ||
package com.mediflix.backend.entity; | ||
|
||
import com.mediflix.backend.config.BaseTime; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import javax.persistence.*; | ||
import java.time.LocalDateTime; | ||
|
||
@Getter | ||
@Table(name = "video") | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Builder | ||
@Entity | ||
public class Video extends BaseTime { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "video_id") | ||
private Long videoId; | ||
|
||
@Column(length = 20, nullable = false) | ||
private String category; | ||
|
||
@Column(length = 20, nullable = false) | ||
private String title; | ||
|
||
@Column(length = 20, nullable = false) | ||
private String cast; | ||
|
||
@Column(name = "video_view") | ||
private Long view; | ||
|
||
private LocalDateTime uploadDate; | ||
|
||
} |
6 changes: 3 additions & 3 deletions
6
src/main/java/com/mediflix/backend/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 |
---|---|---|
@@ -1,16 +1,16 @@ | ||
package com.mediflix.backend.repository; | ||
|
||
import com.mediflix.backend.entity.MemberEntity; | ||
import com.mediflix.backend.entity.Member; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.Optional; | ||
|
||
// DATABASE 작업을 해주는 최종 인터페이스 라고 생각해주면 된다! | ||
public interface MemberRepository extends JpaRepository<MemberEntity, Long> { | ||
public interface MemberRepository extends JpaRepository<Member, Long> { | ||
//첫번째 인자는 어떤 Entity 클래스를 받을 것인지를 나타내고, 두 번째 인자는 Entity 클래스의 PK 타입을 적어주는 것이다.(ID) | ||
|
||
//이메일로 회원 정보를 조회함. (select * from member_table where member_email=?) 와 같은 형태 | ||
// Optional 은 null 방지를 해줌. | ||
Optional<MemberEntity> findByUserId(String userId); | ||
Optional<Member> findByUserId(String userId); | ||
|
||
} |
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
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
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
DELETE FROM member; | ||
|
||
insert into member_table values(1, "정형돈", "정형외과", "정형적", "서울", "user", "user1", "user1pw", 100); | ||
insert into member_table values(2, "유재석", null, "내맘임", "인천", "admin_1", "user2", "user2pw", 80); | ||
insert into member_table values(3, "정준하", "치과", "식신", "대전", "user", "user3", "user3pw", 120); | ||
insert into member_table values(4, "하하", "외과", "하하하", "대구", "user", "user4", "user4pw", 60); | ||
insert into member_table values(5, "박명수", null, "늙은이", "제주", "admin_2", "user5", "user5pw", 200); | ||
insert into member values(1, "정형돈", "정형외과", "정형적", "서울", "user", "user1", "user1pw", 100); | ||
insert into member values(2, "유재석", null, "내맘임", "인천", "admin_1", "user2", "user2pw", 80); | ||
insert into member values(3, "정준하", "치과", "식신", "대전", "user", "user3", "user3pw", 120); | ||
insert into member values(4, "하하", "외과", "하하하", "대구", "user", "user4", "user4pw", 60); | ||
insert into member values(5, "박명수", null, "늙은이", "제주", "admin_2", "user5", "user5pw", 200); |