Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] 봤어요, 봤어요 플레이리스트 도메인 추가 #27

Merged
merged 4 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.mookive.mookive_backend.watched.domain.entity;

import com.mookive.mookive_backend.common.BaseTimeEntity;
import com.mookive.mookive_backend.movie.domain.entity.Movie;
import com.mookive.mookive_backend.user.domain.entity.User;
import jakarta.persistence.*;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Entity
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class Watched extends BaseTimeEntity {

@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@ManyToOne
@JoinColumn(name = "movie_id")
private Movie movie;

@ManyToOne
@JoinColumn(name = "user_id")
private User user;

@Builder
public Watched(Movie movie, User user) {
this.movie = movie;
this.user = user;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.mookive.mookive_backend.watched.domain.repository;

import com.mookive.mookive_backend.watched.domain.entity.Watched;
import org.springframework.data.jpa.repository.JpaRepository;

public interface WatchedRepository extends JpaRepository<Watched, Long> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.mookive.mookive_backend.watchedPlaylist.domain.entity;

import com.mookive.mookive_backend.common.BaseTimeEntity;
import com.mookive.mookive_backend.playlist.domain.entity.Playlist;
import com.mookive.mookive_backend.user.domain.entity.User;
import jakarta.persistence.*;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Entity
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class WatchedPlaylist extends BaseTimeEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@OneToOne
@JoinColumn(name = "user_id")
private User user;

@OneToOne
@JoinColumn(name = "playlist_id")
private Playlist playlist;

@Builder
public WatchedPlaylist(User user, Playlist playlist) {
this.user = user;
this.playlist = playlist;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.mookive.mookive_backend.watchedPlaylist.domain.repository;

import com.mookive.mookive_backend.watchedPlaylist.domain.entity.WatchedPlaylist;
import org.springframework.data.jpa.repository.JpaRepository;

public interface WatchedPlaylistRepository extends JpaRepository<WatchedPlaylist, Long> {
}
Loading