add addedDate to details

This commit is contained in:
Collin M. Barrett 2018-06-08 13:40:53 -05:00
parent 7189f2ead0
commit 74eabf7db4
4 changed files with 16 additions and 4 deletions

View file

@ -75,7 +75,7 @@ await DbContext.Snapshots.AsNoTracking()
.CountAsync();
}
private async Task<DateTime?> GetUpdatedDate(ListDetailsDto details)
private async Task<DateTime> GetUpdatedDate(ListDetailsDto details)
{
return await DbContext.Snapshots.AsNoTracking()
.Where(s => s.FilterListId == details.Id && s.IsCompleted &&

View file

@ -8,6 +8,7 @@ namespace FilterLists.Services.FilterList
public class ListDetailsDto
{
public int Id { get; set; }
public DateTime AddedDate { get; set; }
public string ChatUrl { get; set; }
public string Description { get; set; }
public string DescriptionSourceUrl { get; set; }
@ -26,7 +27,7 @@ public class ListDetailsDto
public int RuleCount { get; set; }
public string SubmissionUrl { get; set; }
public ListSyntaxDto Syntax { get; set; }
public DateTime? UpdatedDate { get; set; }
public DateTime UpdatedDate { get; set; }
public string ViewUrl { get; set; }
}
}

View file

@ -17,7 +17,8 @@ public MappingProfiles()
conf => conf.MapFrom(list => list.FilterListLanguages.Select(listLangs => listLangs.Language.Name)))
.ForMember(dto => dto.Maintainers,
conf => conf.MapFrom(list =>
list.FilterListMaintainers.Select(listMaints => listMaints.Maintainer)));
list.FilterListMaintainers.Select(listMaints => listMaints.Maintainer)))
.ForMember(dto => dto.AddedDate, conf => conf.MapFrom(list => list.CreatedDateUtc));
CreateMap<Maintainer, ListMaintainerDto>()
.ForMember(dto => dto.AdditionalLists,
conf => conf.MapFrom(maint =>

View file

@ -57,6 +57,7 @@ function ListInfo(props: any) {
<RuleCount count={props.details.ruleCount}/>
<DiscontinuedDate date={props.details.discontinuedDate}/>
<UpdatedDate date={props.details.updatedDate}/>
<AddedDate date={props.details.addedDate}/>
<PublishedDate date={props.details.publishedDate}/>
<License license={props.details.license}/>
</ul>
@ -122,7 +123,15 @@ function DiscontinuedDate(props: any) {
function UpdatedDate(props: any) {
return props.date
? <li className="list-group-item">
<p>Updated: {moment(props.date).format("MMM D, Y")}</p>
<p>Last Updated: {moment(props.date).format("MMM D, Y")}</p>
</li>
: null;
}
function AddedDate(props: any) {
return props.date
? <li className="list-group-item">
<p>Added to FilterLists: {moment(props.date).format("MMM D, Y")}</p>
</li>
: null;
}
@ -301,6 +310,7 @@ function MaintainerUrls(props: any) {
}
interface IFilterListDetailsDto {
addedDate: string;
chatUrl: string;
description: string;
descriptionSourceUrl: string;