Skip to content

Commit

Permalink
Merge pull request #5 from nowgnas/feat/category
Browse files Browse the repository at this point in the history
🗃️ Add table
  • Loading branch information
nowgnas authored Nov 21, 2023
2 parents 614d604 + 16dd35f commit 4ec527b
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 14 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ dependencies {
testImplementation 'org.springframework.boot:spring-boot-starter-test'
implementation "org.springframework.cloud:spring-cloud-starter-bus-kafka"
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
runtimeOnly 'com.h2database:h2'
implementation 'mysql:mysql-connector-java:8.0.33'
implementation group: 'io.github.lotteon-maven', name: 'blooming-blooms-utils', version: '0.1.0-alpha1'
// https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-dynamodb
implementation group: 'com.amazonaws', name: 'aws-java-sdk-dynamodb', version: '1.12.592'
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/kr/bb/product/entity/BaseEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ public class BaseEntity {

@Column(name = "is_deleted")
private Boolean isDeleted;
}
}
19 changes: 16 additions & 3 deletions src/main/java/kr/bb/product/entity/Category.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
package kr.bb.product.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Builder;
Expand All @@ -8,9 +14,16 @@

@Getter
@Builder
@AllArgsConstructor
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class Category {
private Long categoryId;
@AllArgsConstructor
@Entity
@Table(name = "category")
public class Category extends BaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "category_id")
private Long id;

@Column(name = "category_name")
private String categoryName;
}
6 changes: 5 additions & 1 deletion src/main/java/kr/bb/product/entity/Review.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
package kr.bb.product.entity;

import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
Expand All @@ -18,7 +22,7 @@
@AllArgsConstructor
@Entity
@Table(name = "review")
public class Review {
public class Review extends BaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "review_id")
Expand Down
22 changes: 18 additions & 4 deletions src/main/java/kr/bb/product/entity/ReviewImages.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
package kr.bb.product.entity;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
Expand All @@ -18,9 +24,17 @@
@Table(name = "review_images")
public class ReviewImages extends BaseEntity {
@Id
@Column(name = "review_id")
private Long reviewId;
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "review_images_id")
private Long id;

@Column(name = "review_image_url")
private String reviewImageUrl;

@ManyToOne(
fetch = FetchType.LAZY,
cascade = {CascadeType.PERSIST, CascadeType.REMOVE})
@JoinColumn(name = "id")
private Review review;

@Column(name = "review_image")
private String reviewImage;
}
21 changes: 17 additions & 4 deletions src/main/java/kr/bb/product/entity/Tag.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
package kr.bb.product.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Builder;
Expand All @@ -8,9 +14,16 @@

@Getter
@Builder
@AllArgsConstructor
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class Tag {
private Long tagId;
private String tagName;
@AllArgsConstructor
@Entity
@Table(name = "tag")
public class Tag extends BaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "tag_id")
private Long id;

@Column(name = "tag_name")
private String categoryName;
}

0 comments on commit 4ec527b

Please sign in to comment.