Some api work

This commit is contained in:
Joseph Milazzo 2020-12-20 17:47:18 -06:00
parent b6e0e05205
commit 8156aeb495
9 changed files with 82 additions and 64 deletions

View file

@ -1,4 +1,5 @@
using System.Linq;
using System;
using System.Linq;
using API.DTOs;
using API.Entities;
using AutoMapper;
@ -9,11 +10,15 @@ namespace API.Helpers
{
public AutoMapperProfiles()
{
CreateMap<AppUser, MemberDto>();
CreateMap<LibraryDto, Library>();
CreateMap<Library, LibraryDto>()
.ForMember(dest => dest.Folders,
opt =>
opt.MapFrom(src => src.Folders.Select(x => x.Path).ToList()));
CreateMap<AppUser, MemberDto>()
.AfterMap((ps, pst, context) => context.Mapper.Map(ps.Libraries, pst.Libraries));
}
}
}