mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-16 02:02:55 -07:00
!wip improved the API's documentation
started on the deny reason
This commit is contained in:
parent
3c1f23ea92
commit
0cc57c3c1f
34 changed files with 168 additions and 44 deletions
|
@ -12,7 +12,7 @@ namespace Ombi.Core.Engine
|
||||||
{
|
{
|
||||||
Task<RequestEngineResult>ApproveAlbum(AlbumRequest request);
|
Task<RequestEngineResult>ApproveAlbum(AlbumRequest request);
|
||||||
Task<RequestEngineResult> ApproveAlbumById(int requestId);
|
Task<RequestEngineResult> ApproveAlbumById(int requestId);
|
||||||
Task<RequestEngineResult> DenyAlbumById(int modelId);
|
Task<RequestEngineResult> DenyAlbumById(int modelId, string reason);
|
||||||
Task<IEnumerable<AlbumRequest>> GetRequests();
|
Task<IEnumerable<AlbumRequest>> GetRequests();
|
||||||
Task<RequestsViewModel<AlbumRequest>> GetRequests(int count, int position, OrderFilterModel orderFilter);
|
Task<RequestsViewModel<AlbumRequest>> GetRequests(int count, int position, OrderFilterModel orderFilter);
|
||||||
Task<int> GetTotal();
|
Task<int> GetTotal();
|
||||||
|
|
|
@ -17,6 +17,6 @@ namespace Ombi.Core.Engine.Interfaces
|
||||||
Task<MovieRequests> UpdateMovieRequest(MovieRequests request);
|
Task<MovieRequests> UpdateMovieRequest(MovieRequests request);
|
||||||
Task<RequestEngineResult> ApproveMovie(MovieRequests request);
|
Task<RequestEngineResult> ApproveMovie(MovieRequests request);
|
||||||
Task<RequestEngineResult> ApproveMovieById(int requestId);
|
Task<RequestEngineResult> ApproveMovieById(int requestId);
|
||||||
Task<RequestEngineResult> DenyMovieById(int modelId);
|
Task<RequestEngineResult> DenyMovieById(int modelId, string denyReason);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -12,7 +12,7 @@ namespace Ombi.Core.Engine.Interfaces
|
||||||
Task RemoveTvRequest(int requestId);
|
Task RemoveTvRequest(int requestId);
|
||||||
Task<TvRequests> GetTvRequest(int requestId);
|
Task<TvRequests> GetTvRequest(int requestId);
|
||||||
Task<RequestEngineResult> RequestTvShow(TvRequestViewModel tv);
|
Task<RequestEngineResult> RequestTvShow(TvRequestViewModel tv);
|
||||||
Task<RequestEngineResult> DenyChildRequest(int requestId);
|
Task<RequestEngineResult> DenyChildRequest(int requestId, string reason);
|
||||||
Task<RequestsViewModel<TvRequests>> GetRequestsLite(int count, int position, OrderFilterModel type);
|
Task<RequestsViewModel<TvRequests>> GetRequestsLite(int count, int position, OrderFilterModel type);
|
||||||
Task<IEnumerable<TvRequests>> SearchTvRequest(string search);
|
Task<IEnumerable<TvRequests>> SearchTvRequest(string search);
|
||||||
Task<TvRequests> UpdateTvRequest(TvRequests request);
|
Task<TvRequests> UpdateTvRequest(TvRequests request);
|
||||||
|
|
|
@ -305,7 +305,7 @@ namespace Ombi.Core.Engine
|
||||||
return await ApproveMovie(request);
|
return await ApproveMovie(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<RequestEngineResult> DenyMovieById(int modelId)
|
public async Task<RequestEngineResult> DenyMovieById(int modelId, string denyReason)
|
||||||
{
|
{
|
||||||
var request = await MovieRepository.Find(modelId);
|
var request = await MovieRepository.Find(modelId);
|
||||||
if (request == null)
|
if (request == null)
|
||||||
|
@ -317,6 +317,7 @@ namespace Ombi.Core.Engine
|
||||||
}
|
}
|
||||||
|
|
||||||
request.Denied = true;
|
request.Denied = true;
|
||||||
|
request.DeniedReason = denyReason;
|
||||||
// We are denying a request
|
// We are denying a request
|
||||||
NotificationHelper.Notify(request, NotificationType.RequestDeclined);
|
NotificationHelper.Notify(request, NotificationType.RequestDeclined);
|
||||||
await MovieRepository.Update(request);
|
await MovieRepository.Update(request);
|
||||||
|
|
|
@ -299,7 +299,7 @@ namespace Ombi.Core.Engine
|
||||||
return await ApproveAlbum(request);
|
return await ApproveAlbum(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<RequestEngineResult> DenyAlbumById(int modelId)
|
public async Task<RequestEngineResult> DenyAlbumById(int modelId, string reason)
|
||||||
{
|
{
|
||||||
var request = await MusicRepository.Find(modelId);
|
var request = await MusicRepository.Find(modelId);
|
||||||
if (request == null)
|
if (request == null)
|
||||||
|
@ -311,6 +311,7 @@ namespace Ombi.Core.Engine
|
||||||
}
|
}
|
||||||
|
|
||||||
request.Denied = true;
|
request.Denied = true;
|
||||||
|
request.DeniedReason = reason;
|
||||||
// We are denying a request
|
// We are denying a request
|
||||||
NotificationHelper.Notify(request, NotificationType.RequestDeclined);
|
NotificationHelper.Notify(request, NotificationType.RequestDeclined);
|
||||||
await MusicRepository.Update(request);
|
await MusicRepository.Update(request);
|
||||||
|
|
|
@ -403,7 +403,7 @@ namespace Ombi.Core.Engine
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<RequestEngineResult> DenyChildRequest(int requestId)
|
public async Task<RequestEngineResult> DenyChildRequest(int requestId, string reason)
|
||||||
{
|
{
|
||||||
var request = await TvRepository.GetChild().FirstOrDefaultAsync(x => x.Id == requestId);
|
var request = await TvRepository.GetChild().FirstOrDefaultAsync(x => x.Id == requestId);
|
||||||
if (request == null)
|
if (request == null)
|
||||||
|
@ -414,6 +414,7 @@ namespace Ombi.Core.Engine
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
request.Denied = true;
|
request.Denied = true;
|
||||||
|
request.DeniedReason = reason;
|
||||||
await TvRepository.UpdateChild(request);
|
await TvRepository.UpdateChild(request);
|
||||||
NotificationHelper.Notify(request, NotificationType.RequestDeclined);
|
NotificationHelper.Notify(request, NotificationType.RequestDeclined);
|
||||||
return new RequestEngineResult
|
return new RequestEngineResult
|
||||||
|
|
|
@ -1,15 +1,11 @@
|
||||||
using System;
|
using System.Linq;
|
||||||
using System.Linq;
|
|
||||||
using System.Linq.Expressions;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Query;
|
|
||||||
using Ombi.Core.Models.Search;
|
using Ombi.Core.Models.Search;
|
||||||
using Ombi.Core.Rule.Interfaces;
|
using Ombi.Core.Rule.Interfaces;
|
||||||
using Ombi.Helpers;
|
using Ombi.Helpers;
|
||||||
using Ombi.Store.Entities;
|
using Ombi.Store.Entities;
|
||||||
using Ombi.Store.Repository;
|
using Ombi.Store.Repository;
|
||||||
using Ombi.Store.Repository.Requests;
|
|
||||||
|
|
||||||
namespace Ombi.Core.Rule.Rules.Search
|
namespace Ombi.Core.Rule.Rules.Search
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
using System;
|
using System.Linq;
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Ombi.Core.Models.Search;
|
using Ombi.Core.Models.Search;
|
||||||
using Ombi.Core.Rule.Interfaces;
|
using Ombi.Core.Rule.Interfaces;
|
||||||
using Ombi.Helpers;
|
using Ombi.Helpers;
|
||||||
using Ombi.Store.Entities;
|
using Ombi.Store.Entities;
|
||||||
using Ombi.Store.Repository;
|
using Ombi.Store.Repository;
|
||||||
using Ombi.Store.Repository.Requests;
|
|
||||||
|
|
||||||
namespace Ombi.Core.Rule.Rules.Search
|
namespace Ombi.Core.Rule.Rules.Search
|
||||||
{
|
{
|
||||||
|
|
|
@ -185,7 +185,6 @@ namespace Ombi.Controllers.External
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the plex servers.
|
/// Gets the plex servers.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="u">The u.</param>
|
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("servers")]
|
[HttpGet("servers")]
|
||||||
[PowerUser]
|
[PowerUser]
|
||||||
|
|
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Web;
|
|
||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
using Hangfire;
|
using Hangfire;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
@ -11,10 +10,8 @@ using Microsoft.AspNetCore.Identity;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Options;
|
|
||||||
using Ombi.Api.Plex;
|
using Ombi.Api.Plex;
|
||||||
using Ombi.Attributes;
|
using Ombi.Attributes;
|
||||||
using Ombi.Config;
|
|
||||||
using Ombi.Core.Authentication;
|
using Ombi.Core.Authentication;
|
||||||
using Ombi.Core.Engine;
|
using Ombi.Core.Engine;
|
||||||
using Ombi.Core.Engine.Interfaces;
|
using Ombi.Core.Engine.Interfaces;
|
||||||
|
@ -45,6 +42,7 @@ namespace Ombi.Controllers
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ApiV1]
|
[ApiV1]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
|
[ApiController]
|
||||||
public class IdentityController : Controller
|
public class IdentityController : Controller
|
||||||
{
|
{
|
||||||
public IdentityController(OmbiUserManager user, IMapper mapper, RoleManager<IdentityRole> rm, IEmailProvider prov,
|
public IdentityController(OmbiUserManager user, IMapper mapper, RoleManager<IdentityRole> rm, IEmailProvider prov,
|
||||||
|
@ -935,6 +933,8 @@ namespace Ombi.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("NotificationPreferences")]
|
[HttpPost("NotificationPreferences")]
|
||||||
|
[ProducesResponseType(404)]
|
||||||
|
[ProducesResponseType(401)]
|
||||||
public async Task<IActionResult> AddUserNotificationPreference([FromBody] List<AddNotificationPreference> preferences)
|
public async Task<IActionResult> AddUserNotificationPreference([FromBody] List<AddNotificationPreference> preferences)
|
||||||
{
|
{
|
||||||
foreach (var pref in preferences)
|
foreach (var pref in preferences)
|
||||||
|
|
|
@ -16,7 +16,8 @@ namespace Ombi.Controllers
|
||||||
{
|
{
|
||||||
[ApiV1]
|
[ApiV1]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
public class ImagesController : Controller
|
[ApiController]
|
||||||
|
public class ImagesController : ControllerBase
|
||||||
{
|
{
|
||||||
public ImagesController(IFanartTvApi fanartTvApi, IApplicationConfigRepository config,
|
public ImagesController(IFanartTvApi fanartTvApi, IApplicationConfigRepository config,
|
||||||
IOptions<LandingPageBackground> options, ICacheService c)
|
IOptions<LandingPageBackground> options, ICacheService c)
|
||||||
|
|
|
@ -23,7 +23,8 @@ namespace Ombi.Controllers
|
||||||
[ApiV1]
|
[ApiV1]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
public class IssuesController : Controller
|
[ApiController]
|
||||||
|
public class IssuesController : ControllerBase
|
||||||
{
|
{
|
||||||
public IssuesController(IRepository<IssueCategory> categories, IRepository<Issues> issues, IRepository<IssueComments> comments,
|
public IssuesController(IRepository<IssueCategory> categories, IRepository<Issues> issues, IRepository<IssueComments> comments,
|
||||||
UserManager<OmbiUser> userManager, INotificationService notify)
|
UserManager<OmbiUser> userManager, INotificationService notify)
|
||||||
|
|
|
@ -16,7 +16,8 @@ namespace Ombi.Controllers
|
||||||
[ApiV1]
|
[ApiV1]
|
||||||
[Admin]
|
[Admin]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
public class JobController : Controller
|
[ApiController]
|
||||||
|
public class JobController : ControllerBase
|
||||||
{
|
{
|
||||||
public JobController(IOmbiAutomaticUpdater updater, IPlexUserImporter userImporter,
|
public JobController(IOmbiAutomaticUpdater updater, IPlexUserImporter userImporter,
|
||||||
ICacheService mem, IEmbyUserImporter embyImporter, IPlexContentSync plexContentSync,
|
ICacheService mem, IEmbyUserImporter embyImporter, IPlexContentSync plexContentSync,
|
||||||
|
|
|
@ -14,7 +14,8 @@ namespace Ombi.Controllers
|
||||||
[ApiV1]
|
[ApiV1]
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
public class LandingPageController
|
[ApiController]
|
||||||
|
public class LandingPageController : ControllerBase
|
||||||
{
|
{
|
||||||
public LandingPageController(ISettingsService<PlexSettings> plex, ISettingsService<EmbySettings> emby,
|
public LandingPageController(ISettingsService<PlexSettings> plex, ISettingsService<EmbySettings> emby,
|
||||||
IPlexApi plexApi, IEmbyApi embyApi)
|
IPlexApi plexApi, IEmbyApi embyApi)
|
||||||
|
|
|
@ -9,7 +9,8 @@ namespace Ombi.Controllers
|
||||||
[Authorize]
|
[Authorize]
|
||||||
[ApiV1]
|
[ApiV1]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
public class LoggingController : Controller
|
[ApiController]
|
||||||
|
public class LoggingController : ControllerBase
|
||||||
{
|
{
|
||||||
public LoggingController(ILogger logger)
|
public LoggingController(ILogger logger)
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,7 +17,8 @@ namespace Ombi.Controllers
|
||||||
[ApiV1]
|
[ApiV1]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
public class MobileController : Controller
|
[ApiController]
|
||||||
|
public class MobileController : ControllerBase
|
||||||
{
|
{
|
||||||
public MobileController(IRepository<NotificationUserId> notification, OmbiUserManager user)
|
public MobileController(IRepository<NotificationUserId> notification, OmbiUserManager user)
|
||||||
{
|
{
|
||||||
|
@ -30,6 +31,8 @@ namespace Ombi.Controllers
|
||||||
|
|
||||||
[HttpPost("Notification")]
|
[HttpPost("Notification")]
|
||||||
[ApiExplorerSettings(IgnoreApi = true)]
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
|
[ProducesResponseType(400)]
|
||||||
|
[ProducesResponseType(200)]
|
||||||
public async Task<IActionResult> AddNotitficationId([FromBody] NotificationIdBody body)
|
public async Task<IActionResult> AddNotitficationId([FromBody] NotificationIdBody body)
|
||||||
{
|
{
|
||||||
if (body?.PlayerId.HasValue() ?? false)
|
if (body?.PlayerId.HasValue() ?? false)
|
||||||
|
|
|
@ -17,7 +17,8 @@ namespace Ombi.Controllers
|
||||||
[Authorize]
|
[Authorize]
|
||||||
[Route("api/v1/request/music")]
|
[Route("api/v1/request/music")]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
public class MusicRequestController : Controller
|
[ApiController]
|
||||||
|
public class MusicRequestController : ControllerBase
|
||||||
{
|
{
|
||||||
public MusicRequestController(IMusicRequestEngine engine, IVoteEngine voteEngine, ILogger<MusicRequestController> log)
|
public MusicRequestController(IMusicRequestEngine engine, IVoteEngine voteEngine, ILogger<MusicRequestController> log)
|
||||||
{
|
{
|
||||||
|
@ -154,9 +155,9 @@ namespace Ombi.Controllers
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPut("deny")]
|
[HttpPut("deny")]
|
||||||
[PowerUser]
|
[PowerUser]
|
||||||
public async Task<RequestEngineResult> Deny([FromBody] AlbumUpdateModel model)
|
public async Task<RequestEngineResult> Deny([FromBody] DenyAlbumModel model)
|
||||||
{
|
{
|
||||||
return await _engine.DenyAlbumById(model.Id);
|
return await _engine.DenyAlbumById(model.Id, model.Reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -36,7 +36,8 @@ namespace Ombi.Controllers
|
||||||
[Admin]
|
[Admin]
|
||||||
[ApiV1]
|
[ApiV1]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
public class NotificationsController : Controller
|
[ApiController]
|
||||||
|
public class NotificationsController : ControllerBase
|
||||||
{
|
{
|
||||||
public NotificationsController(IMassEmailSender sender)
|
public NotificationsController(IMassEmailSender sender)
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,6 +20,7 @@ namespace Ombi.Controllers
|
||||||
[ApiExplorerSettings(IgnoreApi = true)]
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
[ApiV1]
|
[ApiV1]
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
|
[ApiController]
|
||||||
public class PlexOAuthController : Controller
|
public class PlexOAuthController : Controller
|
||||||
{
|
{
|
||||||
public PlexOAuthController(IPlexOAuthManager manager, IPlexApi plexApi, ISettingsService<PlexSettings> plexSettings,
|
public PlexOAuthController(IPlexOAuthManager manager, IPlexApi plexApi, ISettingsService<PlexSettings> plexSettings,
|
||||||
|
|
|
@ -12,7 +12,8 @@ namespace Ombi.Controllers
|
||||||
[ApiV1]
|
[ApiV1]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class RecentlyAddedController : Controller
|
[ApiController]
|
||||||
|
public class RecentlyAddedController : ControllerBase
|
||||||
{
|
{
|
||||||
public RecentlyAddedController(IRecentlyAddedEngine engine)
|
public RecentlyAddedController(IRecentlyAddedEngine engine)
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,7 +20,8 @@ namespace Ombi.Controllers
|
||||||
[Authorize]
|
[Authorize]
|
||||||
[ApiV1]
|
[ApiV1]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
public class RequestController : Controller
|
[ApiController]
|
||||||
|
public class RequestController : ControllerBase
|
||||||
{
|
{
|
||||||
public RequestController(IMovieRequestEngine engine, ITvRequestEngine tvRequestEngine, IVoteEngine vote,
|
public RequestController(IMovieRequestEngine engine, ITvRequestEngine tvRequestEngine, IVoteEngine vote,
|
||||||
ILogger<RequestController> log)
|
ILogger<RequestController> log)
|
||||||
|
@ -118,9 +119,8 @@ namespace Ombi.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Deletes the specified movie request.
|
/// Deletes the all movie request.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="requestId">The request identifier.</param>
|
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpDelete("movie/all")]
|
[HttpDelete("movie/all")]
|
||||||
[PowerUser]
|
[PowerUser]
|
||||||
|
@ -184,9 +184,9 @@ namespace Ombi.Controllers
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPut("movie/deny")]
|
[HttpPut("movie/deny")]
|
||||||
[PowerUser]
|
[PowerUser]
|
||||||
public async Task<RequestEngineResult> DenyMovie([FromBody] MovieUpdateModel model)
|
public async Task<RequestEngineResult> DenyMovie([FromBody] DenyMovieModel model)
|
||||||
{
|
{
|
||||||
return await MovieRequestEngine.DenyMovieById(model.Id);
|
return await MovieRequestEngine.DenyMovieById(model.Id, model.Reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -372,9 +372,9 @@ namespace Ombi.Controllers
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPut("tv/deny")]
|
[HttpPut("tv/deny")]
|
||||||
[PowerUser]
|
[PowerUser]
|
||||||
public async Task<RequestEngineResult> DenyChild([FromBody] TvUpdateModel model)
|
public async Task<RequestEngineResult> DenyChild([FromBody] DenyTvModel model)
|
||||||
{
|
{
|
||||||
return await TvRequestEngine.DenyChildRequest(model.Id);
|
return await TvRequestEngine.DenyChildRequest(model.Id, model.Reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -16,6 +16,7 @@ namespace Ombi.Controllers
|
||||||
[ApiV1]
|
[ApiV1]
|
||||||
[Admin]
|
[Admin]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
|
[ApiController]
|
||||||
public class RequestRetryController : Controller
|
public class RequestRetryController : Controller
|
||||||
{
|
{
|
||||||
public RequestRetryController(IRepository<RequestQueue> requestQueue, IMovieRequestRepository movieRepo,
|
public RequestRetryController(IRepository<RequestQueue> requestQueue, IMovieRequestRepository movieRepo,
|
||||||
|
|
|
@ -17,7 +17,8 @@ namespace Ombi.Controllers
|
||||||
[Authorize]
|
[Authorize]
|
||||||
[ApiV1]
|
[ApiV1]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
public class SearchController : Controller
|
[ApiController]
|
||||||
|
public class SearchController : ControllerBase
|
||||||
{
|
{
|
||||||
public SearchController(IMovieEngine movie, ITvSearchEngine tvEngine, ILogger<SearchController> logger, IMusicSearchEngine music)
|
public SearchController(IMovieEngine movie, ITvSearchEngine tvEngine, ILogger<SearchController> logger, IMusicSearchEngine music)
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,7 +37,8 @@ namespace Ombi.Controllers
|
||||||
[Admin]
|
[Admin]
|
||||||
[ApiV1]
|
[ApiV1]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
public class SettingsController : Controller
|
[ApiController]
|
||||||
|
public class SettingsController : ControllerBase
|
||||||
{
|
{
|
||||||
public SettingsController(ISettingsResolver resolver,
|
public SettingsController(ISettingsResolver resolver,
|
||||||
IMapper mapper,
|
IMapper mapper,
|
||||||
|
|
|
@ -10,7 +10,8 @@ namespace Ombi.Controllers
|
||||||
[Admin]
|
[Admin]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
public class StatsController : Controller
|
[ApiController]
|
||||||
|
public class StatsController : ControllerBase
|
||||||
{
|
{
|
||||||
public StatsController(IUserStatsEngine eng)
|
public StatsController(IUserStatsEngine eng)
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,7 +37,8 @@ namespace Ombi.Controllers
|
||||||
{
|
{
|
||||||
[ApiV1]
|
[ApiV1]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
public class StatusController : Controller
|
[ApiController]
|
||||||
|
public class StatusController : ControllerBase
|
||||||
{
|
{
|
||||||
public StatusController(ISettingsService<OmbiSettings> ombi)
|
public StatusController(ISettingsService<OmbiSettings> ombi)
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,7 +22,8 @@ namespace Ombi.Controllers
|
||||||
{
|
{
|
||||||
[ApiV1]
|
[ApiV1]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
public class TokenController : Controller
|
[ApiController]
|
||||||
|
public class TokenController : ControllerBase
|
||||||
{
|
{
|
||||||
public TokenController(OmbiUserManager um, IOptions<TokenAuthentication> ta, IAuditRepository audit, ITokenRepository token,
|
public TokenController(OmbiUserManager um, IOptions<TokenAuthentication> ta, IAuditRepository audit, ITokenRepository token,
|
||||||
IPlexOAuthManager oAuthManager)
|
IPlexOAuthManager oAuthManager)
|
||||||
|
@ -46,6 +47,7 @@ namespace Ombi.Controllers
|
||||||
/// <param name="model">The model.</param>
|
/// <param name="model">The model.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
|
[ProducesResponseType(401)]
|
||||||
public async Task<IActionResult> GetToken([FromBody] UserAuthModel model)
|
public async Task<IActionResult> GetToken([FromBody] UserAuthModel model)
|
||||||
{
|
{
|
||||||
if (!model.UsePlexOAuth)
|
if (!model.UsePlexOAuth)
|
||||||
|
@ -100,6 +102,8 @@ namespace Ombi.Controllers
|
||||||
/// Returns the Token for the Ombi User if we can match the Plex user with a valid Ombi User
|
/// Returns the Token for the Ombi User if we can match the Plex user with a valid Ombi User
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[HttpPost("plextoken")]
|
[HttpPost("plextoken")]
|
||||||
|
[ProducesResponseType(401)]
|
||||||
|
[ProducesResponseType(400)]
|
||||||
public async Task<IActionResult> GetTokenWithPlexToken([FromBody] PlexTokenAuthentication model)
|
public async Task<IActionResult> GetTokenWithPlexToken([FromBody] PlexTokenAuthentication model)
|
||||||
{
|
{
|
||||||
if (!model.PlexToken.HasValue())
|
if (!model.PlexToken.HasValue())
|
||||||
|
@ -161,6 +165,7 @@ namespace Ombi.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("{pinId:int}")]
|
[HttpGet("{pinId:int}")]
|
||||||
|
[ProducesResponseType(401)]
|
||||||
public async Task<IActionResult> OAuth(int pinId)
|
public async Task<IActionResult> OAuth(int pinId)
|
||||||
{
|
{
|
||||||
var accessToken = await _plexOAuthManager.GetAccessTokenFromPin(pinId);
|
var accessToken = await _plexOAuthManager.GetAccessTokenFromPin(pinId);
|
||||||
|
@ -201,6 +206,7 @@ namespace Ombi.Controllers
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
[HttpPost("refresh")]
|
[HttpPost("refresh")]
|
||||||
|
[ProducesResponseType(401)]
|
||||||
public IActionResult RefreshToken([FromBody] TokenRefresh token)
|
public IActionResult RefreshToken([FromBody] TokenRefresh token)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,8 @@ namespace Ombi.Controllers
|
||||||
[ApiV1]
|
[ApiV1]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
public class UpdateController : Controller
|
[ApiController]
|
||||||
|
public class UpdateController : ControllerBase
|
||||||
{
|
{
|
||||||
public UpdateController(ICacheService cache, IChangeLogProcessor processor)
|
public UpdateController(ICacheService cache, IChangeLogProcessor processor)
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,7 +13,8 @@ namespace Ombi.Controllers
|
||||||
[ApiV1]
|
[ApiV1]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
public class VoteController : Controller
|
[ApiController]
|
||||||
|
public class VoteController : ControllerBase
|
||||||
{
|
{
|
||||||
public VoteController(IVoteEngine engine)
|
public VoteController(IVoteEngine engine)
|
||||||
{
|
{
|
||||||
|
|
33
src/Ombi/Models/DenyAlbumMOdel.cs
Normal file
33
src/Ombi/Models/DenyAlbumMOdel.cs
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
#region Copyright
|
||||||
|
// /************************************************************************
|
||||||
|
// Copyright (c) 2017 Jamie Rees
|
||||||
|
// File: MovieUpdateModel.cs
|
||||||
|
// Created By: Jamie Rees
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
// a copy of this software and associated documentation files (the
|
||||||
|
// "Software"), to deal in the Software without restriction, including
|
||||||
|
// without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
// permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
// the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be
|
||||||
|
// included in all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
// ************************************************************************/
|
||||||
|
#endregion
|
||||||
|
namespace Ombi.Core.Models.Requests
|
||||||
|
{
|
||||||
|
public class DenyAlbumModel: AlbumUpdateModel
|
||||||
|
{
|
||||||
|
public string Reason { get; set; }
|
||||||
|
}
|
||||||
|
}
|
33
src/Ombi/Models/DenyMovieModel.cs
Normal file
33
src/Ombi/Models/DenyMovieModel.cs
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
#region Copyright
|
||||||
|
// /************************************************************************
|
||||||
|
// Copyright (c) 2017 Jamie Rees
|
||||||
|
// File: MovieUpdateModel.cs
|
||||||
|
// Created By: Jamie Rees
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
// a copy of this software and associated documentation files (the
|
||||||
|
// "Software"), to deal in the Software without restriction, including
|
||||||
|
// without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
// permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
// the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be
|
||||||
|
// included in all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
// ************************************************************************/
|
||||||
|
#endregion
|
||||||
|
namespace Ombi.Core.Models.Requests
|
||||||
|
{
|
||||||
|
public class DenyMovieModel : MovieUpdateModel
|
||||||
|
{
|
||||||
|
public string Reason { get; set; }
|
||||||
|
}
|
||||||
|
}
|
33
src/Ombi/Models/DenyTvModel.cs
Normal file
33
src/Ombi/Models/DenyTvModel.cs
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
#region Copyright
|
||||||
|
// /************************************************************************
|
||||||
|
// Copyright (c) 2017 Jamie Rees
|
||||||
|
// File: TvUpdateModel.cs
|
||||||
|
// Created By: Jamie Rees
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
// a copy of this software and associated documentation files (the
|
||||||
|
// "Software"), to deal in the Software without restriction, including
|
||||||
|
// without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
// permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
// the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be
|
||||||
|
// included in all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
// ************************************************************************/
|
||||||
|
#endregion
|
||||||
|
namespace Ombi.Models
|
||||||
|
{
|
||||||
|
public class DenyTvModel: TvUpdateModel
|
||||||
|
{
|
||||||
|
public string Reason { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -72,6 +72,8 @@
|
||||||
<PackageReference Include="Hangfire.SQLite" Version="1.4.2" />
|
<PackageReference Include="Hangfire.SQLite" Version="1.4.2" />
|
||||||
|
|
||||||
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.2.0" />
|
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.2.0" />
|
||||||
|
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.Api.Analyzers" Version="2.2.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="2.2.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="2.2.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.2.0" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.2.0" />
|
||||||
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.2.0" />
|
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.2.0" />
|
||||||
|
|
|
@ -96,6 +96,8 @@ namespace Ombi
|
||||||
options.User.AllowedUserNameCharacters = string.Empty;
|
options.User.AllowedUserNameCharacters = string.Empty;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
services.AddHealthChecks();
|
||||||
services.AddMemoryCache();
|
services.AddMemoryCache();
|
||||||
|
|
||||||
services.AddJwtAuthentication(Configuration);
|
services.AddJwtAuthentication(Configuration);
|
||||||
|
@ -150,6 +152,7 @@ namespace Ombi
|
||||||
var ctx = serviceProvider.GetService<IOmbiContext>();
|
var ctx = serviceProvider.GetService<IOmbiContext>();
|
||||||
loggerFactory.AddSerilog();
|
loggerFactory.AddSerilog();
|
||||||
|
|
||||||
|
app.UseHealthChecks("/health");
|
||||||
if (env.IsDevelopment())
|
if (env.IsDevelopment())
|
||||||
{
|
{
|
||||||
app.UseDeveloperExceptionPage();
|
app.UseDeveloperExceptionPage();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue