123456789101112131415161718192021222324252627 |
- using Hotline.CallCenter.BlackLists;
- using Hotline.Identity.Accounts;
- using Hotline.Identity.Roles;
- using Hotline.Share.Dtos.CallCenter;
- using Hotline.Share.Dtos.Role;
- using Hotline.Share.Dtos.User;
- using Hotline.Users;
- using Mapster;
- namespace Hotline.Application.Mappers
- {
- public class MapperConfigs : IRegister
- {
- public void Register(TypeAdapterConfig config)
- {
- config.NewConfig<AddBlacklistDto, Blacklist>()
- .Ignore(d => d.Expired)
- .AfterMapping((s, t) => t.InitExpired());
- config.NewConfig<AddUserDto, User>()
- .Map(d => d.Name, x => x.Name ?? x.UserName);
- config.NewConfig<Role, RoleDto>()
- .Map(d => d.AccountIds, x => x.Accounts.Select(d => d.Id));
- }
- }
- }
|