Skip to content

Commit

Permalink
[feat] 랭킹 도메인, repository 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
syyling committed Mar 7, 2024
1 parent 4e48580 commit d77da03
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.mookive.mookive_backend.ranking.domain.entity;

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 Ranking {

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

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

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

private int rankingNumber;

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

import com.mookive.mookive_backend.ranking.domain.entity.Ranking;
import org.springframework.data.jpa.repository.JpaRepository;

public interface RankingRepository extends JpaRepository<Ranking, Long> {
}

0 comments on commit d77da03

Please sign in to comment.