feature: Embed Frame Player
This commit is contained in:
@@ -12,6 +12,7 @@ namespace DeepDrftData;
|
||||
public interface ITrackService
|
||||
{
|
||||
Task<ResultContainer<TrackDto?>> GetById(long id);
|
||||
Task<ResultContainer<TrackDto?>> GetByEntryKey(string entryKey);
|
||||
Task<ResultContainer<List<TrackDto>>> GetAll();
|
||||
Task<ResultContainer<PagedResult<TrackDto>>> GetPaged(int pageNumber, int pageSize, string? sortColumn, bool sortDescending, CancellationToken cancellationToken = default);
|
||||
Task<ResultContainer<TrackDto>> Create(TrackDto newTrack);
|
||||
|
||||
@@ -2,20 +2,29 @@ using Data.Data.Repositories;
|
||||
using Data.Errors;
|
||||
using DeepDrftData.Data;
|
||||
using DeepDrftModels.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace DeepDrftData.Repositories;
|
||||
|
||||
public class TrackRepository : Repository<DeepDrftContext, TrackEntity>
|
||||
{
|
||||
private readonly DeepDrftContext _context;
|
||||
|
||||
public TrackRepository(
|
||||
DeepDrftContext context,
|
||||
ILogger<Repository<DeepDrftContext, TrackEntity>> logger,
|
||||
IDbExceptionClassifier? classifier = null)
|
||||
: base(context, logger, classifier: classifier)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
// Lookup by vault entry key. The base Repository<> only exposes id-based queries, so this
|
||||
// queries the DbSet directly. Returns null on miss (service wraps in ResultContainer).
|
||||
public async Task<TrackEntity?> GetByEntryKeyAsync(string entryKey)
|
||||
=> await _context.Tracks.FirstOrDefaultAsync(t => t.EntryKey == entryKey);
|
||||
|
||||
protected override void UpdateEntity(TrackEntity target, TrackEntity source)
|
||||
{
|
||||
base.UpdateEntity(target, source); // copies CreatedAt, UpdatedAt, IsDeleted
|
||||
|
||||
@@ -46,6 +46,22 @@ public class TrackManager
|
||||
}
|
||||
}
|
||||
|
||||
// Lookup by vault entry key. No base-name conflict (unlike GetById), so this is a plain
|
||||
// public method. Mirrors the nullable-on-miss shape of ITrackService.GetById.
|
||||
public async Task<ResultContainer<TrackDto?>> GetByEntryKey(string entryKey)
|
||||
{
|
||||
try
|
||||
{
|
||||
var entity = await Repository.GetByEntryKeyAsync(entryKey);
|
||||
return ResultContainer<TrackDto?>.CreatePassResult(
|
||||
entity is null ? null : TrackConverter.Convert(entity));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return ResultContainer<TrackDto?>.CreateFailResult(e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ResultContainer<List<TrackDto>>> GetAll()
|
||||
{
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user