Skip to content

Commit

Permalink
Refactor reviews according to new DB schema
Browse files Browse the repository at this point in the history
Fixes #123
  • Loading branch information
micheljung committed Aug 28, 2017
1 parent 20df858 commit 4cc7ac6
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 19 deletions.
2 changes: 0 additions & 2 deletions src/main/java/com/faforever/api/data/domain/GameReview.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;

@Setter
@Include(rootLevel = true, type = "gameReview")
@Entity
@Table(name = "game_review")
@PrimaryKeyJoinColumn(name = "review_id", referencedColumnName = "id")
@CreatePermission(expression = "Prefab.Role.All")
@DeletePermission(expression = IsReviewOwner.EXPRESSION)
public class GameReview extends Review {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;

@Setter
@Include(rootLevel = true, type = "mapVersionReview")
@Entity
@Table(name = "map_version_review")
@PrimaryKeyJoinColumn(name = "review_id", referencedColumnName = "id")
@CreatePermission(expression = "Prefab.Role.All")
@DeletePermission(expression = IsReviewOwner.EXPRESSION)
public class MapVersionReview extends Review {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;

@Setter
@Include(rootLevel = true, type = "modVersionReview")
@Entity
@Table(name = "mod_version_review")
@PrimaryKeyJoinColumn(name = "review_id", referencedColumnName = "id")
@CreatePermission(expression = "Prefab.Role.All")
@DeletePermission(expression = IsReviewOwner.EXPRESSION)
public class ModVersionReview extends Review {
Expand Down
15 changes: 2 additions & 13 deletions src/main/java/com/faforever/api/data/domain/Review.java
Original file line number Diff line number Diff line change
@@ -1,32 +1,21 @@
package com.faforever.api.data.domain;

import com.faforever.api.data.checks.IsReviewOwner;
import com.yahoo.elide.annotation.CreatePermission;
import com.yahoo.elide.annotation.DeletePermission;
import com.yahoo.elide.annotation.Include;
import com.yahoo.elide.annotation.UpdatePermission;
import lombok.EqualsAndHashCode;
import lombok.Setter;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.MappedSuperclass;
import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;

@Setter
@Include(rootLevel = true, type = "review")
@EqualsAndHashCode(of = "id")
@Entity
@Table(name = "review")
@Inheritance(strategy = InheritanceType.JOINED)
@CreatePermission(expression = "Prefab.Role.All")
@DeletePermission(expression = IsReviewOwner.EXPRESSION)
@MappedSuperclass
public class Review extends AbstractEntity {
private String text;
private Byte score;
Expand Down

0 comments on commit 4cc7ac6

Please sign in to comment.