mirror of
https://github.com/fergalmoran/podnoms.git
synced 2025-12-22 09:18:08 +00:00
Service worker push working
This commit is contained in:
@@ -12,13 +12,14 @@ using PodNoms.Api.Models;
|
||||
using PodNoms.Api.Models.ViewModels;
|
||||
using PodNoms.Api.Persistence;
|
||||
using PodNoms.Api.Services;
|
||||
using PodNoms.Api.Services.Jobs;
|
||||
using PodNoms.Api.Services.Processor;
|
||||
using PodNoms.Api.Services.Storage;
|
||||
|
||||
namespace PodNoms.Api.Controllers {
|
||||
|
||||
[Route("[controller]")]
|
||||
public class EntryController : Controller {
|
||||
public class EntryController : AuthController {
|
||||
private readonly IPodcastRepository _podcastRepository;
|
||||
private readonly IEntryRepository _repository;
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
@@ -29,10 +30,11 @@ namespace PodNoms.Api.Controllers {
|
||||
private readonly StorageSettings _storageSettings;
|
||||
|
||||
public EntryController(IEntryRepository repository,
|
||||
IUserRepository userRepository,
|
||||
IPodcastRepository podcastRepository,
|
||||
IUnitOfWork unitOfWork, IMapper mapper, IOptions<StorageSettings> storageSettings,
|
||||
IOptions<AudioFileStorageSettings> audioFileStorageSettings,
|
||||
IUrlProcessService processor, ILoggerFactory logger) {
|
||||
IUrlProcessService processor, ILoggerFactory logger) : base(userRepository) {
|
||||
this._logger = logger.CreateLogger<EntryController>();
|
||||
this._podcastRepository = podcastRepository;
|
||||
this._repository = repository;
|
||||
@@ -47,8 +49,11 @@ namespace PodNoms.Api.Controllers {
|
||||
try {
|
||||
var extractJobId = BackgroundJob.Enqueue<IUrlProcessService>(
|
||||
service => service.DownloadAudio(entry.Id));
|
||||
var upload = BackgroundJob.ContinueWith<IAudioUploadProcessService>(
|
||||
var uploadJobId = BackgroundJob.ContinueWith<IAudioUploadProcessService>(
|
||||
extractJobId, service => service.UploadAudio(entry.Id, entry.AudioUrl));
|
||||
var notify = BackgroundJob.ContinueWith<INotifyJobCompleteService>(
|
||||
uploadJobId, service => service.NotifyUser(entry.Podcast.User.Uid, "PodNoms", $"{entry.Title} has finished processing",
|
||||
entry.Podcast.ImageUrl));
|
||||
} catch (InvalidOperationException ex) {
|
||||
_logger.LogError($"Failed submitting job to processor\n{ex.Message}");
|
||||
entry.ProcessingStatus = ProcessingStatus.Failed;
|
||||
|
||||
Reference in New Issue
Block a user