Skip to content

Commit

Permalink
Merge pull request #2 from nowgnas/config/entity
Browse files Browse the repository at this point in the history
add product service entity
  • Loading branch information
qwerty1434 authored Nov 20, 2023
2 parents c6d8c21 + f897fef commit 12cf97b
Show file tree
Hide file tree
Showing 10 changed files with 177 additions and 16 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: PR Test
name: PR build


on:
pull_request:
branches: [ develop ] # develop branch에 PR을 보낼 때 실행

jobs:
test:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -21,4 +22,4 @@ jobs:

# Gradle test를 실행한다
- name: build gradle
run: ./gradlew clean bootJar
run: ./gradlew clean build
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ dependencies {
annotationProcessor 'org.projectlombok:lombok'
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'
}

dependencyManagement {
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/kr/bb/product/ProductServiceApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;

@SpringBootApplication
@EnableEurekaClient
@EnableJpaAuditing
public class ProductServiceApplication {

public static void main(String[] args) {
Expand Down
26 changes: 26 additions & 0 deletions src/main/java/kr/bb/product/entity/BaseEntity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package kr.bb.product.entity;

import java.time.LocalDateTime;
import javax.persistence.Column;
import javax.persistence.EntityListeners;
import javax.persistence.MappedSuperclass;
import lombok.Getter;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

@Getter
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
public class BaseEntity {
@CreatedDate
@Column(name = "created_at")
private LocalDateTime createdAt;

@LastModifiedDate
@Column(name = "updated_at")
private LocalDateTime updatedAt;

@Column(name = "is_deleted")
private Boolean isDeleted;
}
32 changes: 32 additions & 0 deletions src/main/java/kr/bb/product/entity/Flower.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
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;
import lombok.Getter;
import lombok.NoArgsConstructor;

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

@Column(name = "language_of_flower")
private String languageOfFlower;

@Column(name = "flower_name")
private String flowerName;
}
38 changes: 38 additions & 0 deletions src/main/java/kr/bb/product/entity/Review.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
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;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@Builder
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
@Entity
@Table(name = "review")
public class Review {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "review_id")
private Long id;

@Column(name = "user_id")
private Long userId;

@Column(name = "content")
private String content;

@Column(name = "rating")
private Integer rating;

@Column(name = "product_id")
private Long productId;
}
26 changes: 26 additions & 0 deletions src/main/java/kr/bb/product/entity/ReviewImages.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package kr.bb.product.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@Builder
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
@Entity
@Table(name = "review_images")
public class ReviewImages extends BaseEntity {
@Id
@Column(name = "review_id")
private Long reviewId;

@Column(name = "review_image")
private String reviewImage;
}
35 changes: 35 additions & 0 deletions src/main/java/kr/bb/product/entity/SalesResume.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
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;
import lombok.Getter;
import lombok.NoArgsConstructor;

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

@Column(name = "sales_resume_status")
private Boolean salesResumeStatus;

@Column(name = "product_id")
private Long productId;

@Column(name = "user_id")
private Long userId;
}
11 changes: 11 additions & 0 deletions src/main/resources/application-local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
spring:
# h2 settings
h2:
console:
enabled: true
settings:
web-allow-others: true
path: /h2-console
datasource:
driver-class-name: org.h2.Driver
url: jdbc:h2:mem:product-service;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MySQL
13 changes: 0 additions & 13 deletions src/test/java/kr/bb/product/ProductServiceApplicationTests.java

This file was deleted.

0 comments on commit 12cf97b

Please sign in to comment.