Merge branch 'main' of https://github.com/dg04-hi/hi-backend
# Conflicts: # review/src/main/java/com/ktds/hi/review/infra/gateway/ExternalReviewEventHubAdapter.java
This commit is contained in:
@@ -1,33 +1,33 @@
|
||||
package com.ktds.hi.review.infra.config;
|
||||
|
||||
import com.azure.messaging.eventhubs.EventHubClientBuilder;
|
||||
import com.azure.messaging.eventhubs.EventHubConsumerClient;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* Azure Event Hub 설정 클래스 (단일 EntityPath 포함된 connection string 사용)
|
||||
*/
|
||||
@Slf4j
|
||||
@Configuration
|
||||
public class EventHubConfig {
|
||||
|
||||
@Value("${azure.eventhub.connection-string}")
|
||||
private String connectionString;
|
||||
|
||||
@Value("${azure.eventhub.consumer-group:$Default}")
|
||||
private String consumerGroup;
|
||||
|
||||
/**
|
||||
* 외부 리뷰 이벤트 수신용 Consumer
|
||||
*/
|
||||
@Bean("externalReviewEventConsumer")
|
||||
public EventHubConsumerClient externalReviewEventConsumer() {
|
||||
return new EventHubClientBuilder()
|
||||
.connectionString(connectionString)
|
||||
.consumerGroup(consumerGroup)
|
||||
.buildConsumerClient();
|
||||
}
|
||||
}
|
||||
package com.ktds.hi.review.infra.config;
|
||||
|
||||
import com.azure.messaging.eventhubs.EventHubClientBuilder;
|
||||
import com.azure.messaging.eventhubs.EventHubConsumerClient;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* Azure Event Hub 설정 클래스 (단일 EntityPath 포함된 connection string 사용)
|
||||
*/
|
||||
@Slf4j
|
||||
@Configuration
|
||||
public class EventHubConfig {
|
||||
|
||||
@Value("${azure.eventhub.connection-string}")
|
||||
private String connectionString;
|
||||
|
||||
@Value("${azure.eventhub.consumer-group:$Default}")
|
||||
private String consumerGroup;
|
||||
|
||||
/**
|
||||
* 외부 리뷰 이벤트 수신용 Consumer
|
||||
*/
|
||||
@Bean("externalReviewEventConsumer")
|
||||
public EventHubConsumerClient externalReviewEventConsumer() {
|
||||
return new EventHubClientBuilder()
|
||||
.connectionString(connectionString)
|
||||
.consumerGroup(consumerGroup)
|
||||
.buildConsumerClient();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,74 +1,74 @@
|
||||
package com.ktds.hi.review.infra.gateway.entity;
|
||||
|
||||
import com.ktds.hi.review.biz.domain.ReviewStatus;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.data.annotation.CreatedDate;
|
||||
import org.springframework.data.annotation.LastModifiedDate;
|
||||
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 리뷰 엔티티 클래스
|
||||
* 데이터베이스 reviews 테이블과 매핑되는 JPA 엔티티
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "reviews")
|
||||
@Getter
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EntityListeners(AuditingEntityListener.class)
|
||||
public class ReviewEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Column(name = "store_id", nullable = false)
|
||||
private Long storeId;
|
||||
|
||||
@Column(name = "member_id", nullable = true)
|
||||
private Long memberId;
|
||||
|
||||
@Column(name = "member_nickname", nullable = false, length = 50)
|
||||
private String memberNickname;
|
||||
|
||||
@Column(nullable = false)
|
||||
private Integer rating;
|
||||
|
||||
@Column(nullable = false, length = 1000)
|
||||
private String content;
|
||||
|
||||
@ElementCollection
|
||||
@CollectionTable(name = "review_images",
|
||||
joinColumns = @JoinColumn(name = "review_id"))
|
||||
@Column(name = "image_url")
|
||||
private List<String> imageUrls;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(nullable = false)
|
||||
@Builder.Default
|
||||
private ReviewStatus status = ReviewStatus.ACTIVE;
|
||||
|
||||
@Column(name = "like_count")
|
||||
@Builder.Default
|
||||
private Integer likeCount = 0;
|
||||
|
||||
@Column(name = "dislike_count")
|
||||
@Builder.Default
|
||||
private Integer dislikeCount = 0;
|
||||
|
||||
@CreatedDate
|
||||
@Column(name = "created_at", updatable = false)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@LastModifiedDate
|
||||
@Column(name = "updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
package com.ktds.hi.review.infra.gateway.entity;
|
||||
|
||||
import com.ktds.hi.review.biz.domain.ReviewStatus;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.data.annotation.CreatedDate;
|
||||
import org.springframework.data.annotation.LastModifiedDate;
|
||||
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 리뷰 엔티티 클래스
|
||||
* 데이터베이스 reviews 테이블과 매핑되는 JPA 엔티티
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "reviews")
|
||||
@Getter
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EntityListeners(AuditingEntityListener.class)
|
||||
public class ReviewEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Column(name = "store_id", nullable = false)
|
||||
private Long storeId;
|
||||
|
||||
@Column(name = "member_id", nullable = true)
|
||||
private Long memberId;
|
||||
|
||||
@Column(name = "member_nickname", nullable = false, length = 50)
|
||||
private String memberNickname;
|
||||
|
||||
@Column(nullable = false)
|
||||
private Integer rating;
|
||||
|
||||
@Column(nullable = false, length = 1000)
|
||||
private String content;
|
||||
|
||||
@ElementCollection
|
||||
@CollectionTable(name = "review_images",
|
||||
joinColumns = @JoinColumn(name = "review_id"))
|
||||
@Column(name = "image_url")
|
||||
private List<String> imageUrls;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(nullable = false)
|
||||
@Builder.Default
|
||||
private ReviewStatus status = ReviewStatus.ACTIVE;
|
||||
|
||||
@Column(name = "like_count")
|
||||
@Builder.Default
|
||||
private Integer likeCount = 0;
|
||||
|
||||
@Column(name = "dislike_count")
|
||||
@Builder.Default
|
||||
private Integer dislikeCount = 0;
|
||||
|
||||
@CreatedDate
|
||||
@Column(name = "created_at", updatable = false)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@LastModifiedDate
|
||||
@Column(name = "updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
|
||||
@@ -1,48 +1,48 @@
|
||||
server:
|
||||
port: ${REVIEW_SERVICE_PORT:8083}
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: review-service
|
||||
|
||||
datasource:
|
||||
url: ${REVIEW_DB_URL:jdbc:postgresql://20.214.91.15:5432/hiorder_review}
|
||||
username: ${REVIEW_DB_USERNAME:hiorder_user}
|
||||
password: ${REVIEW_DB_PASSWORD:hiorder_pass}
|
||||
driver-class-name: org.postgresql.Driver
|
||||
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: ${JPA_DDL_AUTO:update}
|
||||
show-sql: ${JPA_SHOW_SQL:false}
|
||||
properties:
|
||||
hibernate:
|
||||
format_sql: true
|
||||
dialect: org.hibernate.dialect.PostgreSQLDialect
|
||||
data:
|
||||
redis:
|
||||
host: ${REDIS_HOST:localhost}
|
||||
port: ${REDIS_PORT:6379}
|
||||
password: ${REDIS_PASSWORD:}
|
||||
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: ${MAX_FILE_SIZE:10MB}
|
||||
max-request-size: ${MAX_REQUEST_SIZE:50MB}
|
||||
|
||||
azure:
|
||||
eventhub:
|
||||
connection-string: ${AZURE_EVENTHUB_CONNECTION_STRING}
|
||||
consumer-group: $Default
|
||||
|
||||
file-storage:
|
||||
base-path: ${FILE_STORAGE_PATH:/var/hiorder/uploads}
|
||||
allowed-extensions: jpg,jpeg,png,gif,webp
|
||||
max-file-size: 10485760 # 10MB
|
||||
|
||||
springdoc:
|
||||
api-docs:
|
||||
path: /docs/review/api-docs
|
||||
swagger-ui:
|
||||
enabled: true
|
||||
path: /docs/review/swagger-ui.html
|
||||
server:
|
||||
port: ${REVIEW_SERVICE_PORT:8083}
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: review-service
|
||||
|
||||
datasource:
|
||||
url: ${REVIEW_DB_URL:jdbc:postgresql://20.214.91.15:5432/hiorder_review}
|
||||
username: ${REVIEW_DB_USERNAME:hiorder_user}
|
||||
password: ${REVIEW_DB_PASSWORD:hiorder_pass}
|
||||
driver-class-name: org.postgresql.Driver
|
||||
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: ${JPA_DDL_AUTO:update}
|
||||
show-sql: ${JPA_SHOW_SQL:false}
|
||||
properties:
|
||||
hibernate:
|
||||
format_sql: true
|
||||
dialect: org.hibernate.dialect.PostgreSQLDialect
|
||||
data:
|
||||
redis:
|
||||
host: ${REDIS_HOST:localhost}
|
||||
port: ${REDIS_PORT:6379}
|
||||
password: ${REDIS_PASSWORD:}
|
||||
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: ${MAX_FILE_SIZE:10MB}
|
||||
max-request-size: ${MAX_REQUEST_SIZE:50MB}
|
||||
|
||||
azure:
|
||||
eventhub:
|
||||
connection-string: ${AZURE_EVENTHUB_CONNECTION_STRING}
|
||||
consumer-group: $Default
|
||||
|
||||
file-storage:
|
||||
base-path: ${FILE_STORAGE_PATH:/var/hiorder/uploads}
|
||||
allowed-extensions: jpg,jpeg,png,gif,webp
|
||||
max-file-size: 10485760 # 10MB
|
||||
|
||||
springdoc:
|
||||
api-docs:
|
||||
path: /docs/review/api-docs
|
||||
swagger-ui:
|
||||
enabled: true
|
||||
path: /docs/review/swagger-ui.html
|
||||
|
||||
Reference in New Issue
Block a user