Remove dead legacy Video model cluster
Video/VideoRepository/VideoService/VideoController (table 'videos', /api/v1/videos) were a legacy read-model with zero cross-package references. The active flows use ChannelVideo (collection→rework→publish) and YtVideo (Opal pipeline). Verified by clean compileJava.
This commit is contained in:
parent
da04dbe15c
commit
e862498f96
8
.claude/settings.local.json
Normal file
8
.claude/settings.local.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"permissions": {
|
||||
"allow": [
|
||||
"PowerShell($env:JAVA_HOME=\"D:\\\\Development\\\\app\\\\JDK\\\\jdk-21.0.5\"; .\\\\gradlew.bat compileJava --console=plain 2>&1 | Select-Object -Last 15)",
|
||||
"PowerShell($env:JAVA_HOME=\"D:\\\\Development\\\\app\\\\JDK\\\\jdk-21.0.5\"; .\\\\gradlew.bat clean compileJava --console=plain 2>&1 | Select-Object -Last 20)"
|
||||
]
|
||||
}
|
||||
}
|
||||
@ -1,64 +0,0 @@
|
||||
package com.hlab.yanalyst.domain.video;
|
||||
|
||||
import com.hlab.yanalyst.domain.channel.Channel;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.data.annotation.CreatedDate;
|
||||
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Entity
|
||||
@Table(name = "videos")
|
||||
@Getter
|
||||
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
||||
@EntityListeners(AuditingEntityListener.class)
|
||||
public class Video {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Column(nullable = false, unique = true)
|
||||
private String videoId; // YouTube Video ID
|
||||
|
||||
@Column(nullable = false)
|
||||
private String title;
|
||||
|
||||
@Column(columnDefinition = "TEXT")
|
||||
private String description;
|
||||
|
||||
private String thumbnailUrl;
|
||||
|
||||
private String videoUrl;
|
||||
|
||||
private Long viewCount;
|
||||
|
||||
private Long likeCount;
|
||||
|
||||
private LocalDateTime publishedAt;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "channel_id")
|
||||
private Channel channel;
|
||||
|
||||
@CreatedDate
|
||||
@Column(updatable = false)
|
||||
private LocalDateTime collectedAt;
|
||||
|
||||
@Builder
|
||||
public Video(String videoId, String title, String description, String thumbnailUrl, String videoUrl, Long viewCount, Long likeCount, LocalDateTime publishedAt, Channel channel) {
|
||||
this.videoId = videoId;
|
||||
this.title = title;
|
||||
this.description = description;
|
||||
this.thumbnailUrl = thumbnailUrl;
|
||||
this.videoUrl = videoUrl;
|
||||
this.viewCount = viewCount;
|
||||
this.likeCount = likeCount;
|
||||
this.publishedAt = publishedAt;
|
||||
this.channel = channel;
|
||||
}
|
||||
}
|
||||
@ -1,34 +0,0 @@
|
||||
package com.hlab.yanalyst.domain.video;
|
||||
|
||||
import com.hlab.yanalyst.global.common.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/videos")
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "Video API", description = "Video Management API")
|
||||
public class VideoController {
|
||||
|
||||
private final VideoService videoService;
|
||||
|
||||
@GetMapping
|
||||
@Operation(summary = "Get all videos", description = "Retrieve a paginated list of videos.")
|
||||
public ApiResponse<Page<Video>> getVideos(@PageableDefault(size = 20) Pageable pageable) {
|
||||
return ApiResponse.ok(videoService.getAllVideos(pageable));
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@Operation(summary = "Get video details", description = "Retrieve detailed information of a specific video.")
|
||||
public ApiResponse<Video> getVideo(@PathVariable Long id) {
|
||||
return ApiResponse.ok(videoService.getVideo(id));
|
||||
}
|
||||
}
|
||||
@ -1,13 +0,0 @@
|
||||
package com.hlab.yanalyst.domain.video;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public interface VideoRepository extends JpaRepository<Video, Long> {
|
||||
Optional<Video> findByVideoId(String videoId);
|
||||
boolean existsByVideoId(String videoId);
|
||||
Page<Video> findAllByOrderByPublishedAtDesc(Pageable pageable);
|
||||
}
|
||||
@ -1,26 +0,0 @@
|
||||
package com.hlab.yanalyst.domain.video;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Transactional(readOnly = true)
|
||||
public class VideoService {
|
||||
|
||||
private final VideoRepository videoRepository;
|
||||
|
||||
public Page<Video> getAllVideos(Pageable pageable) {
|
||||
return videoRepository.findAllByOrderByPublishedAtDesc(pageable);
|
||||
}
|
||||
|
||||
public Video getVideo(Long id) {
|
||||
return videoRepository.findById(id)
|
||||
.orElseThrow(() -> new IllegalArgumentException("Video not found with id: " + id));
|
||||
}
|
||||
|
||||
// Additional methods for create/update will be added as needed
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user