2022-04-03 13:34:55 +08:00
|
|
|
using AutoMapper;
|
|
|
|
using BililiveRecorder.Core;
|
2022-04-03 20:43:38 +08:00
|
|
|
using BililiveRecorder.Core.Config.V3;
|
2022-04-03 13:34:55 +08:00
|
|
|
|
2022-04-03 15:34:22 +08:00
|
|
|
namespace BililiveRecorder.Web.Models.Rest
|
2022-04-03 13:34:55 +08:00
|
|
|
{
|
|
|
|
public class DataMappingProfile : Profile
|
|
|
|
{
|
|
|
|
public DataMappingProfile()
|
|
|
|
{
|
|
|
|
this.CreateMap<IRoom, RoomDto>()
|
|
|
|
.ForMember(x => x.RoomId, x => x.MapFrom(s => s.RoomConfig.RoomId))
|
2022-04-03 15:34:22 +08:00
|
|
|
.ForMember(x => x.AutoRecord, x => x.MapFrom(s => s.RoomConfig.AutoRecord))
|
|
|
|
;
|
2022-04-03 13:34:55 +08:00
|
|
|
|
2022-04-03 15:34:22 +08:00
|
|
|
this.CreateMap<RecordingStats, RoomStatsDto>()
|
|
|
|
.ForMember(x => x.SessionDuration, x => x.MapFrom(s => s.SessionDuration.TotalMilliseconds))
|
|
|
|
.ForMember(x => x.SessionMaxTimestamp, x => x.MapFrom(s => s.SessionMaxTimestamp.TotalMilliseconds))
|
|
|
|
.ForMember(x => x.FileMaxTimestamp, x => x.MapFrom(s => s.FileMaxTimestamp.TotalMilliseconds))
|
|
|
|
;
|
2022-04-03 13:34:55 +08:00
|
|
|
|
|
|
|
this.CreateMap<RoomConfig, RoomConfigDto>();
|
|
|
|
|
|
|
|
this.CreateMap<GlobalConfig, GlobalConfigDto>();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|