mirror of
https://github.com/ktds-dg0501/kt-event-marketing.git
synced 2026-06-13 06:19:11 +00:00
distribution-service API 명세서를 실제 구현에 맞게 수정
- ChannelType 열거형 값 수정 (URIDONGNETV, RINGOBIZ, GINITV 등) - DistributionRequest 스키마 변경 (title, description, imageUrl 추가) - DistributionResponse 스키마 변경 (success, successCount, failureCount 등) - ChannelDistributionResult 스키마 단순화 - 모든 예제 코드 실제 구현에 맞게 업데이트 - IntelliJ 서비스 실행 프로파일 추가 - Distribution 서비스 엔티티, 매퍼, 리포지토리 추가 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -19,7 +19,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/distribution")
|
||||
@RequestMapping("/distribution")
|
||||
@RequiredArgsConstructor
|
||||
public class DistributionController {
|
||||
|
||||
|
||||
+168
@@ -0,0 +1,168 @@
|
||||
package com.kt.distribution.entity;
|
||||
|
||||
import com.kt.distribution.dto.ChannelType;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 채널별 배포 상태 엔티티
|
||||
*
|
||||
* 각 채널의 배포 진행 상태 및 결과 정보를 저장합니다.
|
||||
*
|
||||
* @author Backend Developer
|
||||
* @since 2025-10-24
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "channel_status", indexes = {
|
||||
@Index(name = "idx_distribution_channel", columnList = "distribution_status_id, channel")
|
||||
})
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ChannelStatusEntity {
|
||||
|
||||
/**
|
||||
* 채널 상태 ID (Primary Key)
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 배포 상태 (Foreign Key)
|
||||
*/
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "distribution_status_id", nullable = false)
|
||||
private DistributionStatus distributionStatus;
|
||||
|
||||
/**
|
||||
* 채널 타입
|
||||
*/
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "channel", nullable = false, length = 20)
|
||||
private ChannelType channel;
|
||||
|
||||
/**
|
||||
* 채널별 배포 상태
|
||||
* - PENDING: 대기 중
|
||||
* - IN_PROGRESS: 진행 중
|
||||
* - COMPLETED: 완료
|
||||
* - FAILED: 실패
|
||||
*/
|
||||
@Column(name = "status", nullable = false, length = 20)
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 진행률 (0-100, IN_PROGRESS 상태일 때 사용)
|
||||
*/
|
||||
@Column(name = "progress")
|
||||
private Integer progress;
|
||||
|
||||
/**
|
||||
* 채널별 배포 ID (우리동네TV, 지니TV 등)
|
||||
*/
|
||||
@Column(name = "distribution_id", length = 100)
|
||||
private String distributionId;
|
||||
|
||||
/**
|
||||
* 예상 노출 수 (우리동네TV, 지니TV)
|
||||
*/
|
||||
@Column(name = "estimated_views")
|
||||
private Integer estimatedViews;
|
||||
|
||||
/**
|
||||
* 업데이트 완료 시각 (링고비즈)
|
||||
*/
|
||||
@Column(name = "update_timestamp")
|
||||
private LocalDateTime updateTimestamp;
|
||||
|
||||
/**
|
||||
* 광고 ID (지니TV)
|
||||
*/
|
||||
@Column(name = "ad_id", length = 100)
|
||||
private String adId;
|
||||
|
||||
/**
|
||||
* 노출 스케줄 (지니TV) - JSON 형태로 저장
|
||||
*/
|
||||
@Column(name = "impression_schedule", columnDefinition = "TEXT")
|
||||
private String impressionSchedule;
|
||||
|
||||
/**
|
||||
* 게시물 URL (Instagram, Naver Blog)
|
||||
*/
|
||||
@Column(name = "post_url", columnDefinition = "TEXT")
|
||||
private String postUrl;
|
||||
|
||||
/**
|
||||
* 게시물 ID (Instagram)
|
||||
*/
|
||||
@Column(name = "post_id", length = 100)
|
||||
private String postId;
|
||||
|
||||
/**
|
||||
* 메시지 ID (Kakao Channel)
|
||||
*/
|
||||
@Column(name = "message_id", length = 100)
|
||||
private String messageId;
|
||||
|
||||
/**
|
||||
* 완료 시각
|
||||
*/
|
||||
@Column(name = "completed_at")
|
||||
private LocalDateTime completedAt;
|
||||
|
||||
/**
|
||||
* 오류 메시지 (실패 시)
|
||||
*/
|
||||
@Column(name = "error_message", columnDefinition = "TEXT")
|
||||
private String errorMessage;
|
||||
|
||||
/**
|
||||
* 재시도 횟수
|
||||
*/
|
||||
@Column(name = "retries")
|
||||
@Builder.Default
|
||||
private Integer retries = 0;
|
||||
|
||||
/**
|
||||
* 마지막 재시도 시각
|
||||
*/
|
||||
@Column(name = "last_retry_at")
|
||||
private LocalDateTime lastRetryAt;
|
||||
|
||||
/**
|
||||
* 생성 시각
|
||||
*/
|
||||
@Column(name = "created_at", nullable = false, updatable = false)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 수정 시각
|
||||
*/
|
||||
@Column(name = "updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
/**
|
||||
* 생성 시 자동으로 생성 시각 설정
|
||||
*/
|
||||
@PrePersist
|
||||
protected void onCreate() {
|
||||
createdAt = LocalDateTime.now();
|
||||
updatedAt = LocalDateTime.now();
|
||||
}
|
||||
|
||||
/**
|
||||
* 수정 시 자동으로 수정 시각 설정
|
||||
*/
|
||||
@PreUpdate
|
||||
protected void onUpdate() {
|
||||
updatedAt = LocalDateTime.now();
|
||||
}
|
||||
}
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
package com.kt.distribution.entity;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 배포 상태 엔티티
|
||||
*
|
||||
* 이벤트의 전체 배포 상태 정보를 저장합니다.
|
||||
*
|
||||
* @author Backend Developer
|
||||
* @since 2025-10-24
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "distribution_status", indexes = {
|
||||
@Index(name = "idx_event_id", columnList = "event_id", unique = true)
|
||||
})
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DistributionStatus {
|
||||
|
||||
/**
|
||||
* 배포 상태 ID (Primary Key)
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 이벤트 ID (Unique)
|
||||
*/
|
||||
@Column(name = "event_id", nullable = false, unique = true, length = 100)
|
||||
private String eventId;
|
||||
|
||||
/**
|
||||
* 전체 배포 상태
|
||||
* - PENDING: 대기 중
|
||||
* - IN_PROGRESS: 진행 중
|
||||
* - COMPLETED: 완료
|
||||
* - PARTIAL_FAILURE: 부분 성공
|
||||
* - FAILED: 실패
|
||||
*/
|
||||
@Column(name = "overall_status", nullable = false, length = 20)
|
||||
private String overallStatus;
|
||||
|
||||
/**
|
||||
* 배포 시작 시각
|
||||
*/
|
||||
@Column(name = "started_at")
|
||||
private LocalDateTime startedAt;
|
||||
|
||||
/**
|
||||
* 배포 완료 시각
|
||||
*/
|
||||
@Column(name = "completed_at")
|
||||
private LocalDateTime completedAt;
|
||||
|
||||
/**
|
||||
* 채널별 배포 상태 목록 (1:N 관계)
|
||||
*/
|
||||
@OneToMany(mappedBy = "distributionStatus", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)
|
||||
@Builder.Default
|
||||
private List<ChannelStatusEntity> channels = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 생성 시각
|
||||
*/
|
||||
@Column(name = "created_at", nullable = false, updatable = false)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 수정 시각
|
||||
*/
|
||||
@Column(name = "updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
/**
|
||||
* 생성 시 자동으로 생성 시각 설정
|
||||
*/
|
||||
@PrePersist
|
||||
protected void onCreate() {
|
||||
createdAt = LocalDateTime.now();
|
||||
updatedAt = LocalDateTime.now();
|
||||
}
|
||||
|
||||
/**
|
||||
* 수정 시 자동으로 수정 시각 설정
|
||||
*/
|
||||
@PreUpdate
|
||||
protected void onUpdate() {
|
||||
updatedAt = LocalDateTime.now();
|
||||
}
|
||||
|
||||
/**
|
||||
* 채널 상태 추가 헬퍼 메서드
|
||||
*/
|
||||
public void addChannelStatus(ChannelStatusEntity channelStatus) {
|
||||
channels.add(channelStatus);
|
||||
channelStatus.setDistributionStatus(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* 채널 상태 제거 헬퍼 메서드
|
||||
*/
|
||||
public void removeChannelStatus(ChannelStatusEntity channelStatus) {
|
||||
channels.remove(channelStatus);
|
||||
channelStatus.setDistributionStatus(null);
|
||||
}
|
||||
}
|
||||
+173
@@ -0,0 +1,173 @@
|
||||
package com.kt.distribution.mapper;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.kt.distribution.dto.ChannelStatus;
|
||||
import com.kt.distribution.dto.DistributionStatusResponse;
|
||||
import com.kt.distribution.entity.ChannelStatusEntity;
|
||||
import com.kt.distribution.entity.DistributionStatus;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 배포 상태 Mapper
|
||||
*
|
||||
* Entity와 DTO 간의 변환을 담당합니다.
|
||||
*
|
||||
* @author Backend Developer
|
||||
* @since 2025-10-24
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class DistributionStatusMapper {
|
||||
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
/**
|
||||
* DistributionStatusResponse DTO를 DistributionStatus Entity로 변환
|
||||
*
|
||||
* @param dto DistributionStatusResponse DTO
|
||||
* @return DistributionStatus Entity
|
||||
*/
|
||||
public DistributionStatus toEntity(DistributionStatusResponse dto) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
DistributionStatus entity = DistributionStatus.builder()
|
||||
.eventId(dto.getEventId())
|
||||
.overallStatus(dto.getOverallStatus())
|
||||
.startedAt(dto.getStartedAt())
|
||||
.completedAt(dto.getCompletedAt())
|
||||
.build();
|
||||
|
||||
// 채널 상태 변환 및 추가
|
||||
if (dto.getChannels() != null) {
|
||||
List<ChannelStatusEntity> channelEntities = dto.getChannels().stream()
|
||||
.map(channelDto -> toChannelEntity(channelDto, entity))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
channelEntities.forEach(entity::addChannelStatus);
|
||||
}
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
/**
|
||||
* DistributionStatus Entity를 DistributionStatusResponse DTO로 변환
|
||||
*
|
||||
* @param entity DistributionStatus Entity
|
||||
* @return DistributionStatusResponse DTO
|
||||
*/
|
||||
public DistributionStatusResponse toDto(DistributionStatus entity) {
|
||||
if (entity == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<ChannelStatus> channelDtos = entity.getChannels() != null
|
||||
? entity.getChannels().stream()
|
||||
.map(this::toChannelDto)
|
||||
.collect(Collectors.toList())
|
||||
: Collections.emptyList();
|
||||
|
||||
return DistributionStatusResponse.builder()
|
||||
.eventId(entity.getEventId())
|
||||
.overallStatus(entity.getOverallStatus())
|
||||
.startedAt(entity.getStartedAt())
|
||||
.completedAt(entity.getCompletedAt())
|
||||
.channels(channelDtos)
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* ChannelStatus DTO를 ChannelStatusEntity로 변환
|
||||
*
|
||||
* @param dto ChannelStatus DTO
|
||||
* @param distributionStatus 부모 DistributionStatus Entity
|
||||
* @return ChannelStatusEntity
|
||||
*/
|
||||
private ChannelStatusEntity toChannelEntity(ChannelStatus dto, DistributionStatus distributionStatus) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// impressionSchedule를 JSON 문자열로 변환
|
||||
String impressionScheduleJson = null;
|
||||
if (dto.getImpressionSchedule() != null && !dto.getImpressionSchedule().isEmpty()) {
|
||||
try {
|
||||
impressionScheduleJson = objectMapper.writeValueAsString(dto.getImpressionSchedule());
|
||||
} catch (JsonProcessingException e) {
|
||||
log.error("Failed to serialize impressionSchedule", e);
|
||||
}
|
||||
}
|
||||
|
||||
return ChannelStatusEntity.builder()
|
||||
.distributionStatus(distributionStatus)
|
||||
.channel(dto.getChannel())
|
||||
.status(dto.getStatus())
|
||||
.progress(dto.getProgress())
|
||||
.distributionId(dto.getDistributionId())
|
||||
.estimatedViews(dto.getEstimatedViews())
|
||||
.updateTimestamp(dto.getUpdateTimestamp())
|
||||
.adId(dto.getAdId())
|
||||
.impressionSchedule(impressionScheduleJson)
|
||||
.postUrl(dto.getPostUrl())
|
||||
.postId(dto.getPostId())
|
||||
.messageId(dto.getMessageId())
|
||||
.completedAt(dto.getCompletedAt())
|
||||
.errorMessage(dto.getErrorMessage())
|
||||
.retries(dto.getRetries())
|
||||
.lastRetryAt(dto.getLastRetryAt())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* ChannelStatusEntity를 ChannelStatus DTO로 변환
|
||||
*
|
||||
* @param entity ChannelStatusEntity
|
||||
* @return ChannelStatus DTO
|
||||
*/
|
||||
private ChannelStatus toChannelDto(ChannelStatusEntity entity) {
|
||||
if (entity == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// JSON 문자열을 List<String>으로 변환
|
||||
List<String> impressionScheduleList = null;
|
||||
if (entity.getImpressionSchedule() != null && !entity.getImpressionSchedule().isEmpty()) {
|
||||
try {
|
||||
impressionScheduleList = objectMapper.readValue(
|
||||
entity.getImpressionSchedule(),
|
||||
new TypeReference<List<String>>() {}
|
||||
);
|
||||
} catch (JsonProcessingException e) {
|
||||
log.error("Failed to deserialize impressionSchedule", e);
|
||||
}
|
||||
}
|
||||
|
||||
return ChannelStatus.builder()
|
||||
.channel(entity.getChannel())
|
||||
.status(entity.getStatus())
|
||||
.progress(entity.getProgress())
|
||||
.distributionId(entity.getDistributionId())
|
||||
.estimatedViews(entity.getEstimatedViews())
|
||||
.updateTimestamp(entity.getUpdateTimestamp())
|
||||
.adId(entity.getAdId())
|
||||
.impressionSchedule(impressionScheduleList)
|
||||
.postUrl(entity.getPostUrl())
|
||||
.postId(entity.getPostId())
|
||||
.messageId(entity.getMessageId())
|
||||
.completedAt(entity.getCompletedAt())
|
||||
.errorMessage(entity.getErrorMessage())
|
||||
.retries(entity.getRetries())
|
||||
.lastRetryAt(entity.getLastRetryAt())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
package com.kt.distribution.repository;
|
||||
|
||||
import com.kt.distribution.entity.DistributionStatus;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 배포 상태 JPA Repository
|
||||
*
|
||||
* 배포 상태를 데이터베이스에 영구 저장하고 조회합니다.
|
||||
*
|
||||
* @author Backend Developer
|
||||
* @since 2025-10-24
|
||||
*/
|
||||
@Repository
|
||||
public interface DistributionStatusJpaRepository extends JpaRepository<DistributionStatus, Long> {
|
||||
|
||||
/**
|
||||
* 이벤트 ID로 배포 상태 조회
|
||||
*
|
||||
* @param eventId 이벤트 ID
|
||||
* @return 배포 상태 (없으면 Optional.empty())
|
||||
*/
|
||||
Optional<DistributionStatus> findByEventId(String eventId);
|
||||
|
||||
/**
|
||||
* 이벤트 ID로 배포 상태 조회 (채널 상태 Fetch Join)
|
||||
*
|
||||
* @param eventId 이벤트 ID
|
||||
* @return 배포 상태 (채널 상태 포함, 없으면 Optional.empty())
|
||||
*/
|
||||
@Query("SELECT d FROM DistributionStatus d LEFT JOIN FETCH d.channels WHERE d.eventId = :eventId")
|
||||
Optional<DistributionStatus> findByEventIdWithChannels(@Param("eventId") String eventId);
|
||||
|
||||
/**
|
||||
* 이벤트 ID로 배포 상태 존재 여부 확인
|
||||
*
|
||||
* @param eventId 이벤트 ID
|
||||
* @return 존재 여부
|
||||
*/
|
||||
boolean existsByEventId(String eventId);
|
||||
|
||||
/**
|
||||
* 이벤트 ID로 배포 상태 삭제
|
||||
*
|
||||
* @param eventId 이벤트 ID
|
||||
*/
|
||||
void deleteByEventId(String eventId);
|
||||
}
|
||||
+46
-14
@@ -1,48 +1,78 @@
|
||||
package com.kt.distribution.repository;
|
||||
|
||||
import com.kt.distribution.dto.DistributionStatusResponse;
|
||||
import com.kt.distribution.entity.DistributionStatus;
|
||||
import com.kt.distribution.mapper.DistributionStatusMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* 배포 상태 저장소
|
||||
*
|
||||
* 메모리 기반으로 배포 상태를 관리합니다.
|
||||
* 실제 운영 환경에서는 Redis 또는 데이터베이스를 사용하여 영구 저장하는 것을 권장합니다.
|
||||
* PostgreSQL 데이터베이스를 사용하여 배포 상태를 영구 저장합니다.
|
||||
*
|
||||
* @author Backend Developer
|
||||
* @since 2025-10-24
|
||||
*/
|
||||
@Slf4j
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class DistributionStatusRepository {
|
||||
|
||||
/**
|
||||
* 이벤트 ID를 키로 배포 상태를 저장하는 메모리 저장소
|
||||
*/
|
||||
private final Map<String, DistributionStatusResponse> distributionStatuses = new ConcurrentHashMap<>();
|
||||
private final DistributionStatusJpaRepository jpaRepository;
|
||||
private final DistributionStatusMapper mapper;
|
||||
|
||||
/**
|
||||
* 배포 상태 저장
|
||||
*
|
||||
* @param eventId 이벤트 ID
|
||||
* @param status 배포 상태
|
||||
* @param status 배포 상태 DTO
|
||||
*/
|
||||
@Transactional
|
||||
public void save(String eventId, DistributionStatusResponse status) {
|
||||
log.debug("Saving distribution status: eventId={}, overallStatus={}", eventId, status.getOverallStatus());
|
||||
distributionStatuses.put(eventId, status);
|
||||
|
||||
// 기존 데이터가 있으면 업데이트, 없으면 새로 생성
|
||||
Optional<DistributionStatus> existingStatus = jpaRepository.findByEventIdWithChannels(eventId);
|
||||
|
||||
if (existingStatus.isPresent()) {
|
||||
// 기존 데이터 업데이트
|
||||
DistributionStatus entity = existingStatus.get();
|
||||
entity.setOverallStatus(status.getOverallStatus());
|
||||
entity.setStartedAt(status.getStartedAt());
|
||||
entity.setCompletedAt(status.getCompletedAt());
|
||||
|
||||
// 기존 채널 상태 모두 삭제 후 새로 추가
|
||||
entity.getChannels().clear();
|
||||
|
||||
DistributionStatus newEntity = mapper.toEntity(status);
|
||||
if (newEntity.getChannels() != null) {
|
||||
newEntity.getChannels().forEach(entity::addChannelStatus);
|
||||
}
|
||||
|
||||
jpaRepository.save(entity);
|
||||
} else {
|
||||
// 새로 생성
|
||||
DistributionStatus entity = mapper.toEntity(status);
|
||||
jpaRepository.save(entity);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 배포 상태 조회
|
||||
*
|
||||
* @param eventId 이벤트 ID
|
||||
* @return 배포 상태 (없으면 Optional.empty())
|
||||
* @return 배포 상태 DTO (없으면 Optional.empty())
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public Optional<DistributionStatusResponse> findByEventId(String eventId) {
|
||||
log.debug("Finding distribution status: eventId={}", eventId);
|
||||
return Optional.ofNullable(distributionStatuses.get(eventId));
|
||||
return jpaRepository.findByEventIdWithChannels(eventId)
|
||||
.map(mapper::toDto);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,16 +80,18 @@ public class DistributionStatusRepository {
|
||||
*
|
||||
* @param eventId 이벤트 ID
|
||||
*/
|
||||
@Transactional
|
||||
public void delete(String eventId) {
|
||||
log.debug("Deleting distribution status: eventId={}", eventId);
|
||||
distributionStatuses.remove(eventId);
|
||||
jpaRepository.deleteByEventId(eventId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 모든 배포 상태 삭제 (테스트용)
|
||||
*/
|
||||
@Transactional
|
||||
public void deleteAll() {
|
||||
log.debug("Deleting all distribution statuses");
|
||||
distributionStatuses.clear();
|
||||
jpaRepository.deleteAll();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user