Add metadata management for shows: implement metadata retrieval, application, and updates in the API and UI. Enhance Show and ShowDto models to include metadata fields, and update the database schema accordingly. Introduce new endpoints for metadata operations and integrate metadata display in the ShowDetail component.
This commit is contained in:
+25
@@ -0,0 +1,25 @@
|
||||
using LiteCqrs;
|
||||
using TeleWave.Application.Common.Interfaces;
|
||||
using TeleWave.Application.Common.Models;
|
||||
|
||||
namespace TeleWave.Application.Metadata.SearchShows;
|
||||
|
||||
public sealed class SearchShowMetadataQueryHandler(IMetadataProviderResolver resolver)
|
||||
: IQueryHandler<SearchShowMetadataQuery, Result<IReadOnlyList<MetadataCandidate>>>
|
||||
{
|
||||
public async Task<Result<IReadOnlyList<MetadataCandidate>>> Handle(
|
||||
SearchShowMetadataQuery query,
|
||||
CancellationToken cancellationToken
|
||||
)
|
||||
{
|
||||
var provider = resolver.Resolve(query.Provider);
|
||||
if (provider is null)
|
||||
return Result.Failure<IReadOnlyList<MetadataCandidate>>(MetadataErrors.ProviderNotAvailable);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(query.Query))
|
||||
return Result.Success<IReadOnlyList<MetadataCandidate>>([]);
|
||||
|
||||
var results = await provider.SearchShowsAsync(query.Query, cancellationToken);
|
||||
return Result.Success(results);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user