mirror of
https://github.com/fergalmoran/podnoms.git
synced 2025-12-28 04:08:45 +00:00
Re-scaffold db
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
using System.Threading.Tasks;
|
||||
using AutoMapper;
|
||||
using Hangfire;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PodNoms.Api.Models;
|
||||
using PodNoms.Api.Models.ViewModels;
|
||||
using PodNoms.Api.Persistence;
|
||||
using PodNoms.Api.Services.Jobs;
|
||||
|
||||
namespace PodNoms.Api.Controllers {
|
||||
[Route("[controller]")]
|
||||
@@ -26,7 +28,7 @@ namespace PodNoms.Api.Controllers {
|
||||
|
||||
[HttpPost]
|
||||
public async Task<ActionResult<Playlist>> Post([FromBody] PodcastEntryViewModel entry) {
|
||||
var podcast = await _podcastRepository.GetAsync(entry.PodcastId);
|
||||
var podcast = await _podcastRepository.GetAsync(entry.PodcastId);
|
||||
if (podcast != null) {
|
||||
var playlist = new Playlist() {
|
||||
Podcast = podcast,
|
||||
@@ -34,6 +36,7 @@ namespace PodNoms.Api.Controllers {
|
||||
};
|
||||
_playlistRepository.AddOrUpdate(playlist);
|
||||
await _unitOfWork.CompleteAsync();
|
||||
BackgroundJob.Enqueue<ProcessPlaylistsJob>(job => job.Execute(playlist.Id));
|
||||
return Ok(playlist);
|
||||
}
|
||||
return NotFound();
|
||||
|
||||
Reference in New Issue
Block a user