diff --git a/src/main/java/com/example/ai_jeju/domain/Album.java b/src/main/java/com/example/ai_jeju/domain/Album.java new file mode 100644 index 0000000..87f1d35 --- /dev/null +++ b/src/main/java/com/example/ai_jeju/domain/Album.java @@ -0,0 +1,20 @@ +package com.example.ai_jeju.domain; + + +import jakarta.persistence.*; +import lombok.*; + +@Table(name="album") +@NoArgsConstructor(access= AccessLevel.PROTECTED) //기본생성자 +@Getter +@Entity +@AllArgsConstructor // 모든 필드를 초기화하는 생성자 +@Builder // 빌더 패턴 +public class Album { + + @Id + @OneToOne + @JoinColumn(name = "album_id") // FK를 설정 + private Child child; + +} diff --git a/src/main/java/com/example/ai_jeju/domain/Photo.java b/src/main/java/com/example/ai_jeju/domain/Photo.java new file mode 100644 index 0000000..79dcd6e --- /dev/null +++ b/src/main/java/com/example/ai_jeju/domain/Photo.java @@ -0,0 +1,25 @@ +package com.example.ai_jeju.domain; + +import jakarta.persistence.*; +import lombok.*; + +@Table(name="photos") +@NoArgsConstructor(access= AccessLevel.PROTECTED) //기본생성자 +@Getter +@Entity +@AllArgsConstructor // 모든 필드를 초기화하는 생성자 +@Builder // 빌더 패턴 +public class Photo { + + @Id + @Column(name = "photo_id") + private Long photoId; + + @Column(name = "img_src") + private String imgSrc; + + @ManyToOne + @JoinColumn(name = "album_id") + private Album album; + +} diff --git a/src/main/java/com/example/ai_jeju/repository/AlbumRepository.java b/src/main/java/com/example/ai_jeju/repository/AlbumRepository.java new file mode 100644 index 0000000..ed9a9fe --- /dev/null +++ b/src/main/java/com/example/ai_jeju/repository/AlbumRepository.java @@ -0,0 +1,13 @@ +package com.example.ai_jeju.repository; + +import com.example.ai_jeju.domain.Album; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import java.util.Optional; + +@Repository +public interface AlbumRepository extends JpaRepository { + + +}