2013-02-19 01:13:42 +00:00
|
|
|
|
using System;
|
|
|
|
|
using AutoMapper;
|
2013-02-23 17:42:15 +00:00
|
|
|
|
using NzbDrone.Api.Calendar;
|
2013-03-02 19:13:23 +00:00
|
|
|
|
using NzbDrone.Api.Episodes;
|
2013-05-03 06:53:32 +00:00
|
|
|
|
using NzbDrone.Api.History;
|
2013-03-21 03:02:57 +00:00
|
|
|
|
using NzbDrone.Api.Missing;
|
2013-05-20 00:30:02 +00:00
|
|
|
|
using NzbDrone.Api.Qualities;
|
2013-02-19 01:13:42 +00:00
|
|
|
|
using NzbDrone.Api.Resolvers;
|
|
|
|
|
using NzbDrone.Api.Series;
|
2013-05-02 05:50:34 +00:00
|
|
|
|
using NzbDrone.Core.Datastore;
|
2013-02-27 03:19:22 +00:00
|
|
|
|
using NzbDrone.Core.Qualities;
|
2013-02-20 07:45:52 +00:00
|
|
|
|
using NzbDrone.Core.Tv;
|
2013-02-19 01:13:42 +00:00
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Api
|
|
|
|
|
{
|
|
|
|
|
public static class AutomapperBootstraper
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public static void InitializeAutomapper()
|
|
|
|
|
{
|
|
|
|
|
//QualityProfiles
|
2013-05-20 00:30:02 +00:00
|
|
|
|
Mapper.CreateMap<QualityProfile, QualityProfileResource>()
|
2013-02-19 01:13:42 +00:00
|
|
|
|
.ForMember(dest => dest.Qualities,
|
|
|
|
|
opt => opt.ResolveUsing<AllowedToQualitiesResolver>().FromMember(src => src.Allowed));
|
|
|
|
|
|
2013-05-20 00:30:02 +00:00
|
|
|
|
Mapper.CreateMap<QualityProfileResource, QualityProfile>()
|
2013-02-19 01:13:42 +00:00
|
|
|
|
.ForMember(dest => dest.Allowed,
|
|
|
|
|
opt => opt.ResolveUsing<QualitiesToAllowedResolver>().FromMember(src => src.Qualities));
|
|
|
|
|
|
2013-02-27 03:19:22 +00:00
|
|
|
|
Mapper.CreateMap<Quality, QualityProfileType>()
|
2013-02-19 01:13:42 +00:00
|
|
|
|
.ForMember(dest => dest.Allowed, opt => opt.Ignore());
|
|
|
|
|
|
2013-02-27 03:19:22 +00:00
|
|
|
|
//QualitySize
|
2013-03-07 08:01:18 +00:00
|
|
|
|
Mapper.CreateMap<QualitySize, QualitySizeResource>()
|
2013-02-27 03:19:22 +00:00
|
|
|
|
.ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.QualityId));
|
2013-02-19 01:13:42 +00:00
|
|
|
|
|
2013-03-07 08:01:18 +00:00
|
|
|
|
Mapper.CreateMap<QualitySizeResource, QualitySize>()
|
2013-02-27 03:19:22 +00:00
|
|
|
|
.ForMember(dest => dest.QualityId, opt => opt.MapFrom(src => src.Id));
|
2013-02-19 01:13:42 +00:00
|
|
|
|
|
2013-03-02 19:13:23 +00:00
|
|
|
|
//Episode
|
|
|
|
|
Mapper.CreateMap<Episode, EpisodeResource>();
|
2013-05-02 05:50:34 +00:00
|
|
|
|
|
|
|
|
|
//Episode Paging
|
|
|
|
|
Mapper.CreateMap<PagingSpec<Episode>, PagingResource<EpisodeResource>>();
|
2013-05-03 06:53:32 +00:00
|
|
|
|
|
|
|
|
|
//History
|
2013-05-10 22:33:04 +00:00
|
|
|
|
Mapper.CreateMap<Core.History.History, HistoryResource>();
|
2013-05-03 06:53:32 +00:00
|
|
|
|
Mapper.CreateMap<PagingSpec<Core.History.History>, PagingResource<HistoryResource>>();
|
2013-02-19 01:13:42 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|