diff --git a/Directory.Packages.props b/Directory.Packages.props index 5430aaa0..121298a1 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -62,7 +62,7 @@ - + diff --git a/src/DevBetterWeb.Core/Services/CreateVideoService.cs b/src/DevBetterWeb.Core/Services/CreateVideoService.cs index 3fd70c40..e9b255d2 100644 --- a/src/DevBetterWeb.Core/Services/CreateVideoService.cs +++ b/src/DevBetterWeb.Core/Services/CreateVideoService.cs @@ -12,6 +12,8 @@ using NimblePros.Vimeo.Models; using NimblePros.Vimeo.VideoServices; using NimblePros.Vimeo.VideoTusService; +using static DevBetterWeb.Core.Entities.Member; +using static Microsoft.ApplicationInsights.MetricDimensionNames.TelemetryContext; namespace DevBetterWeb.Core.Services; public class CreateVideoService : ICreateVideoService @@ -20,13 +22,15 @@ public class CreateVideoService : ICreateVideoService private readonly IUploadVideoTusService _uploadVideoTusService; private readonly IRepository _repositoryArchiveVideo; private readonly IAddCreatedVideoToFolderService _addCreatedVideoToFolderService; + private readonly IAppLogger _logger; - public CreateVideoService(GetVideoService getVideoService, IUploadVideoTusService uploadVideoTusService, IRepository repositoryArchiveVideo, IAddCreatedVideoToFolderService addCreatedVideoToFolderService) + public CreateVideoService(IAppLogger logger, GetVideoService getVideoService, IUploadVideoTusService uploadVideoTusService, IRepository repositoryArchiveVideo, IAddCreatedVideoToFolderService addCreatedVideoToFolderService) { _getVideoService = getVideoService; _uploadVideoTusService = uploadVideoTusService; _repositoryArchiveVideo = repositoryArchiveVideo; _addCreatedVideoToFolderService = addCreatedVideoToFolderService; + _logger = logger; } public async Task StartAsync(string videoName, long videoSize, string domain, CancellationToken cancellationToken = default) @@ -40,9 +44,13 @@ public async Task StartAsync(string videoName, long videoSize, string do EmbedDomains = new List { domain }, HideFromVimeo = true }; - var sessionId = await _uploadVideoTusService.StartAsync(uploadVideoRequest, cancellationToken); + var responseSessionId = await _uploadVideoTusService.StartAsync(uploadVideoRequest, cancellationToken); + if (!responseSessionId.IsSuccess || string.IsNullOrEmpty(responseSessionId.Data)) + { + _logger.LogError(new Exception(responseSessionId.Exception.Message), responseSessionId.Json); + } - return sessionId; + return responseSessionId.Data; } public async Task UploadChunkAsync(bool isBaseFolder, string sessionId, string chunk, string? description, long? folderId, CancellationToken cancellationToken = default)