1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-09-19 16:01:46 +02:00

Added missing GetResourceById to CalendarModule needed by signalr

This commit is contained in:
kayone 2013-12-01 16:30:30 -08:00
parent bbb69a1dc7
commit 8fc93c7628
2 changed files with 18 additions and 10 deletions

View File

@ -29,6 +29,12 @@ public CalendarModule(ICommandExecutor commandExecutor,
_seriesRepository = seriesRepository;
GetResourceAll = GetCalendar;
GetResourceById = GetEpisode;
}
private EpisodeResource GetEpisode(int id)
{
return _episodeService.GetEpisode(id).InjectTo<EpisodeResource>();
}
private List<EpisodeResource> GetCalendar()

View File

@ -37,12 +37,24 @@ protected void ValidateId(int id)
protected RestModule(string modulePath)
: base(modulePath)
{
ValidateModule();
PostValidator = new ResourceValidator<TResource>();
PutValidator = new ResourceValidator<TResource>();
SharedValidator = new ResourceValidator<TResource>();
}
private void ValidateModule()
{
if (GetResourceById != null) return;
if (CreateResource != null || UpdateResource != null)
{
throw new InvalidOperationException("GetResourceById route must be defined before defining Create/Update routes.");
}
}
protected Action<int> DeleteResource
{
private get { return _deleteResource; }
@ -137,7 +149,6 @@ protected Func<TResource, int> CreateResource
private get { return _createResource; }
set
{
EnsureGetByIdRoute();
_createResource = value;
Post[ROOT_ROUTE] = options =>
{
@ -148,15 +159,6 @@ protected Func<TResource, int> CreateResource
}
}
private void EnsureGetByIdRoute()
{
if (GetResourceById == null)
{
throw new InvalidOperationException(
"GetResourceById route must be defined before defining Create/Update routes.");
}
}
protected Action<TResource> UpdateResource
{
private get { return _updateResource; }