Missing uses EpisodeResource now

pull/23/head
Mark McDowall 12 years ago
parent 9d5cb6f3e0
commit 0da2047ca5

@ -46,11 +46,6 @@ namespace NzbDrone.Api
//Episode //Episode
Mapper.CreateMap<Episode, EpisodeResource>(); Mapper.CreateMap<Episode, EpisodeResource>();
//Missing
Mapper.CreateMap<Episode, MissingResource>()
.ForMember(dest => dest.SeriesTitle, opt => opt.MapFrom(src => src.Series.Title))
.ForMember(dest => dest.EpisodeTitle, opt => opt.MapFrom(src => src.Title));
} }
} }
} }

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using AutoMapper; using AutoMapper;
using Nancy; using Nancy;
using NzbDrone.Api.Episodes;
using NzbDrone.Api.Extensions; using NzbDrone.Api.Extensions;
using NzbDrone.Core.Tv; using NzbDrone.Core.Tv;
@ -25,7 +26,9 @@ namespace NzbDrone.Api.Missing
Boolean.TryParse(PrimitiveExtensions.ToNullSafeString(Request.Query.IncludeSpecials), out includeSpecials); Boolean.TryParse(PrimitiveExtensions.ToNullSafeString(Request.Query.IncludeSpecials), out includeSpecials);
var episodes = _episodeService.EpisodesWithoutFiles(includeSpecials); var episodes = _episodeService.EpisodesWithoutFiles(includeSpecials);
return Mapper.Map<List<Episode>, List<MissingResource>>(episodes).AsResponse();
//TODO: Include the Series Title
return Mapper.Map<List<Episode>, List<EpisodeResource>>(episodes).AsResponse();
} }
} }
} }

@ -1,17 +0,0 @@
using System;
using System.Linq;
namespace NzbDrone.Api.Missing
{
public class MissingResource
{
public Int32 SeriesId { get; set; }
public String SeriesTitle { get; set; }
public Int32 EpisodeId { get; set; }
public String EpisodeTitle { get; set; }
public Int32 SeasonNumber { get; set; }
public Int32 EpisodeNumber { get; set; }
public DateTime? AirDate { get; set; }
public String Overview { get; set; }
}
}

@ -101,7 +101,6 @@
<Compile Include="Mapping\MappingValidation.cs" /> <Compile Include="Mapping\MappingValidation.cs" />
<Compile Include="Mapping\ResourceMappingException.cs" /> <Compile Include="Mapping\ResourceMappingException.cs" />
<Compile Include="Mapping\ValueInjectorExtensions.cs" /> <Compile Include="Mapping\ValueInjectorExtensions.cs" />
<Compile Include="Missing\MissingResource.cs" />
<Compile Include="Missing\MissingModule.cs" /> <Compile Include="Missing\MissingModule.cs" />
<Compile Include="NzbDroneRestModule.cs" /> <Compile Include="NzbDroneRestModule.cs" />
<Compile Include="Resolvers\EndTimeResolver.cs" /> <Compile Include="Resolvers\EndTimeResolver.cs" />

@ -1,8 +1,8 @@
"use strict"; "use strict";
define(['app', 'Missing/MissingModel'], function () { define(['app', 'Series/EpisodeModel'], function () {
NzbDrone.Missing.MissingCollection = Backbone.Collection.extend({ NzbDrone.Missing.MissingCollection = Backbone.Collection.extend({
url : NzbDrone.Constants.ApiRoot + '/missing', url : NzbDrone.Constants.ApiRoot + '/missing',
model : NzbDrone.Missing.MissingModel, model : NzbDrone.Series.EpisodeModel,
comparator: function (model) { comparator: function (model) {
return model.get('airDate'); return model.get('airDate');
} }

@ -1,5 +1,5 @@
<td><a href="/series/details/{{seriesId}}">{{seriesTitle}}</a></td> <td><a href="/series/details/{{seriesId}}">{{seriesTitle}}</a></td>
<td>{{seasonNumber}}x{{paddedEpisodeNumber}}</td> <td>{{seasonNumber}}x{{paddedEpisodeNumber}}</td>
<td name="episodeTitle"></td> <td name="title"></td>
<td><span title="{{formatedDateString}}" data-date="{{airDate}}">{{bestDateString}}</span></td> <td><span title="{{formatedDateString}}" data-date="{{airDate}}">{{bestDateString}}</span></td>
<td><i class="icon-search x-search" title="Search for Episode"></i></td> <td><i class="icon-search x-search" title="Search for Episode"></i></td>

@ -1,13 +0,0 @@
"use strict";
define(['app'], function () {
NzbDrone.Missing.MissingModel = Backbone.Model.extend({
mutators: {
bestDateString : function () {
return bestDateString(this.get('airDate'));
},
paddedEpisodeNumber: function () {
return this.get('episodeNumber');
}
}
});
});

@ -3,7 +3,12 @@ define(['app'], function () {
NzbDrone.Series.EpisodeModel = Backbone.Model.extend({ NzbDrone.Series.EpisodeModel = Backbone.Model.extend({
mutators: { mutators: {
bestDateString : function () {
return bestDateString(this.get('airDate'));
},
paddedEpisodeNumber: function () {
return this.get('episodeNumber');
}
}, },
defaults: { defaults: {

Loading…
Cancel
Save