File size: 760 Bytes
8fb6238
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
using ClipForge.Core.Entities;
using ClipForge.Core.Interfaces;
using ClipForge.Infrastructure.Data;
using Microsoft.EntityFrameworkCore;

namespace ClipForge.Infrastructure.Repositories;

public class VideoAssetRepository : BaseRepository<VideoAsset>, IVideoAssetRepository
{
    public VideoAssetRepository(AppDbContext context) : base(context) { }

    public async Task<IReadOnlyList<VideoAsset>> GetByStatusAsync(string status, CancellationToken ct = default)
        => await _dbSet.Where(v => v.Status == status).OrderByDescending(v => v.CreatedAt).ToListAsync(ct);

    public async Task<VideoAsset?> GetByScriptIdAsync(Guid scriptId, CancellationToken ct = default)
        => await _dbSet.FirstOrDefaultAsync(v => v.VideoScriptId == scriptId, ct);
}