Skip to content

Commit

Permalink
Merge pull request #27 from syyling/feat/22
Browse files Browse the repository at this point in the history
[feat] 봤어요, 봤어요 플레이리스트 도메인 추가
  • Loading branch information
syyling authored May 1, 2024
2 parents 92029a9 + ae72ba0 commit 9ced59d
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 0 deletions.
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> {
}

0 comments on commit 9ced59d

Please sign in to comment.